/
Docker-compose file

Docker-compose file

  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/ depends_on: - node_container - kafka-broker restart: unless-stopped networks: - dws-network mongo: image: mongo:latest ports: - "27017:27017" restart: unless-stopped networks: - dws-network environment: - MONGO_INITDB_ROOT_USERNAME=<user-mongo> - MONGO_INITDB_ROOT_PASSWORD=<user-mongo> - MONGO_INITDB_DATABASE=dev volumes: - ./mongo/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro - ./mongo/backups:/backups - ./mongo/entrypoint.sh:/entrypoint.sh - ./mongo/data:/data mongo-seed: image: mongo:latest depends_on: - mongo networks: - dws-network restart: no volumes: - ./mongo/backups:/backups - ./mongo/entrypoint.sh:/entrypoint.sh entrypoint: ["sh","./entrypoint.sh"] command: tail -f /dev/null node_container: build: context: ./node_container image: node_container container_name: node_container # depends_on: # - mongo ports: - "3000:3000" - "3002:3002" - "3015:3015" 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_LISTENER: INSIDE_KAFKA:9092 KAFKA_LISTENER_SECURITY_PROTOCOL: PLAINTEXT KAFKA_LISTENER_INTERCEPTOR_CLASSES: "io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor" KAFKA_LISTENER_NAME_INTERNAL: INSIDE_KAFKA KAFKA_LISTENER_PORT: 9092 KAFKA_ADVERTISED_HOST_NAME: kafka-broker KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 KAFKA_LOG_DIRS: /kafka/kafka-logs KAFKA_DEFAULT_REPLICATION_FACTOR: 1 KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 KAFKA_DELETE_TOPIC_ENABLE: true volumes: - ./kafka-logs:/kafka/kafka-logs depends_on: - zookeeper restart: unless-stopped networks: - dws-network zookeeper: image: wurstmeister/zookeeper container_name: zookeeper environment: ZOOKEEPER_SERVER_ID: 1 ZOOKEEPER_LISTENER_PORT: 2181 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 ➡️

Related content