Skip to content

Instantly share code, notes, and snippets.

@CCH0124
Forked from gbzarelli/mongo-docker-compose.yml
Created November 10, 2022 00:43
Show Gist options
  • Select an option

  • Save CCH0124/af0ef5406cf278ea434852dfaf487cac to your computer and use it in GitHub Desktop.

Select an option

Save CCH0124/af0ef5406cf278ea434852dfaf487cac to your computer and use it in GitHub Desktop.

Revisions

  1. @gbzarelli gbzarelli revised this gist Mar 28, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion mongo-init.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@ db = db.getSiblingDB('sample_db');

    db.createCollection('sample_collection');

    db.wh_filters.insertMany([
    db.sample_collection.insertMany([
    {
    org: 'helpdev',
    filter: 'EVENT_A',
  2. @gbzarelli gbzarelli renamed this gist Mar 28, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @gbzarelli gbzarelli created this gist Mar 28, 2021.
    30 changes: 30 additions & 0 deletions docker-compose.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    version: '3.8'

    services:

    # Database - Mongo DB
    mongo:
    image: mongo
    environment:
    MONGO_INITDB_ROOT_USERNAME: helpdev
    MONGO_INITDB_ROOT_PASSWORD: 123456
    ports:
    - "27017:27017"
    volumes:
    - ./docker-entrypoint-initdb.d/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro

    # Database Manager
    mongo-express:
    image: mongo-express
    ports:
    - 8099:8081
    depends_on:
    - mongo
    environment:
    ME_CONFIG_BASICAUTH_USERNAME: express
    ME_CONFIG_BASICAUTH_PASSWORD: 123456
    ME_CONFIG_MONGODB_PORT: 27017
    ME_CONFIG_MONGODB_ADMINUSERNAME: helpdev
    ME_CONFIG_MONGODB_ADMINPASSWORD: 123456
    links:
    - mongo
    21 changes: 21 additions & 0 deletions mongo-init.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    db = db.getSiblingDB('sample_db');

    db.createCollection('sample_collection');

    db.wh_filters.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'
    }
    ]);