Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Compose is a tool for defining and running multi-container Docker applications.

...

Note: Install docker CE or EE version. Docker CS is not supported and permission errors may be experienced if using Docker CS version.
Docker CS (Commercially Supported) is kind of the old bundle version of Docker EE for versions <= 1.13.

How to use the OpenSRP server web docker image?

...

  1. context.xml

    • Holds the postgres DB configurations e.g credentials, database name and other additional configs.

  2. web.xml

    • Holds mappings between URL paths and the servlets that handle requests with those paths, also the active spring profiles.

  3. log4j2.xml

    • Holds the logging configurations.

  4. OpenSRPopensrp.properties

    • Holds all the application properties config.

  5. keycloak.json

    • Holds all the keycloak configs used on spring.

    Code Block
      {
        "auth-server-url": "https://<keycloak-url>/auth/",
        "confidential-port": 443,
        "credentials": {
          "secret": "<sample-secret>"
          },
          "realm": "<realm name>",
          "resource": "<resource name>",
          "ssl-required": "external"
      }
    
  6. deployment.properties

    • Holds the mybatis database configurations.

...

Code Block
version: "3.9"
services:
  redis:
    restart: unless-stopped
    image: redis:6.0
    ports:
      - "6379:6379"
    command: redis-server --requirepass redisPassword # update with an appropriate password.
    volumes:
      - redisdata:/data
  postgres:
    restart: unless-stopped
    image: postgres:14
    ports:
      - "5457:5432"
    environment:
      - "POSTGRES_PASSWORD=mysecretpassword"
      - "POSTGRES_USER=postgres"
      - "POSTGRES_DB=postgres"
    volumes:
      - pgdata:/var/lib/postgresql/data
# Remove keycloak service if openmrs is used for authentication
  keycloak:
    restart: unless-stopped
    image: jboss/keycloak:16.1.1
    environment:
      - "KEYCLOAK_USER=admin"
      - "KEYCLOAK_PASSWORD=admin"
      - "DB_VENDOR=postgres"
      - "DB_PASSWORD=secretpassword"
      - "DB_USER=keycloak"
      - "DB_ADDR=postgres:5432"
      - "PROXY_ADDRESS_FORWARDING=true"
    ports:
      - "8081:8080"
      - "8443:8443"
    depends_on:
      - postgres
  OpenSRPopensrp-server-web:
    restart: unless-stopped
    image: OpenSRPopensrp/OpenSRPopensrp-server-web:v2.9.2-SNAPSHOT # pick the latest tag
    ports:
      - "8080:8080"
    volumes:
      - ./context.xml:/usr/local/tomcat/webapps/OpenSRPopensrp/META-INF/context.xml
      - ./OpenSRPopensrp.properties:/usr/local/tomcat/webapps/OpenSRPopensrp/WEB-INF/classes/OpenSRPopensrp.properties
      - ./keycloak.json:/usr/local/tomcat/webapps/OpenSRPopensrp/WEB-INF/keycloak.json
      - multimediaData:/opt/multimedia
    depends_on:
      - mybatis
      - keycloak
      - redis
# refer to https://hub.docker.com/r/OpenSRPopensrp/web 
# OpenSRPopensrp-web: 
#    depends_on:
#      - OpenSRPopensrp-server-web


#  mybatis:  #runs database migrations
#   image: OpenSRPopensrp/OpenSRPopensrp-server-web:v2.10.0-SNAPSHOT # pick the latest tag
#   command: ["/opt/mybatis/mybatis-migrations-3.3.4/bin/migrate", "up", "--path=/migrations", "--env=deployment"]
#    volumes:
#      - ./deployment.properties:/migrations/environments/deployment.properties
#    depends_on:
#      - postgres
volumes:
  redisdata:
#    external: true
  pgdata:
#    external: true
  multimediaData:
#    external: true

...