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

Version 1 Next »

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

  1. Go to /opt/zw-vmmc-docker/tomcat/conf and create log4j2.json config.json file:

    vim/opt/zw-vmmc-docker/tomcat/conf/log4j2.json

    And paste the next content:

    {
        "configuration": {
            "status": "warn",
            "name": "connectDWS",
            "packages": "psi.dws",
            "ThresholdFilter": {
                "level": "debug"
            },
            "appenders": {
                "Console": {
                    "name": "Console",
                    "PatternLayout": {
                        "pattern": "%d{HH:mm:ss.SSS} %-5level %X{request.id} %logger{36} - %msg%n"
                    }
                }
            },
            "loggers": {
                "root": {
                    "level": "warn",
                    "AppenderRef": {
                        "ref": "Console"
                    }
                }
            }
        }
    }
  2. In the same folder create config.json file:

    vim /opt/zw-vmmc-docker/tomcat/conf/config.json
  3. Copy the next lines on the file you are creating:

      {
      "tomcatLog4j2Config": "/usr/local/tomcat/conf/log4j2.json",
      "dws": {
        "kafkaBrokers": "kafka:9092",
        "urlsToEnqueueHighPriority": [],
        "urlsToEnqueueMediumPriority": [],
        "wsInternalDevVer": "0.0.19.02.02",
        "accessServerUsernameProfiler": "dwsUser",
        "accessServerPasswordProfiler": "dwsPass",
        "enqueueProgramFilter": [
          "pezQRuP6DE2"
        ],
        "gitDefaultUrlDefault": "http://localhost:8080/connectGitConfig/api/getConfig?type=ws_v2&ver=1",
        "gitDefaultUrlProd": "http://localhost:8080/connectGitConfig/api/getConfig?type=ws_v2&ver=1",
        "unsafeUrls": [
          "https://18.205.64.238/"
        ],
        "reqCustomHeaders": [
          {
            "key": "DWS-CONFIG",
            "urlRegex": "connectGitConfig/api",
            "value": "JBcLRzkItdEauNqqq91TQSjAREdzCZT2"
          },
          {
            "key": "DWS-SIGNATURE",
            "urlRegex": ".*",
            "value": "dws"
          }
        ],
        "initCachedGitConfigUrlsDefault": [],
        "initCachedGitConfigUrlsStage": [],
        "initCachedGitConfigUrlsTest": [],
        "initCachedGitConfigUrlsTrain": [],
        "initCachedGitConfigUrlsProd": [],
        "servicesAvailability": {
          "dhis2_available": "DHIS2",
          "legacy_available": "LEGACY",
          "mongo_available": "MONGO",
          "poeditor_available": "POEDITOR",
          "replica_available": "REPLICA"
        }
      },
      "routeNode": {
        "routeMap": {
          "mongoDB_Disabled": "3000",
          "cronWs": "http://localhost:3002",
          "webshot": "http://localhost:3005"
        }
      },
      "connectGitConfig": {
        "postgreSql": "localhost:5432"
      },
      "voucherGen": {
        "postgreSql": "localhost:5432",
        "mongoUrl": "mongo:3000"
      },
      "voucherGenWs": {
        "postgreSql": "localhost:5432",
        "mongoUrl": "mongo:3000"
      }
    }
    
  4. After that, we will need to get the services. To get the resources you need to access to GitHub and download the war files of the next releases:

  5. All these war files have to be moved to /opt/zw-vmmc-docker/tomcat/webapps

  6. The last step in the tomcat folder is to create the dockerfile in /opt/zw-vmmc-docker/tomcat :

    vim /opt/zw-vmmc-docker/tomcat/dockerfile
  7. With the next content:

    # tomcat/Dockerfile
    
    # Use the Tomcat Docker Official Image
    FROM tomcat:9.0-jdk11-openjdk
    
    # Use root
    USER root
    
    WORKDIR /usr/local/tomcat
    
    # Not necessary, but, install vim and bash-completion
    RUN apt-get update 
    RUN apt-get install -y vim
    RUN apt-get install -y bash-completion 
    RUN  apt-get clean 
    RUN rm -rf /var/lib/apt/lists/* run 
    
    # Create 'tomcat' user
    RUN useradd -r -m -U -d /usr/local/tomcat -s /bin/false tomcat
    
    # Update repositories and install necessary tools:
    RUN apt-get update && apt-get install -y \
        passwd \
        && rm -rf /var/lib/apt/lists/*
    
    # Change user owner
    RUN chown -R tomcat:tomcat /usr/local/tomcat
    # Change to 'tomcat' user
    USER tomcat
    
    # Copy log4j2 config file
    COPY conf/log4j2.json /usr/local/tomcat/conf/
    
    # Copy config.json file
    COPY conf/config.json /usr/local/tomcat/conf/
    
    # Copy .war files to the tomcat webapps folder.
    COPY webapps/*.war /usr/local/tomcat/webapps/
    
    EXPOSE 8080
    
    # run Tomcat
    CMD ["catalina.sh", "run"]
  • No labels