Here we are going to focus on the Mongo server and Java services.
Go to /opt/zw-vmmc-docker/services/ and create .env file:
vim /opt/zw-vmmc-docker/node_container/services/.env
And paste the next content:
MONGO_LOCATION="mongo:27017" MONGO_USER_PASS="<user>:<pwd>" KAFKA_BROKER="kafka-broker:9092"
You will need to replace “<user>” and “<pwd>” with the same user and password existing in: mongo-user // TODO
Continue creating the file ecosystem.config.js in the same folder:
vim /opt/zw-vmmc-docker/node_container/services/ecosystem.config.js
Copy the next lines on the file you are creating:
module.exports = { apps: [ { name: 'queue-service', script: './queue-service.js', instances: '1', }, { name: 'cronWs', script: './connect-cron/src/app.js', instances: '1', env: { PORT: 3002, }, }, { name: 'mongo', script: '/usr/src/app/connectMongo/nodeJsWs/mongo.js', instances: '1', exec_mode: 'cluster', env: { PORT: 3000, }, }, ], };
After that, we will need to get the services. To get the resources you need to access to GitHub and download the next releases:
All these folder haves to be moved to /opt/zw-vmmc-docker/node_container/services
The last step in the node_container folder is to create the dockerfile in /opt/zw-vmmc-docker/node_container :
vim /opt/zw-vmmc-docker/tomcat/dockerfile
With the next content:
# nodeapp/Dockerfile # Use the Mongo Docker Official Image FROM node:20-alpine # set the folder to copy the services WORKDIR /usr/src/app COPY services/ . # Install pm2 globally RUN apk add --no-cache bash-completion RUN apk add --no-cache vim RUN npm install pm2 -g WORKDIR /usr/src/app/connect-cron RUN npm install WORKDIR /usr/src/app/connectMongo/nodeJsWs RUN npm install WORKDIR /usr/src/app CMD ["sh", "-c", "cd /usr/src/app/connect-cron && npm install && cd /usr/src/app/connectMongo/nodeJsWs && npm install && cd /usr/src/app && pm2-runtime ecosystem.config.js"] EXPOSE 3000
Create a Docker Compose file in the /opt directory