Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 4 Current »

  1. Finally, create the docker-compose.yml file:

    vim/opt/zw-vmmc-docker/tomcat/conf/log4j2.json
  2. And past the next content:

    services:
      tomcat:
        build:
          context: ./tomcat
        image: tomcat
        container_name: tomcat
        ports:
          - "8080:8080"
        volumes:
          - ./tomcat/webapps:/usr/local/tomcat/webapps/
          - ./tomcat/conf/log4j2.json:/usr/local/tomcat/conf/log4j2.json
        depends_on:
          - node_container
          - kafka-broker
        restart: unless-stopped
        networks:
          - dws-network
    
      mongo:
        image: mongo:latest
        ports:
          - "27017:27017"
        networks:
          - dws-network
        environment:
          - MONGO_INITDB_ROOT_USERNAME=<user-mongo>
          - MONGO_INITDB_ROOT_PASSWORD=<pwd-mongo>
          - MONGO_INITDB_DATABASE=dev
        volumes:
          - ./mongo/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro
          - ./mongo/backups:/backup
    
      mongo-seed:
        image: mongo:latest
        depends_on:
          - mongo
        networks:
          - dws-network
        restart: no
        volumes:
          - ./mongo/backups:/backup
        entrypoint: ["sh", "-c", "sleep 20 && mongorestore --host mongo --port 27017 --username <user-mongo> --password <pwd-mongo> --authenticationDatabase admin --gzip --archive=/backup/prod-backup.gz&&mongorestore --host mongo --port 27017 --username gaspar --password gaspar --authenticationDatabase admin --gzip --archive=/backup/log-backup.gz  && exit "]
      
      node_container:
        build:
          context: ./node_container
        image: node_container
        container_name: node_container
        depends_on:
          - mongo
        ports:
          - "3000:3000"
          - "3002:3002"
        volumes:
          - ./node_container/services:/usr/src/app/
        restart: unless-stopped
        networks:
          - dws-network
      
      kafka-broker:
        image: wurstmeister/kafka
        container_name: kafka-broker
        ports:
          - "9092:9092"
        environment:
          KAFKA_ADVERTISED_HOST_NAME: kafka-broker
          KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
        depends_on:
          - zookeeper
        restart: unless-stopped
        networks:
          - dws-network
    
      zookeeper:
        image: wurstmeister/zookeeper
        container_name: zookeeper
        ports:
          - "2181:2181"
        restart: unless-stopped
        networks:
          - dws-network
    
    networks:
      dws-network:
        driver: bridge
  3. You will need to replace <user-mongo> and <pwd-mongo> with a username and password of your choice. Make sure the password is strong. You will find each one twice, (lines 26, 27, and 42).


Next: Deploy containers ➡️

  • No labels