Installation Steps
All the configuration is using docker and… (need better info)resume de lo que vamos a instalarnecessary services are going to be delocalized using docker.
Make sure that docker is installed on the machine you are going to use and that you have the proper permissions to be able to use it.
Due to the number of configurations. The steps have been divided into different pages. Each of these pages focuses on each of the major services.
Info |
---|
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. |
...
. |
First of all, we need to create the folder structure
on Go to /opt tocreate and run these commandsthe next command:
Code Block 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:
Code Block └── zw-vmmc-docker └── mongo └── backups └── nginx └── certs └── node_container └── services └── tomcat └── conf └── webapps
zw-vmmc-docker
Finally, create the docker-compose.yml file:
Code Block |
---|
vim/opt/zw-vmmc-docker/tomcat/conf/log4j2.json |
And past the next content:
Code Block 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
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:
...