From df8a0f71deeda7aae97169117618e6f272797dc7 Mon Sep 17 00:00:00 2001 From: Emmanuel Nyachoke Date: Mon, 2 Sep 2024 16:04:05 +0300 Subject: [PATCH] OZ-668: Add bundled-docker module containing file for building bundled Docker images (#109) --- bundled-docker/assembly.xml | 20 + .../docker-compose-bundled.yml.template | 346 ++++++++++++++++++ bundled-docker/eip-erpnext-openmrs/Dockerfile | 2 + bundled-docker/eip-odoo-openmrs/Dockerfile | 2 + bundled-docker/eip-openmrs-senaite/Dockerfile | 2 + bundled-docker/erpnext/Dockerfile | 3 + bundled-docker/frontend/Dockerfile | 8 + bundled-docker/frontend/startup.sh | 10 + bundled-docker/mysql/Dockerfile | 5 + bundled-docker/odoo/Dockerfile | 4 + bundled-docker/openmrs/Dockerfile | 3 + bundled-docker/pom.xml | 108 ++++++ bundled-docker/postgresql/Dockerfile | 3 + bundled-docker/proxy/Dockerfile | 6 + bundled-docker/proxy/default.conf.template | 153 ++++++++ bundled-docker/proxy/nginx.conf | 31 ++ bundled-docker/senaite/Dockerfile | 2 + pom.xml | 1 + 18 files changed, 709 insertions(+) create mode 100644 bundled-docker/assembly.xml create mode 100644 bundled-docker/docker-compose-bundled.yml.template create mode 100644 bundled-docker/eip-erpnext-openmrs/Dockerfile create mode 100644 bundled-docker/eip-odoo-openmrs/Dockerfile create mode 100644 bundled-docker/eip-openmrs-senaite/Dockerfile create mode 100644 bundled-docker/erpnext/Dockerfile create mode 100644 bundled-docker/frontend/Dockerfile create mode 100755 bundled-docker/frontend/startup.sh create mode 100644 bundled-docker/mysql/Dockerfile create mode 100644 bundled-docker/odoo/Dockerfile create mode 100644 bundled-docker/openmrs/Dockerfile create mode 100644 bundled-docker/pom.xml create mode 100644 bundled-docker/postgresql/Dockerfile create mode 100644 bundled-docker/proxy/Dockerfile create mode 100644 bundled-docker/proxy/default.conf.template create mode 100644 bundled-docker/proxy/nginx.conf create mode 100644 bundled-docker/senaite/Dockerfile diff --git a/bundled-docker/assembly.xml b/bundled-docker/assembly.xml new file mode 100644 index 0000000..7491536 --- /dev/null +++ b/bundled-docker/assembly.xml @@ -0,0 +1,20 @@ + + + zip-dir + + zip + + false + + + .. + ${project.build.directory}/${project.artifactId}-${project.version} + + + \ No newline at end of file diff --git a/bundled-docker/docker-compose-bundled.yml.template b/bundled-docker/docker-compose-bundled.yml.template new file mode 100644 index 0000000..c0f7b4e --- /dev/null +++ b/bundled-docker/docker-compose-bundled.yml.template @@ -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: ~ + \ No newline at end of file diff --git a/bundled-docker/eip-erpnext-openmrs/Dockerfile b/bundled-docker/eip-erpnext-openmrs/Dockerfile new file mode 100644 index 0000000..28e18d3 --- /dev/null +++ b/bundled-docker/eip-erpnext-openmrs/Dockerfile @@ -0,0 +1,2 @@ +FROM mekomsolutions/eip-client +ADD binaries/eip-erpnext-openmrs /eip-client/routes \ No newline at end of file diff --git a/bundled-docker/eip-odoo-openmrs/Dockerfile b/bundled-docker/eip-odoo-openmrs/Dockerfile new file mode 100644 index 0000000..ea95462 --- /dev/null +++ b/bundled-docker/eip-odoo-openmrs/Dockerfile @@ -0,0 +1,2 @@ +FROM mekomsolutions/eip-client +ADD binaries/eip-odoo-openmrs /eip-client/routes \ No newline at end of file diff --git a/bundled-docker/eip-openmrs-senaite/Dockerfile b/bundled-docker/eip-openmrs-senaite/Dockerfile new file mode 100644 index 0000000..ecd6f0a --- /dev/null +++ b/bundled-docker/eip-openmrs-senaite/Dockerfile @@ -0,0 +1,2 @@ +FROM mekomsolutions/eip-client +ADD binaries/eip-openmrs-senaite /eip-client/routes \ No newline at end of file diff --git a/bundled-docker/erpnext/Dockerfile b/bundled-docker/erpnext/Dockerfile new file mode 100644 index 0000000..fe59135 --- /dev/null +++ b/bundled-docker/erpnext/Dockerfile @@ -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 diff --git a/bundled-docker/frontend/Dockerfile b/bundled-docker/frontend/Dockerfile new file mode 100644 index 0000000..42aaaa4 --- /dev/null +++ b/bundled-docker/frontend/Dockerfile @@ -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"] \ No newline at end of file diff --git a/bundled-docker/frontend/startup.sh b/bundled-docker/frontend/startup.sh new file mode 100755 index 0000000..f557fe2 --- /dev/null +++ b/bundled-docker/frontend/startup.sh @@ -0,0 +1,10 @@ +#!/bin/sh +set -e +# if [ -f "/usr/share/nginx/html/ozone/ozone-frontend-config.json" ]; then +# envsubst < "/usr/share/nginx/html/ozone/ozone-frontend-config.json" | sponge "/usr/share/nginx/html/ozone/ozone-frontend-config.json" +# fi +for f in /usr/share/nginx/html/ozone/*.json; do + echo "processing===> $f"; + envsubst < $f | sponge $f; +done +/usr/local/bin/startup.sh diff --git a/bundled-docker/mysql/Dockerfile b/bundled-docker/mysql/Dockerfile new file mode 100644 index 0000000..1368fee --- /dev/null +++ b/bundled-docker/mysql/Dockerfile @@ -0,0 +1,5 @@ +FROM mariadb:10.8 +ADD data/mysql/create_db.sh /docker-entrypoint-initdb.d/create_db.sh +ADD data/mysql/eip-odoo-openmrs /docker-entrypoint-initdb.d/db/eip-odoo-openmrs +ADD data/mysql/openmrs /docker-entrypoint-initdb.d/db/openmrs +ADD data/mysql/eip-openmrs-senaite /docker-entrypoint-initdb.d/db/eip-openmrs-senaite \ No newline at end of file diff --git a/bundled-docker/odoo/Dockerfile b/bundled-docker/odoo/Dockerfile new file mode 100644 index 0000000..99b99e1 --- /dev/null +++ b/bundled-docker/odoo/Dockerfile @@ -0,0 +1,4 @@ +FROM mekomsolutions/odoo +ADD binaries/odoo/addons /mnt/extra-addons +ADD configs/odoo/initializer_config /mnt/odoo_config +ADD configs/odoo/config/odoo.conf /etc/properties/odoo.conf \ No newline at end of file diff --git a/bundled-docker/openmrs/Dockerfile b/bundled-docker/openmrs/Dockerfile new file mode 100644 index 0000000..4a5357f --- /dev/null +++ b/bundled-docker/openmrs/Dockerfile @@ -0,0 +1,3 @@ +FROM openmrs/openmrs-reference-application-3-backend:nightly +ADD binaries/openmrs/modules /openmrs/distribution/openmrs_modules +ADD configs/openmrs/initializer_config /openmrs/distribution/openmrs_config \ No newline at end of file diff --git a/bundled-docker/pom.xml b/bundled-docker/pom.xml new file mode 100644 index 0000000..7871686 --- /dev/null +++ b/bundled-docker/pom.xml @@ -0,0 +1,108 @@ + + 4.0.0 + + com.ozonehis + bundled-docker + Bundled Docker + 1.0.0-SNAPSHOT + pom + + + Ozone HIS + https://www.ozone-his.com + + + + Mekom Solutions + https://www.mekomsolutions.com + + + + + UTF-8 + 1.0.0-SNAPSHOT + true + + + + + + + org.apache.maven.plugins + maven-assembly-plugin + 3.6.0 + + + Package as a Zip file + package + + single + + + false + + assembly.xml + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.2.0 + + + Copy local resources + generate-resources + + copy-resources + + + + ${project.build.directory}/${project.artifactId}-${project.version} + + + ${project.basedir}/ + + eip-erpnext-openmrs/** + eip-odoo-openmrs/** + eip-openmrs-senaite/** + erpnext/** + frontend/** + mysql/** + odoo/** + openmrs/** + postgresql/** + proxy/** + senaite/** + docker-compose-bundled.yml.template + + + + + + + + + + + + jitpack.io + https://jitpack.io + + + + + Mekom Solutions Nexus repo for releases + mks-nexus-public-releases + https://nexus.mekomsolutions.net/repository/maven-releases + + + Mekom Solutions Nexus repo for snapshots + mks-nexus-public-snapshots + https://nexus.mekomsolutions.net/repository/maven-snapshots + + + + \ No newline at end of file diff --git a/bundled-docker/postgresql/Dockerfile b/bundled-docker/postgresql/Dockerfile new file mode 100644 index 0000000..96e4c04 --- /dev/null +++ b/bundled-docker/postgresql/Dockerfile @@ -0,0 +1,3 @@ +FROM postgres:13 +ADD data/postgresql/create_db.sh /docker-entrypoint-initdb.d/create_db.sh +ADD data/postgresql/odoo /docker-entrypoint-initdb.d/db/odoo \ No newline at end of file diff --git a/bundled-docker/proxy/Dockerfile b/bundled-docker/proxy/Dockerfile new file mode 100644 index 0000000..710eeb4 --- /dev/null +++ b/bundled-docker/proxy/Dockerfile @@ -0,0 +1,6 @@ +FROM nginx:1.25-alpine + +ENV FRAME_ANCESTORS "" + +COPY bundled-docker/proxy/nginx.conf /etc/nginx/nginx.conf +COPY bundled-docker/proxy/default.conf.template /etc/nginx/templates/ \ No newline at end of file diff --git a/bundled-docker/proxy/default.conf.template b/bundled-docker/proxy/default.conf.template new file mode 100644 index 0000000..82d9ec4 --- /dev/null +++ b/bundled-docker/proxy/default.conf.template @@ -0,0 +1,153 @@ +map $request_uri $csp_header { + default "default-src 'self' 'unsafe-inline' 'unsafe-eval'; base-uri 'self'; font-src 'self'; img-src 'self' data:; frame-ancestors 'self' ${FRAME_ANCESTORS};"; + "~^/openmrs/(?:admin|dictionary|module|patientDashboard.form)/" "default-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; base-uri 'self'; font-src 'self'; frame-ancestors 'self';"; + "~^/openmrs/owa" "default-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; base-uri 'self'; font-src 'self' data:; img-src 'self' data:; frame-ancestors 'self';"; +} + +map $http_x_forwarded_proto $forwarded_proto { + "~.*" $http_x_forwarded_proto; + default $scheme; +} + +map $http_x_real_ip $forwarded_ip { + "~.*" $http_x_real_ip; + default $remote_addr; +} + +map $forwarded_proto $var_proxy_cookie_flags { + https "JSESSIONID secure samesite=strict"; + default "off"; +} + +upstream frontend { + # always assume the frontend will be available + server frontend max_fails=0; +} + +upstream backend { + server openmrs:8080 max_fails=0; +} + +server { + listen 80; + + add_header X-XSS-Protection "1; mode=block"; + add_header Content-Security-Policy $csp_header; + add_header X-Content-Type-Options nosniff; + + proxy_set_header HOST $host; + proxy_set_header X-Forwarded-Proto $forwarded_proto; + proxy_set_header X-Real-IP $forwarded_ip; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + # if serving this via HTTPS, the following is recommended + # proxy_cookie_flags $var_proxy_cookie_flags; + proxy_http_version 1.1; + + gzip on; + gzip_vary on; + # 1 KiB + gzip_min_length 1024; + gzip_proxied any; + gzip_http_version 1.0; + gzip_types font/eot + font/otf + font/ttf + image/svg+xml + text/css + text/javascript + text/plain + text/xml + application/atom+xml + application/geo+json + application/importmap+json + application/javascript + application/x-javascript + application/json + application/ld+json + application/fhir+json + application/fhir+xml + application/manifest+json + application/rdf+xml + application/rss+xml + application/xhtml+xml + application/xml; + + # all redirects are relative to the gateway + absolute_redirect off; + + location = /openmrs/spa { + return 301 /openmrs/spa/; + } + + location /openmrs/spa/ { + proxy_pass http://frontend/; + proxy_redirect http://$host/ /openmrs/spa/; + } + + location /openmrs { + proxy_pass http://backend; + } + + location = / { + return 301 /openmrs/spa/; + } +} + +server { + listen 8069; + server_name localhost; + + # Increase proxy buffer size + proxy_buffers 16 64k; + proxy_buffer_size 128k; + # Force timeouts if the backend dies + proxy_next_upstream error timeout invalid_header http_500 http_502 http_503; + # Enable data compression + gzip on; + gzip_min_length 1100; + gzip_buffers 4 32k; + gzip_types text/plain text/xml text/css text/less application/x-javascript application/xml application/json application/javascript; + gzip_vary on; + + # Proxy header and settings + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + + + # Cache static data + location ~* /web/static/ { + proxy_cache_valid 200 60m; + proxy_buffering on; + expires 864000; + set $odoo odoo:8069; + proxy_pass http://$odoo; + } + + location / { + + set $odoo odoo:8069; + proxy_pass http://$odoo; + # The following makes the timeout broader + proxy_read_timeout 30000; + proxy_redirect off; + } + + location /longpolling { + set $odoo odoo:8072; + proxy_pass http://$odoo; + } +} + +server { + listen 8081; + location / { + proxy_set_header Host $http_host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + set $senaite senaite:8080; + proxy_pass http://$senaite; + } +} diff --git a/bundled-docker/proxy/nginx.conf b/bundled-docker/proxy/nginx.conf new file mode 100644 index 0000000..aec9e79 --- /dev/null +++ b/bundled-docker/proxy/nginx.conf @@ -0,0 +1,31 @@ +user nobody; +worker_processes auto; + +error_log /var/log/nginx/error.log notice; +pid /var/run/nginx.pid; + + +events { + worker_connections 1024; +} + + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + + keepalive_timeout 65; + resolver 127.0.0.11; + + include /etc/nginx/conf.d/*.conf; +} \ No newline at end of file diff --git a/bundled-docker/senaite/Dockerfile b/bundled-docker/senaite/Dockerfile new file mode 100644 index 0000000..ba8f7e9 --- /dev/null +++ b/bundled-docker/senaite/Dockerfile @@ -0,0 +1,2 @@ +FROM mekomsolutions/senaite +ADD configs/senaite/initializer_config /data/importdata/senaite \ No newline at end of file diff --git a/pom.xml b/pom.xml index 7f091e1..4c9527f 100644 --- a/pom.xml +++ b/pom.xml @@ -26,6 +26,7 @@ demo + bundled-docker