Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OZ-668: Add bundled-docker module containing file for building bundled Docker images #109

Merged
merged 2 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions bundled-docker/assembly.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
http://maven.apache.org/xsd/assembly-1.1.2.xsd"
>
<id>zip-dir</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<outputDirectory>..</outputDirectory>
<directory>${project.build.directory}/${project.artifactId}-${project.version}</directory>
</fileSet>
</fileSets>
</assembly>
346 changes: 346 additions & 0 deletions bundled-docker/docker-compose-bundled.yml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,346 @@
networks:
ozone:
web:
external: true

services:
mysql:
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --skip-character-set-client-handshake
- --skip-innodb-read-only-compressed
- --log-bin=mysqld-bin
- --binlog-format=ROW
- --server-id=2
- --sync-binlog=1
- --binlog-annotate-row-events=0
environment:
MYSQL_ROOT_PASSWORD: "\${MYSQL_ROOT_PASSWORD}"
EIP_DB_NAME_ODOO: \${EIP_DB_NAME_ODOO}
EIP_DB_USER_ODOO: \${EIP_DB_USER_ODOO}
EIP_DB_PASSWORD_ODOO: \${EIP_DB_PASSWORD_ODOO}
OPENMRS_DB_NAME: \${OPENMRS_DB_NAME}
OPENMRS_DB_USER: \${OPENMRS_DB_USER}
OPENMRS_DB_PASSWORD: \${OPENMRS_DB_PASSWORD}
EIP_DB_NAME_SENAITE: \${EIP_DB_NAME_SENAITE}
EIP_DB_USER_SENAITE: \${EIP_DB_USER_SENAITE}
EIP_DB_PASSWORD_SENAITE: \${EIP_DB_PASSWORD_SENAITE}
healthcheck:
test: "exit 0"
image: ${dockerUserName}/${sanitizedArtifactId}-mysql:${dockertag}
networks:
- ozone
ports:
- "3306:3306"
restart: unless-stopped
volumes:
- "\${MYSQL_DATADIR:-mysql-data}:/var/lib/mysql"

postgresql:
command: "postgres -c wal_level=logical -c max_wal_senders=10 -c max_replication_slots=10"
image: ${dockerUserName}/${sanitizedArtifactId}-postgresql:${dockertag}
environment:
POSTGRES_DB: postgres
POSTGRES_USER: \${POSTGRES_USER}
POSTGRES_PASSWORD: \${POSTGRES_PASSWORD}
ODOO_DB_NAME: \${ODOO_DATABASE}
ODOO_DB_USER: \${ODOO_DB_USER}
ODOO_DB_PASSWORD: \${ODOO_DB_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
networks:
- ozone
ports:
- "5432:5432"
restart: unless-stopped
volumes:
- "\${POSTGRES_DATADIR:-postgresql-data}:/var/lib/postgresql/data"

# Odoo
odoo:
depends_on:
postgresql:
condition: service_healthy
environment:
- HOST=\${POSTGRES_DB_HOST}
- USER=\${ODOO_DB_USER}
- PASSWORD=\${ODOO_DB_PASSWORD}
- ADDONS=sale_management,stock,account_account,purchase,mrp,odoo_initializer,ozone_settings,mrp_product_expiry,product_expiry,l10n_generic_coa
- INITIALIZER_DATA_FILES_PATH=/mnt/odoo_config
- INITIALIZER_CONFIG_FILE_PATH=/mnt/odoo_config/initializer_config.json
image: ${dockerUserName}/${sanitizedArtifactId}-odoo:${dockertag}
labels:
traefik.enable: true
# https
traefik.http.routers.odoo-https.rule: Host(`\${ODOO_HOSTNAME}`)
traefik.http.routers.odoo-https.entrypoints: websecure
traefik.http.routers.odoo-https.service: odoo
traefik.http.routers.odoo-https.middlewares: gzip,sslheader,limit
#----------------------------- routes for: odoo/web/database || odoo/website/info -----------------------------
# https
traefik.http.routers.odoo-db-https.rule: Host(`\${ODOO_HOSTNAME}`) && (PathPrefix(`/web/database`) || PathPrefix(`/website/info`))
traefik.http.routers.odoo-db-https.entrypoints: websecure
traefik.http.routers.odoo-db-https.service: odoo
traefik.http.routers.odoo-db-https.middlewares: gzip,sslheader,limit
traefik.http.services.odoo-db-https.loadbalancer.server.port: 8069
#---------------------------------------- routes for: odoo/longpolling ------------------------------------------------
# https
traefik.http.routers.odoo-im-https.rule: Host(`\${ODOO_HOSTNAME}`) && (PathPrefix(`/longpolling`))
traefik.http.routers.odoo-im-https.entrypoints: websecure
traefik.http.routers.odoo-im-https.service: odoo-im
traefik.http.routers.odoo-im-https.middlewares: gzip,sslheader,limit

#====================================================== services ===========================================================
traefik.http.services.odoo.loadbalancer.server.port: 8069
traefik.http.services.odoo-im.loadbalancer.server.port: 8072

#===================================================== middlewares =========================================================
traefik.http.middlewares.gzip.compress: true
traefik.http.middlewares.sslheader.headers.customrequestheaders.X-Forwarded-Proto: https
traefik.http.middlewares.limit.buffering.memRequestBodyBytes: 20971520
traefik.http.middlewares.limit.buffering.maxRequestBodyBytes: 20971520
networks:
- ozone
- web
restart: unless-stopped
volumes:
- "\${ODOO_FILESTORE:-odoo-filestore}:/var/lib/odoo/filestore"
- "\${ODOO_CONFIG_CHECKSUMS_PATH:-odoo-checksums}:/mnt/checksums"

# Odoo - OpenMRS integration service
eip-odoo-openmrs:
depends_on:
openmrs:
condition: service_healthy
mysql:
condition: service_started
odoo:
condition: service_started
environment:
- DB_EVENT_DESTINATIONS_ODOO=\${DB_EVENT_DESTINATIONS_ODOO}
- EIP_DB_NAME_ODOO=\${EIP_DB_NAME_ODOO}
- EIP_DB_USER_ODOO=\${EIP_DB_USER_ODOO}
- EIP_DB_PASSWORD_ODOO=\${EIP_DB_PASSWORD_ODOO}
- ODOO_DATABASE=\${ODOO_DATABASE}
- ODOO_USER=\${ODOO_USER}
- ODOO_PASSWORD=\${ODOO_PASSWORD}
- CREATE_CUSTOMER_IF_NOT_EXIST=\${CREATE_CUSTOMER_IF_NOT_EXIST}
- ODOO_CUSTOMER_EXTERNAL_ID=\${ODOO_CUSTOMER_EXTERNAL_ID}
- ODOO_CUSTOMER_DOB_FIELD=\${ODOO_CUSTOMER_DOB_FIELD}
- ODOO_CUSTOMER_WEIGHT_FIELD=\${ODOO_CUSTOMER_WEIGHT_FIELD}
- EMR_WEIGHT_CONCEPT=\${EMR_WEIGHT_CONCEPT}
- OPENMRS_IDENTIFIER_TYPE_UUID=\${OPENMRS_IDENTIFIER_TYPE_UUID}
- ODOO_ENABLE_EXTRA_CUSTOMER_FIELDS_ROUTE=\${ODOO_ENABLE_EXTRA_CUSTOMER_FIELDS_ROUTE}
- ODOO_ENABLE_EXTRA_QUOTATION_FIELDS_ROUTE=\${ODOO_ENABLE_EXTRA_QUOTATION_FIELDS_ROUTE}
- ODOO_URL=http://odoo:8069
- OPENMRS_URL=http://openmrs:8080/openmrs
- EIP_PROFILE=prod
- EIP_WATCHED_TABLES=patient,person_name,person_address,patient_identifier,orders,test_order,drug_order
- MYSQL_ADMIN_USER=root
- MYSQL_ADMIN_USER_PASSWORD=\${MYSQL_ROOT_PASSWORD}
- OPENMRS_DB_HOST=\${OPENMRS_DB_HOST}
- OPENMRS_DB_PORT=\${OPENMRS_DB_PORT}
- OPENMRS_DB_NAME=\${OPENMRS_DB_NAME}
- OPENMRS_DB_USER=\${OPENMRS_DB_USER}
- OPENMRS_DB_PASSWORD=\${OPENMRS_DB_PASSWORD}
- OPENMRS_USER=\${OPENMRS_USER}
- OPENMRS_PASSWORD=\${OPENMRS_PASSWORD}
- EIP_FHIR_RESOURCES=Patient,ServiceRequest,MedicationRequest
- EIP_FHIR_SERVER_URL=http://openmrs:8080/openmrs/ws/fhir2/R4
- EIP_FHIR_USERNAME=\${OPENMRS_USER}
- EIP_FHIR_PASSWORD=\${OPENMRS_PASSWORD}
image: ${dockerUserName}/${sanitizedArtifactId}-eip-odoo-openmrs:${dockertag}
networks:
ozone:
aliases:
- eip-client-odoo
- eip-odoo-openmrs
restart: unless-stopped
volumes:
- eip-home-odoo:/eip-home
# OpenMRS 3 Backend
openmrs:
depends_on:
mysql:
condition: service_started
environment:
OMRS_CONFIG_MODULE_WEB_ADMIN: "true"
OMRS_CONFIG_AUTO_UPDATE_DATABASE: "true"
OMRS_CONFIG_CREATE_TABLES: "true"
OMRS_CONFIG_CONNECTION_SERVER: mysql
OMRS_CONFIG_CONNECTION_DATABASE: openmrs
OMRS_CONFIG_CONNECTION_USERNAME: \${OPENMRS_DB_USER:-openmrs}
OMRS_CONFIG_CONNECTION_PASSWORD: \${OPENMRS_DB_PASSWORD:-openmrs}
HOST_URL: https://\${O3_HOSTNAME}
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/openmrs/health/started" ]
interval: 10s
timeout: 5s
retries: 48
start_period: 120s
image: ${dockerUserName}/${sanitizedArtifactId}-openmrs-backend:${dockertag}
labels:
traefik.enable: "true"
traefik.http.routers.openmrs.rule: "Host(`\${O3_HOSTNAME}`) && PathPrefix(`/openmrs`)"
traefik.http.routers.openmrs.entrypoints: "websecure"
traefik.http.services.openmrs.loadbalancer.server.port: 8080
traefik.http.routers.openmrs.middlewares: openmrs-spa-redirectregex
traefik.http.middlewares.openmrs-spa-redirectregex.redirectregex.regex: https://\${O3_HOSTNAME}/openmrs/spa
traefik.http.middlewares.openmrs-spa-redirectregex.redirectregex.replacement: https://\${O3_HOSTNAME}/openmrs/spa/home
networks:
- ozone
- web
restart: unless-stopped
volumes:
- "openmrs-data:/openmrs/data"
- "\${OPENMRS_CONFIG_CHECKSUMS_PATH:-openmrs-config-checksums}:/openmrs/data/configuration_checksums"

# OpenMRS 3 Frontend
frontend:
environment:
SPA_PATH: /openmrs/spa
API_URL: /openmrs
SPA_CONFIG_URLS: \${SPA_CONFIG_URLS}
SPA_DEFAULT_LOCALE: \${SPA_DEFAULT_LOCALE}
ODOO_PUBLIC_URL: https://\${ODOO_HOSTNAME:-http://localhost:8069}
OPENMRS_PUBLIC_URL: https://\${O3_HOSTNAME:-http://localhost}
SENAITE_PUBLIC_URL: https://\${SENAITE_HOSTNAME:-http://localhost:8081}
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
timeout: 5s
image: ${dockerUserName}/${sanitizedArtifactId}-openmrs-frontend:${dockertag}
labels:
traefik.enable: "true"
traefik.http.routers.frontend.rule: "Host(`\${O3_HOSTNAME}`) && PathPrefix(`/openmrs/spa/`)"
traefik.http.routers.frontend.entrypoints: "websecure"
traefik.http.routers.frontend.middlewares: frontend-stripprefix,gzip
traefik.http.services.frontend.loadbalancer.server.port: 80

traefik.http.routers.home.rule: "Host(`\${O3_HOSTNAME}`) && PathPrefix(`/home`)"
traefik.http.routers.home.entrypoints: "websecure"
traefik.http.routers.home.middlewares: home-redirectregex

traefik.http.routers.root.rule: "Host(`\${O3_HOSTNAME}`) && PathPrefix(`/`)"
traefik.http.routers.root.entrypoints: "websecure"
traefik.http.routers.root.middlewares: root-redirectregex

traefik.http.middlewares.frontend-stripprefix.stripprefix.prefixes: /openmrs/spa
traefik.http.middlewares.frontend-stripprefix.stripprefix.forceslash: false
traefik.http.middlewares.home-redirectregex.redirectregex.regex: https://\${O3_HOSTNAME}/home
traefik.http.middlewares.home-redirectregex.redirectregex.replacement: https://\${O3_HOSTNAME}/openmrs/spa/home
traefik.http.middlewares.root-redirectregex.redirectregex.regex: https://\${O3_HOSTNAME}
traefik.http.middlewares.root-redirectregex.redirectregex.replacement: https://\${O3_HOSTNAME}/openmrs/spa/home
traefik.http.middlewares.gzip.compress: true
networks:
- ozone
- web
restart: unless-stopped
# SENAITE
senaite:
environment:
- SITE=\${SITE}
- ADMIN_USER=\${SENAITE_ADMIN_USER}
- ADMIN_PASSWORD=\${SENAITE_ADMIN_PASSWORD}
image: ${dockerUserName}/${sanitizedArtifactId}-senaite:${dockertag}
labels:
- "traefik.enable=true"
- "traefik.http.services.senaite.loadbalancer.server.port=8080"
- "traefik.http.routers.senaite.rule=Host(`\${SENAITE_HOSTNAME}`)"
- "traefik.http.routers.senaite.middlewares=senaite"
- "traefik.http.middlewares.senaite.addprefix.prefix=/VirtualHostBase/https/\${SENAITE_HOSTNAME}/senaite/VirtualHostRoot"
networks:
- ozone
- web
restart: unless-stopped
volumes:
- senaite-filestorage:/data/filestorage
- senaite-blobstorage:/data/blobstorage

# OpenMRS - SENAITE integration service
eip-openmrs-senaite:
depends_on:
openmrs:
condition: service_healthy
mysql:
condition: service_started
senaite:
condition: service_started
environment:
- SENAITE_SERVER_URL=http://senaite:8080/senaite
- SENAITE_SERVER_USER=\${SENAITE_ADMIN_USER}
- SENAITE_SERVER_PASSWORD=\${SENAITE_ADMIN_PASSWORD}
- OPENMRS_SERVER_URL=http://openmrs:8080/openmrs
- OPENMRS_SERVER_USER=\${OPENMRS_USER}
- OPENMRS_SERVER_PASSWORD=\${OPENMRS_PASSWORD}
- OPENMRS_RESULTS_ENCOUNTER_TYPE_UUID=\${RESULTS_ENCOUNTER_TYPE_UUID}
- OPENMRS_IDENTIFIER_TYPE_UUID=\${OPENMRS_IDENTIFIER_TYPE_UUID}
- OPENMRS_CONCEPT_COMPLEX_UUID=\${CONCEPT_COMPLEX_UUID}
- BAHMNI_TEST_ORDER_TYPE_UUID=\${BAHMNI_TEST_ORDER_TYPE_UUID}
- EIP_PROFILE=prod
- EIP_WATCHED_TABLES=patient,person_name,person_address,patient_identifier,orders,test_order
- EIP_DB_NAME_SENAITE=\${EIP_DB_NAME_SENAITE}
- EIP_DB_USER_SENAITE=\${EIP_DB_USER_SENAITE}
- EIP_DB_PASSWORD_SENAITE=\${EIP_DB_PASSWORD_SENAITE}
- DB_EVENT_DESTINATIONS_SENAITE=\${DB_EVENT_DESTINATIONS_SENAITE}
- MYSQL_ADMIN_USER=root
- MYSQL_ADMIN_USER_PASSWORD=\${MYSQL_ROOT_PASSWORD}
- OPENMRS_DB_HOST=\${OPENMRS_DB_HOST}
- OPENMRS_DB_PORT=\${OPENMRS_DB_PORT}
- OPENMRS_DB_NAME=\${OPENMRS_DB_NAME}
- OPENMRS_DB_USER=\${OPENMRS_DB_USER}
- OPENMRS_DB_PASSWORD=\${OPENMRS_DB_PASSWORD}
- OPENMRS_USER=\${OPENMRS_USER}
- OPENMRS_PASSWORD=\${OPENMRS_PASSWORD}
image: ${dockerUserName}/${sanitizedArtifactId}-eip-openmrs-senaite:${dockertag}
networks:
ozone:
aliases:
- eip-client-senaite
restart: unless-stopped
volumes:
- eip-home-senaite:/eip-home
proxy:
restart: unless-stopped
image: ${dockerUserName}/${sanitizedArtifactId}-proxy:${dockertag}
healthcheck:
test:
- CMD
- curl
- "-f"
- "http://localhost/"
networks:
ozone:
ports:
- "\${PROXY_PUBLIC_PORT:-80}:80"
- "8069:8069"
- "8081:8081"
- "8088:8088"
- "8082:8082"
volumes:
- "\${PROXY_TLS_CERTS_PATH:-proxy-tls-certs}:/etc/tls"
version: "3.7"

volumes:
mysql-data: ~
postgresql-data: ~
eip-home-odoo: ~
odoo-checksums: ~
odoo-config: ~
odoo-extra-addons: ~
odoo-filestore: ~
odoo-web-data: ~
openmrs-core: ~
openmrs-config: ~
openmrs-config-checksums: ~
openmrs-data: ~
openmrs-modules: ~
openmrs-owas: ~
eip-home-senaite: ~
senaite-blobstorage: ~
senaite-filestorage: ~
proxy-tls-certs: ~

2 changes: 2 additions & 0 deletions bundled-docker/eip-erpnext-openmrs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM mekomsolutions/eip-client
ADD binaries/eip-erpnext-openmrs /eip-client/routes
2 changes: 2 additions & 0 deletions bundled-docker/eip-odoo-openmrs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM mekomsolutions/eip-client
ADD binaries/eip-odoo-openmrs /eip-client/routes
2 changes: 2 additions & 0 deletions bundled-docker/eip-openmrs-senaite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM mekomsolutions/eip-client
ADD binaries/eip-openmrs-senaite /eip-client/routes
3 changes: 3 additions & 0 deletions bundled-docker/erpnext/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM frappe/erpnext:v15.12.2
ADD binaries/erpnext/scripts /opt/erpnext/scripts
ADD configs/erpnext/initializer_config /opt/erpnext/configs
8 changes: 8 additions & 0 deletions bundled-docker/frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM openmrs/openmrs-reference-application-3-frontend:nightly
ADD distro/binaries/openmrs/frontend /usr/share/nginx/html
ADD distro/configs/openmrs/frontend_config /usr/share/nginx/html/ozone
RUN mkdir -p /app
WORKDIR /app
COPY bundled-docker/frontend/startup.sh /app
RUN chmod +x /app/startup.sh
CMD ["/app/startup.sh"]
Loading