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 3 Current »

Here we are going to focus on the Mongo server and Java services.

  1. 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"
    
  2. You will need to replace “<user>” and “<pwd>” with the same user and password existing in: mongo-user // TODO

  3. Continue creating the file ecosystem.config.js in the same folder:

    vim /opt/zw-vmmc-docker/node_container/services/ecosystem.config.js
  4. 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,
          },
        },
      ],
    };
    
  5. After that, we will need to get the services. To get the resources you need to access to GitHub and download the next releases:

  6. All these folder haves to be moved to /opt/zw-vmmc-docker/node_container/services

  7. 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
  8. 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
    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
    


Next: Ngnix folder ➡️

  • No labels