docker-compose.yml
yml
version: '3.8'
services:
# Database - Mongo DB
mongo:
image: mongo:7.0.0
restart: on-failure
environment:
MONGO_INITDB_ROOT_USERNAME: test
MONGO_INITDB_ROOT_PASSWORD: test123
ports:
- "27017:27017"
volumes:
- ./docker-entrypoint-initdb.d/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
- ./data/mongodb-data:/data/db
- ./data/mongodb-log:/var/log/mongodb
/docker-entrypoint-initdb.d/mongo-init.js
js
db = db.getSiblingDB('db01');
db.createCollection('test_collection');
db.test_collection.insertMany([
{
org: 'helpdev',
filter: 'EVENT_A',
addrs: 'http://rest_client_1:8080/wh'
},
{
org: 'helpdev',
filter: 'EVENT_B',
addrs: 'http://rest_client_2:8081/wh'
},
{
org: 'github',
filter: 'EVENT_C',
addrs: 'http://rest_client_3:8082/wh'
}
]);