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 2 Next »

Installation Steps

All the configuration is using docker and… (need better info)

resume de lo que vamos a instalar.

To execute Docker commands, a user with sudo privileges is required. If the root user is accessible, there is no need to add the ‘sudo’ instruction.

In this section, we will focus on each folder to clarify its configuration.

First of all, we need to create the folder structure

  1. on /opt to create and run these commands:

    mkdir -p zw-vmmc-docker/certs \
             zw-vmmc-docker/mongo/backups \
             zw-vmmc-docker/nginx/certs \
             zw-vmmc-docker/node_container/services \
             zw-vmmc-docker/tomcat/conf \
             zw-vmmc-docker/tomcat/webapps
    
    

    It creates the next folder structure:

    └── zw-vmmc-docker
        └── mongo
            └── backups
        └── nginx
            └── certs
        └── node_container
            └── services
        └── tomcat
            └── conf
            └── webapps
      

zw-vmmc-docker

Finally, create the docker-compose.yml file:

vim/opt/zw-vmmc-docker/tomcat/conf/log4j2.json
  1. 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
    
      nginx:
        build:
          context: ./nginx
        volumes:
          - ./nginx/nginx.conf:/etc/nginx/nginx.conf
          - ./nginx/certs:/etc/ssl/certs  # SSL certificates
        ports:
          - "443:443"  # Exponer el puerto 443 para HTTPS
          
        depends_on:
          - tomcat
          - node_container
        restart: always
        networks:
          - dws-network
    
    networks:
      dws-network:
        driver: bridge
  2. You will need to replace <user-mongo> and <pwd-mongo>. You will find each one twice, (lines 26, 27, and 42).

Deploy containers

Go to /opt/zw-vmmc-docker and run:

docker compose up -dw
  • No labels