diff --git a/.env b/.env index 6fd79cd1..f974af57 100644 --- a/.env +++ b/.env @@ -1,12 +1,21 @@ -OL_REFERENCE_UI_VERSION=5.2.7-SNAPSHOT - -OL_REQUISITION_VERSION=8.3.7-SNAPSHOT -OL_REFERENCEDATA_VERSION=15.2.6-SNAPSHOT -OL_AUTH_VERSION=4.3.4-SNAPSHOT -OL_NOTIFICATION_VERSION=4.3.4-SNAPSHOT -OL_FULFILLMENT_VERSION=9.0.5-SNAPSHOT +OL_REFERENCE_UI_VERSION=1.4.1 +#OL_REQUISITION_VERSION=8.3.7-SNAPSHOT +OL_REQUISITION_VERSION=1.0.7 +OL_REFERENCEDATA_VERSION=1.0.1 +OL_AUTH_VERSION=0.0.1 +OL_NOTIFICATION_VERSION=1.0.7 +#OL_FULFILLMENT_VERSION=9.0.5-SNAPSHOT +OL_FULFILLMENT_VERSION=1.0.0 OL_CCE_VERSION=1.3.3-SNAPSHOT -OL_STOCKMANAGEMENT_VERSION=5.1.10-SNAPSHOT +OL_STOCKMANAGEMENT_VERSION=1.1.6 +#curr stock 1.1.4 +OL_PREPACKING_VERSION=1.0.9 +#OL_PREPACKING_VERSION=latest +OL_DISPENSING_VERSION=1.1.1 +#OL_STOCKMANAGEMENT_VERSION=latest +#OL_POINTOFDELIVERY_VERSION=1.0.1 +OL_POINTOFDELIVERY_VERSION=1.0.6 +OL_INVENTORYMANAGEMENT_VERSION=latest OL_REPORT_VERSION=1.2.3-SNAPSHOT OL_BUQ_VERSION=1.0.0-SNAPSHOT OL_HAPIFHIR_VERSION=2.0.3-SNAPSHOT @@ -16,7 +25,8 @@ OL_ONE_NETWORK_INTEGRATION_STOCKMANAGEMENT_EXTENSION_VERSION=0.0.1 OL_DIAGNOSTICS_VERSION=1.1.3-SNAPSHOT -OL_NGINX_VERSION=5 +#OL_NGINX_VERSION=5 +OL_NGINX_VERSION=1.0.0 OL_RSYSLOG_VERSION=1 -OL_POSTGRES_VERSION=12-debezium \ No newline at end of file +OL_POSTGRES_VERSION=12-debezium diff --git a/docker-compose.openlmis-dev.yml b/docker-compose.openlmis-dev.yml new file mode 100644 index 00000000..0eb40dad --- /dev/null +++ b/docker-compose.openlmis-dev.yml @@ -0,0 +1,260 @@ +version: "3.3" +services: + + consul: + command: -server -bootstrap + image: gliderlabs/consul-server + ports: + - "8300" + - "8400" + - "8500:8500" + - "53" + + nginx: + #image: openlmis/nginx:${OL_NGINX_VERSION} + image: elmislesotho/nginx:${OL_NGINX_VERSION} + ports: + - "${OL_HTTP_PORT:-80}:80" + env_file: settings.env + environment: + NGINX_LOG_DIR: '/var/log/nginx/log' + NGINX_TIMEOUT: '300s' + volumes: + - 'nginx-log:/var/log/nginx/log' + - 'consul-template-log:/var/log/consul-template' + depends_on: [consul] + + reference-ui: + image: elmislesotho/reference-ui:${OL_REFERENCE_UI_VERSION} + env_file: settings.env + depends_on: [consul] + + requisition: + image: elmislesotho/requisition:${OL_REQUISITION_VERSION} + env_file: settings.env + environment: + #JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + JAVA_OPTS: > + -server + -Xms1024m + -Xmx3072m + -XX:+UseG1GC + -XX:MetaspaceSize=128m + -XX:MaxMetaspaceSize=256m + -Xss512k + -XX:+PrintGCDetails + -XX:+PrintGCDateStamps + -Xloggc:/var/log/requisition/gc.log + -Dlogging.config=/config/log/logback.xml + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + referencedata: + image: elmislesotho/referencedata:${OL_REFERENCEDATA_VERSION} + env_file: settings.env + environment: + #JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + JAVA_OPTS: > + -server + -Xms1024m + -Xmx3072m + -XX:+UseG1GC + -XX:MetaspaceSize=128m + -XX:MaxMetaspaceSize=256m + -Xss512k + -XX:+PrintGCDetails + -XX:+PrintGCDateStamps + -Xloggc:/var/log/referencedata/gc.log + -Dlogging.config=/config/log/logback.xml + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + auth: + image: elmislesotho/auth:${OL_AUTH_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + notification: + image: elmislesotho/notification:${OL_NOTIFICATION_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + fulfillment: + image: elmislesotho/fulfillment:${OL_FULFILLMENT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + cce: + image: openlmis/cce:${OL_CCE_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + stockmanagement: + image: elmislesotho/stockmanagement:${OL_STOCKMANAGEMENT_VERSION} + env_file: settings.env + environment: + #JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + JAVA_OPTS: > + -server + -Xms1024m + -Xmx3072m + -XX:+UseG1GC + -XX:MetaspaceSize=128m + -XX:MaxMetaspaceSize=256m + -Xss512k + -XX:+PrintGCDetails + -XX:+PrintGCDateStamps + -Xloggc:/var/log/stockmanagement/gc.log + -Dlogging.config=/config/log/logback.xml + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + # prepacking: + # image: elmislesotho/prepacking:${OL_PREPACKING_VERSION} + # env_file: settings.env + # environment: + # JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + # volumes: + # - 'service-config:/config' + # depends_on: [log, db] + # command: ["/wait-for-postgres.sh", "/run.sh"] + + # dispensing: + # image: elmislesotho/dispensing:${OL_DISPENSING_VERSION} + # env_file: settings.env + # environment: + # JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + # volumes: + # - 'service-config:/config' + # depends_on: [log, db] + # command: ["/wait-for-postgres.sh", "/run.sh"] + + report: + image: openlmis/report:${OL_REPORT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + buq: + image: openlmis/buq:${OL_BUQ_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [ log, db ] + command: [ "/wait-for-postgres.sh", "/run.sh" ] + + hapifhir: + restart: always + image: openlmis/hapifhir:${OL_HAPIFHIR_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + spring_profiles_active: ${spring_profiles_active} + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + diagnostics: + image: openlmis/diagnostics:${OL_DIAGNOSTICS_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + spring_profiles_active: ${spring_profiles_active} + volumes: + - 'service-config:/config' + depends_on: [log] + + db: + image: openlmis/postgres:${OL_POSTGRES_VERSION} + env_file: settings.env + networks: + default: + aliases: + - olmis-db + depends_on: [consul] + + log: + image: openlmis/rsyslog:${OL_RSYSLOG_VERSION} + volumes: + - 'syslog:/var/log' + depends_on: + - service-configuration + - consul + + service-configuration: + build: + context: ./config + volumes: + - service-config:/config + + ftp: + image: hauptmedia/proftpd + ports: + - "${OL_FTP_PORT_21:-21}:21" + - "${OL_FTP_PORT_20:-20}:20" + env_file: settings.env + depends_on: [consul] + + redis: + image: redis:3.2.12 + depends_on: [consul] + + pointofdelivery: + image: elmislesotho/pointofdelivery:${OL_POINTOFDELIVERY_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'pointofdelivery-extensions:/extensions' + - 'service-config:/config' + depends_on: [log, db] + + # example-extensions: + # image: openlmis/openlmis-example-extensions:latest + # volumes: + # - 'example-extensions:/extensions' + +volumes: + syslog: + external: false + nginx-log: + external: false + consul-template-log: + external: false + service-config: + external: false + pointofdelivery-extensions: + external: false diff --git a/docker-compose.openlmis-dev.yml.beforeTuning_10July2024 b/docker-compose.openlmis-dev.yml.beforeTuning_10July2024 new file mode 100644 index 00000000..5b96f544 --- /dev/null +++ b/docker-compose.openlmis-dev.yml.beforeTuning_10July2024 @@ -0,0 +1,222 @@ +version: "3.3" +services: + + consul: + command: -server -bootstrap + image: gliderlabs/consul-server + ports: + - "8300" + - "8400" + - "8500:8500" + - "53" + + nginx: + image: openlmis/nginx:${OL_NGINX_VERSION} + ports: + - "${OL_HTTP_PORT:-80}:80" + env_file: settings.env + environment: + NGINX_LOG_DIR: '/var/log/nginx/log' + volumes: + - 'nginx-log:/var/log/nginx/log' + - 'consul-template-log:/var/log/consul-template' + depends_on: [consul] + + reference-ui: + image: elmislesotho/reference-ui:${OL_REFERENCE_UI_VERSION} + env_file: settings.env + depends_on: [consul] + + requisition: + image: elmislesotho/requisition:${OL_REQUISITION_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + referencedata: + image: openlmis/referencedata:${OL_REFERENCEDATA_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + auth: + image: openlmis/auth:${OL_AUTH_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + notification: + image: elmislesotho/notification:${OL_NOTIFICATION_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + fulfillment: + image: openlmis/fulfillment:${OL_FULFILLMENT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + cce: + image: openlmis/cce:${OL_CCE_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + stockmanagement: + image: elmislesotho/stockmanagement:${OL_STOCKMANAGEMENT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + prepacking: + image: elmislesotho/prepacking:${OL_PREPACKING_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + dispensing: + image: elmislesotho/dispensing:${OL_DISPENSING_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + report: + image: openlmis/report:${OL_REPORT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + buq: + image: openlmis/buq:${OL_BUQ_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [ log, db ] + command: [ "/wait-for-postgres.sh", "/run.sh" ] + + hapifhir: + restart: always + image: openlmis/hapifhir:${OL_HAPIFHIR_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + spring_profiles_active: ${spring_profiles_active} + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + diagnostics: + image: openlmis/diagnostics:${OL_DIAGNOSTICS_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + spring_profiles_active: ${spring_profiles_active} + volumes: + - 'service-config:/config' + depends_on: [log] + + db: + image: openlmis/postgres:${OL_POSTGRES_VERSION} + env_file: settings.env + networks: + default: + aliases: + - olmis-db + depends_on: [consul] + + log: + image: openlmis/rsyslog:${OL_RSYSLOG_VERSION} + volumes: + - 'syslog:/var/log' + depends_on: + - service-configuration + - consul + + service-configuration: + build: + context: ./config + volumes: + - service-config:/config + + ftp: + image: hauptmedia/proftpd + ports: + - "${OL_FTP_PORT_21:-21}:21" + - "${OL_FTP_PORT_20:-20}:20" + env_file: settings.env + depends_on: [consul] + + redis: + image: redis:3.2.12 + depends_on: [consul] + + pointofdelivery: + image: elmislesotho/pointofdelivery:${OL_POINTOFDELIVERY_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'pointofdelivery-extensions:/extensions' + - 'service-config:/config' + depends_on: [log, db] + + # example-extensions: + # image: openlmis/openlmis-example-extensions:latest + # volumes: + # - 'example-extensions:/extensions' + +volumes: + syslog: + external: false + nginx-log: + external: false + consul-template-log: + external: false + service-config: + external: false + pointofdelivery-extensions: + external: false diff --git a/docker-compose.openlmis-pointofdelivery-init.yml b/docker-compose.openlmis-pointofdelivery-init.yml new file mode 100644 index 00000000..7e65254f --- /dev/null +++ b/docker-compose.openlmis-pointofdelivery-init.yml @@ -0,0 +1,202 @@ +version: "3.3" +services: + + consul: + command: -server -bootstrap + image: gliderlabs/consul-server + ports: + - "8300" + - "8400" + - "8500:8500" + - "53" + + nginx: + image: openlmis/nginx:${OL_NGINX_VERSION} + ports: + - "${OL_HTTP_PORT:-80}:80" + env_file: settings.env + environment: + NGINX_LOG_DIR: '/var/log/nginx/log' + volumes: + - 'nginx-log:/var/log/nginx/log' + - 'consul-template-log:/var/log/consul-template' + depends_on: [consul] + + reference-ui: + image: elmislesotho/reference-ui:${OL_REFERENCE_UI_VERSION} + env_file: settings.env + depends_on: [consul] + + requisition: + image: openlmis/requisition:${OL_REQUISITION_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + referencedata: + image: openlmis/referencedata:${OL_REFERENCEDATA_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + auth: + image: openlmis/auth:${OL_AUTH_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + notification: + image: openlmis/notification:${OL_NOTIFICATION_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + fulfillment: + image: openlmis/fulfillment:${OL_FULFILLMENT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + cce: + image: openlmis/cce:${OL_CCE_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + stockmanagement: + image: elmislesotho/stockmanagement:${OL_STOCKMANAGEMENT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + report: + image: openlmis/report:${OL_REPORT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + buq: + image: openlmis/buq:${OL_BUQ_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [ log, db ] + command: [ "/wait-for-postgres.sh", "/run.sh" ] + + hapifhir: + restart: always + image: openlmis/hapifhir:${OL_HAPIFHIR_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + spring_profiles_active: ${spring_profiles_active} + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + diagnostics: + image: openlmis/diagnostics:${OL_DIAGNOSTICS_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + spring_profiles_active: ${spring_profiles_active} + volumes: + - 'service-config:/config' + depends_on: [log] + + db: + image: openlmis/postgres:${OL_POSTGRES_VERSION} + env_file: settings.env + networks: + default: + aliases: + - olmis-db + depends_on: [consul] + + log: + image: openlmis/rsyslog:${OL_RSYSLOG_VERSION} + volumes: + - 'syslog:/var/log' + depends_on: + - service-configuration + - consul + + service-configuration: + build: + context: ./config + volumes: + - service-config:/config + + ftp: + image: hauptmedia/proftpd + ports: + - "${OL_FTP_PORT_21:-21}:21" + - "${OL_FTP_PORT_20:-20}:20" + env_file: settings.env + depends_on: [consul] + + redis: + image: redis:3.2.12 + depends_on: [consul] + + pointofdelivery: + image: elmislesotho/pointofdelivery:${OL_POINTOFDELIVERY_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'pointofdelivery-extensions:/extensions' + - 'service-config:/config' + depends_on: [log, db] + + # example-extensions: + # image: openlmis/openlmis-example-extensions:latest + # volumes: + # - 'example-extensions:/extensions' + +volumes: + syslog: + external: false + nginx-log: + external: false + consul-template-log: + external: false + service-config: + external: false + pointofdelivery-extensions: + external: false diff --git a/docker-compose.openlmis-prod.yml b/docker-compose.openlmis-prod.yml new file mode 100644 index 00000000..2237d067 --- /dev/null +++ b/docker-compose.openlmis-prod.yml @@ -0,0 +1,205 @@ +version: "3.3" +services: + + consul: + command: -server -bootstrap + image: gliderlabs/consul-server + ports: + - "8300" + - "8400" + - "8500:8500" + - "53" + + nginx: + image: openlmis/nginx:${OL_NGINX_VERSION} + ports: + - "${OL_HTTP_PORT:-80}:80" + env_file: settings.env + environment: + NGINX_LOG_DIR: '/var/log/nginx/log' + volumes: + - 'nginx-log:/var/log/nginx/log' + - 'consul-template-log:/var/log/consul-template' + depends_on: [consul] + + reference-ui: + image: elmislesotho/reference-ui:${OL_REFERENCE_UI_VERSION} + env_file: settings.env + depends_on: [consul] + + requisition: + image: openlmis/requisition:${OL_REQUISITION_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log] + command: ["/wait-for-postgres.sh", "/run.sh"] + + referencedata: + image: openlmis/referencedata:${OL_REFERENCEDATA_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log] + command: ["/wait-for-postgres.sh", "/run.sh"] + + auth: + image: openlmis/auth:${OL_AUTH_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log] + command: ["/wait-for-postgres.sh", "/run.sh"] + + notification: + image: openlmis/notification:${OL_NOTIFICATION_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log] + command: ["/wait-for-postgres.sh", "/run.sh"] + + fulfillment: + image: openlmis/fulfillment:${OL_FULFILLMENT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log] + command: ["/wait-for-postgres.sh", "/run.sh"] + + cce: + image: openlmis/cce:${OL_CCE_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log] + command: ["/wait-for-postgres.sh", "/run.sh"] + + stockmanagement: + image: elmislesotho/stockmanagement:${OL_STOCKMANAGEMENT_VERSION} + #image: openlmis/stockmanagement:latest + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log] + command: ["/wait-for-postgres.sh", "/run.sh"] + + report: + image: openlmis/report:${OL_REPORT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log] + command: ["/wait-for-postgres.sh", "/run.sh"] + + buq: + image: openlmis/buq:${OL_BUQ_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [ log] + command: [ "/wait-for-postgres.sh", "/run.sh" ] + + hapifhir: + restart: always + image: openlmis/hapifhir:${OL_HAPIFHIR_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + spring_profiles_active: ${spring_profiles_active} + volumes: + - 'service-config:/config' + depends_on: [log] + command: ["/wait-for-postgres.sh", "/run.sh"] + + diagnostics: + image: openlmis/diagnostics:${OL_DIAGNOSTICS_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + spring_profiles_active: ${spring_profiles_active} + volumes: + - 'service-config:/config' + depends_on: [log] + + # db: + # image: openlmis/postgres:${OL_POSTGRES_VERSION} + # env_file: settings.env + # networks: + # default: + # aliases: + # - olmis-db + # depends_on: [consul] + + log: + image: openlmis/rsyslog:${OL_RSYSLOG_VERSION} + volumes: + - 'syslog:/var/log' + depends_on: + - service-configuration + - consul + + service-configuration: + build: + context: ./config + volumes: + - service-config:/config + + ftp: + image: hauptmedia/proftpd + ports: + - "${OL_FTP_PORT_21:-21}:21" + - "${OL_FTP_PORT_20:-20}:20" + env_file: settings.env + depends_on: [consul] + + redis: + image: redis:3.2.12 + depends_on: [consul] + + pointofdelivery: + #image: elmislesotho/pointofdelivery:${OL_POINTOFDELIVERY_VERSION} + image: elmislesotho/pointofdelivery:${OL_POINTOFDELIVERY_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'pointofdelivery-extensions:/extensions' + - 'service-config:/config' + depends_on: [log] + command: [ "/wait-for-postgres.sh", "/run.sh" ] + + # example-extensions: + # image: openlmis/openlmis-example-extensions:latest + # volumes: + # - 'example-extensions:/extensions' + +volumes: + syslog: + external: false + nginx-log: + external: false + consul-template-log: + external: false + service-config: + external: false + pointofdelivery-extensions: + external: false diff --git a/docker-compose.openlmis-ref-distro-example-service.yml b/docker-compose.openlmis-ref-distro-example-service.yml new file mode 100644 index 00000000..8df7e5cc --- /dev/null +++ b/docker-compose.openlmis-ref-distro-example-service.yml @@ -0,0 +1,202 @@ +version: "3.3" +services: + + consul: + command: -server -bootstrap + image: gliderlabs/consul-server + ports: + - "8300" + - "8400" + - "8500:8500" + - "53" + + nginx: + image: openlmis/nginx:${OL_NGINX_VERSION} + ports: + - "${OL_HTTP_PORT:-80}:80" + env_file: settings.env + environment: + NGINX_LOG_DIR: '/var/log/nginx/log' + volumes: + - 'nginx-log:/var/log/nginx/log' + - 'consul-template-log:/var/log/consul-template' + depends_on: [consul] + + reference-ui: + image: openlmis/reference-ui:${OL_REFERENCE_UI_VERSION} + env_file: settings.env + depends_on: [consul] + + requisition: + image: openlmis/requisition:${OL_REQUISITION_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + referencedata: + image: openlmis/referencedata:${OL_REFERENCEDATA_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + auth: + image: openlmis/auth:${OL_AUTH_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + notification: + image: openlmis/notification:${OL_NOTIFICATION_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + fulfillment: + image: openlmis/fulfillment:${OL_FULFILLMENT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + cce: + image: openlmis/cce:${OL_CCE_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + stockmanagement: + image: openlmis/stockmanagement:${OL_STOCKMANAGEMENT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + report: + image: openlmis/report:${OL_REPORT_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + buq: + image: openlmis/buq:${OL_BUQ_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx1024m -Dlogging.config=/config/log/logback.xml' + volumes: + - 'service-config:/config' + depends_on: [ log, db ] + command: [ "/wait-for-postgres.sh", "/run.sh" ] + + hapifhir: + restart: always + image: openlmis/hapifhir:${OL_HAPIFHIR_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + spring_profiles_active: ${spring_profiles_active} + volumes: + - 'service-config:/config' + depends_on: [log, db] + command: ["/wait-for-postgres.sh", "/run.sh"] + + diagnostics: + image: openlmis/diagnostics:${OL_DIAGNOSTICS_VERSION} + env_file: settings.env + environment: + JAVA_OPTS: '-server -Xmx512m -Dlogging.config=/config/log/logback.xml' + spring_profiles_active: ${spring_profiles_active} + volumes: + - 'service-config:/config' + depends_on: [log] + + db: + image: openlmis/postgres:${OL_POSTGRES_VERSION} + env_file: settings.env + networks: + default: + aliases: + - olmis-db + depends_on: [consul] + + log: + image: openlmis/rsyslog:${OL_RSYSLOG_VERSION} + volumes: + - 'syslog:/var/log' + depends_on: + - service-configuration + - consul + + service-configuration: + build: + context: ./config + volumes: + - service-config:/config + + ftp: + image: hauptmedia/proftpd + ports: + - "${OL_FTP_PORT_21:-21}:21" + - "${OL_FTP_PORT_20:-20}:20" + env_file: settings.env + depends_on: [consul] + + redis: + image: redis:3.2.12 + depends_on: [consul] + + # example: + # image: openlmis/template-service:latest + # env_file: settings.env + # environment: + # JAVA_OPTS: '-Dlogging.config=/logback.xml' + # volumes: + # - 'example-extensions:/extensions' + # - './logback.xml:/logback.xml' + # depends_on: [log] + + # example-extensions: + # image: openlmis/openlmis-example-extensions:latest + # volumes: + # - 'example-extensions:/extensions' + +volumes: + syslog: + external: false + nginx-log: + external: false + consul-template-log: + external: false + service-config: + external: false + example-extensions: + external: false diff --git a/docker-compose.openlmis-stockmanagement-validator-extension.yml b/docker-compose.openlmis-stockmanagement-validator-extension.yml index 246ed8de..5849e059 100644 --- a/docker-compose.openlmis-stockmanagement-validator-extension.yml +++ b/docker-compose.openlmis-stockmanagement-validator-extension.yml @@ -87,6 +87,16 @@ services: depends_on: [log, db] command: ["/wait-for-postgres.sh", "/run.sh"] + example: + image: openlmis/template-service:latest + env_file: .env + environment: + JAVA_OPTS: '-Dlogging.config=/logback.xml' + volumes: + - 'example-extensions:/extensions' + - './logback.xml:/logback.xml' + depends_on: [log, example-extensions] + example-extensions: image: openlmis/openlmis-example-extensions:0.0.1-SNAPSHOT volumes: diff --git a/reporting/README.md b/reporting/README.md index a63ac9a4..cec88356 100644 --- a/reporting/README.md +++ b/reporting/README.md @@ -13,8 +13,9 @@ $ cp settings-sample.env settings.env ``` * Edit `settings.env` to match your setup. Despite generating the passwords, you will likely need to change - `VIRTUAL_HOST`, `TRUSTED_HOSTNAME`, `OL_BASE_URL` (to point to OpenLMIS) and `NIFI_DOMAIN_NAME` and `SUPERSET_DOMAIN_NAME` (which should point to the reporting stack). + `VIRTUAL_HOST`,`TRUSTED_HOSTNAME`, `OL_BASE_URL` (to point to OpenLMIS), `NIFI_DOMAIN_NAME` and `SUPERSET_DOMAIN_NAME` (which should point to the reporting stack) and `SUPERSET_URL` to point to the Superset URL. Details on all the environment variables are below. + * NB: `SUPERSET_URL` in `settings.env` file in OpenLMIS should be updated to the superset URL. 5. Bring up the reporting stack by running [docker-compose](https://docs.docker.com/compose/) on the server: ```sh diff --git a/reporting/config/services/connect/sink-referencedata.json b/reporting/config/services/connect/sink-referencedata.json index 8c817cbd..8a547fbd 100644 --- a/reporting/config/services/connect/sink-referencedata.json +++ b/reporting/config/services/connect/sink-referencedata.json @@ -8,6 +8,7 @@ "connection.user": "postgres", "connection.password": "p@ssw0rd", "auto.create": "true", + "auto.evolve": "true", "insert.mode": "upsert", "pk.fields": "id", "pk.mode": "record_key", diff --git a/reporting/config/services/connect/sink-requisition.json b/reporting/config/services/connect/sink-requisition.json index 41a182cd..cc78bf1f 100644 --- a/reporting/config/services/connect/sink-requisition.json +++ b/reporting/config/services/connect/sink-requisition.json @@ -8,6 +8,7 @@ "connection.user": "postgres", "connection.password": "p@ssw0rd", "auto.create": "true", + "auto.evolve": "true", "insert.mode": "upsert", "pk.fields": "id", "pk.mode": "record_key", diff --git a/reporting/config/services/connect/sink-stockevents.json b/reporting/config/services/connect/sink-stockevents.json new file mode 100644 index 00000000..b2d0140f --- /dev/null +++ b/reporting/config/services/connect/sink-stockevents.json @@ -0,0 +1,18 @@ +{ + "name": "sink-stockevents", + "config": { + "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector", + "tasks.max": "1", + "topics": "public.kafka_stock_events,public.kafka_stock_event_line_items", + "connection.url": "jdbc:postgresql://reporting-db:5432/open_lmis_reporting?stringtype=unspecified", + "connection.user": "postgres", + "connection.password": "p@ssw0rd", + "auto.create": "true", + "auto.evolve": "true", + "insert.mode": "upsert", + "pk.fields": "id", + "pk.mode": "record_key", + "delete.enabled": "true" + } +} + \ No newline at end of file diff --git a/reporting/config/services/connect/source-stockevents.json b/reporting/config/services/connect/source-stockevents.json new file mode 100644 index 00000000..adcdb0be --- /dev/null +++ b/reporting/config/services/connect/source-stockevents.json @@ -0,0 +1,28 @@ +{ + "name": "source-stockevents", + "config": { + "connector.class": "io.debezium.connector.postgresql.PostgresConnector", + "tasks.max": "1", + "plugin.name": "wal2json", + "database.hostname": "olmis-db", + "database.port": "5432", + "database.user": "postgres", + "database.password": "p@ssw0rd", + "database.dbname": "open_lmis", + "database.server.name": "openlmis", + "table.whitelist": "stockmanagement\\.stock_events,stockmanagement\\.stock_event_line_items", + "database.history.kafka.bootstrap.servers": "kafka:29092", + "database.history.kafka.topic": "openlmis", + "slot.name": "dbz_stockevents", + "heartbeat.interval.ms": 3000, + "heartbeat.action.query": "CREATE TABLE IF NOT EXISTS debezium_heartbeat (id SERIAL PRIMARY KEY, ts TIMESTAMPTZ); INSERT INTO debezium_heartbeat (id, ts) VALUES (1, NOW()) ON CONFLICT(id) DO UPDATE SET ts=NOW();", + "transforms": "unwrap,route", + "transforms.unwrap.type": "io.debezium.transforms.ExtractNewRecordState", + "transforms.unwrap.drop.tombstones": "false", + "transforms.unwrap.delete.handling.mode": "none", + "transforms.route.type": "org.apache.kafka.connect.transforms.RegexRouter", + "transforms.route.regex": "([^.]+)\\.([^.]+)\\.([^.]+)", + "transforms.route.replacement": "public.kafka_$3" + } + } + \ No newline at end of file diff --git a/reporting/config/services/superset/datasources/database.yaml b/reporting/config/services/superset/datasources/database.yaml index 81101f1c..7175fb70 100644 --- a/reporting/config/services/superset/datasources/database.yaml +++ b/reporting/config/services/superset/datasources/database.yaml @@ -1039,3 +1039,13 @@ databases: - {expression: COUNT(*), metric_name: count, metric_type: count, verbose_name: COUNT(*)} schema: public table_name: kafka_commodity_types + - columns: + - {column_name: processeddate, is_dttm: true, type: TIMESTAMP WITH TIME ZONE} + - {column_name: facilityid, type: UUID} + - {column_name: id, type: UUID} + - {column_name: programid, type: UUID} + main_dttm_col: processeddate + metrics: + - {expression: COUNT(*), metric_name: count, metric_type: count, verbose_name: COUNT(*)} + schema: public + table_name: kafka_stock_events diff --git a/reporting/config/services/superset/superset_config.py b/reporting/config/services/superset/superset_config.py index da4bc78e..41573264 100644 --- a/reporting/config/services/superset/superset_config.py +++ b/reporting/config/services/superset/superset_config.py @@ -54,7 +54,7 @@ def lookup_password(url): ] # Set URL scheme for superset-patchup redirect URLs -PREFERRED_URL_SCHEME = "https" +PREFERRED_URL_SCHEME = "http" # The default user self registration role AUTH_USER_REGISTRATION_ROLE = "OLMIS_Gamma" diff --git a/reporting/docker-compose.local.yml b/reporting/docker-compose.local.yml index d152e921..93c4a4d8 100644 --- a/reporting/docker-compose.local.yml +++ b/reporting/docker-compose.local.yml @@ -112,7 +112,7 @@ services: - 8083:8083 networks: - default - - openlmis-ref-distro_default + - lesotho-ref-distro_default environment: - BOOTSTRAP_SERVERS=kafka:29092 - GROUP_ID=1 @@ -180,5 +180,5 @@ volumes: external: false networks: - openlmis-ref-distro_default: + lesotho-ref-distro_default: external: true diff --git a/reporting/settings-sample.env b/reporting/settings-sample.env index ffe4f6a3..c110c3b5 100644 --- a/reporting/settings-sample.env +++ b/reporting/settings-sample.env @@ -71,6 +71,8 @@ SUPERSET_SECRET_KEY=changeme # Disabling SSL check in Superset service. By default sign-in via OAUTH requires OpenLMIS with HTTPS security # Note: Comment out this variable if you use it on production # OAUTHLIB_INSECURE_TRANSPORT=1 +#Add URL to your superset +SUPERSET_URL= # The domain name to use for Superset SUPERSET_DOMAIN_NAME=superset.local diff --git a/reporting/superset/Dockerfile b/reporting/superset/Dockerfile index 5bfb7aba..238d49c0 100644 --- a/reporting/superset/Dockerfile +++ b/reporting/superset/Dockerfile @@ -25,6 +25,7 @@ ENV GUNICORN_BIND=0.0.0.0:8088 \ SUPERSET_HOME=/var/lib/superset \ APP_DIR=${APP_DIR} \ WORKER_CLASS=gevent + ENV GUNICORN_CMD_ARGS="--workers ${GUNICORN_WORKERS} -k ${WORKER_CLASS} --timeout ${GUNICORN_TIMEOUT} --bind ${GUNICORN_BIND} --limit-request-line ${GUNICORN_LIMIT_REQUEST_LINE} --limit-request-field_size ${GUNICORN_LIMIT_REQUEST_FIELD_SIZE}" COPY requirements.txt requirements.txt @@ -46,12 +47,14 @@ RUN useradd -U -m superset && \ postgresql-client \ libssl-dev \ libffi-dev \ - python-dev \ + python3-dev \ libsasl2-dev \ - libldap2-dev && \ + libldap2-dev \ + libjpeg-dev \ + libpng-dev && \ apt-get clean && \ rm -r /var/lib/apt/lists/* && \ - pip install --upgrade setuptools pip && \ + pip install --upgrade setuptools "pip<24.1" && \ pip install --no-cache-dir \ gunicorn==20.1.0 \ gevent==22.10.2 \ @@ -60,15 +63,18 @@ RUN useradd -U -m superset && \ apache-superset[cors]==${SUPERSET_VERSION} \ flask-mail==0.9.1 \ flask-oauth==0.12 \ - flask_oauthlib==0.9.5 && \ - # MarkupSafe, fix missing 'soft_unicode' from 'markupsafe' - # fix cryptography, flask, werkzeug to last known working versions + flask_oauthlib==0.9.5 \ + Flask-Migrate==3.1.0 \ + alembic==1.8.1 \ + redis==4.5.5 && \ + # Fix missing MarkupSafe 'soft_unicode' and ensure Flask compatibility pip install -I --no-cache-dir \ MarkupSafe==2.0.1 \ cryptography==38.0.2 \ flask==1.1.4 \ werkzeug==1.0.1 \ - psycopg2-binary==2.9.1 + psycopg2-binary==2.9.1 \ + pillow # Ensure PIL/Pillow is installed for screenshots # Configure Filesystem RUN find ${APP_DIR} \! -type l -print0 | xargs -0 chown superset:superset @@ -93,10 +99,10 @@ ENV PATH=$NVM_DIR/versions/node/$NODE_VERSION/bin:$PATH RUN node -v RUN npm -v -# Installing dependecies via npm +# Installing dependencies via npm RUN npm install -g po2json -# Fetching dependecies and first build +# Fetching dependencies and first build RUN wget -P /tmp https://github.com/apache/superset/archive/${SUPERSET_VERSION}.zip \ && unzip /tmp/${SUPERSET_VERSION}.zip -d /tmp \ && rsync -a \ @@ -111,4 +117,8 @@ RUN cd $APP_DIR/superset-frontend && npm ci # Deploy application EXPOSE 8088 HEALTHCHECK CMD ["curl", "-f", "http://localhost:8088/health"] + +# Use Redis for caching instead of the metadata database +ENV CACHE_CONFIG='{"CACHE_TYPE": "RedisCache", "CACHE_REDIS_URL": "redis://redis:6379/0"}' + CMD ["gunicorn", "superset:app"] diff --git a/reporting/superset/Dockerfile.original b/reporting/superset/Dockerfile.original new file mode 100644 index 00000000..56148dbb --- /dev/null +++ b/reporting/superset/Dockerfile.original @@ -0,0 +1,114 @@ +FROM python:3.8.13 + +# Superset version +ARG SUPERSET_VERSION=1.5.2 + +# Superset-patchup (Ketchup) version +ARG SUPERSET_PATCHUP_VERSION=v0.5.1 + +# Default Superset files dir +ARG APP_DIR=/usr/local/lib/python3.8/site-packages/superset + +# Configure environment +ENV GUNICORN_BIND=0.0.0.0:8088 \ + GUNICORN_LIMIT_REQUEST_FIELD_SIZE=0 \ + GUNICORN_LIMIT_REQUEST_LINE=0 \ + GUNICORN_TIMEOUT=60 \ + GUNICORN_WORKERS=2 \ + LANG=C.UTF-8 \ + LC_ALL=C.UTF-8 \ + PYTHONPATH=/etc/superset:/home/superset:$PYTHONPATH \ + SUPERSET_REPO=apache/superset \ + SUPERSET_VERSION=${SUPERSET_VERSION} \ + SUPERSET_PATCHUP_VERSION=${SUPERSET_PATCHUP_VERSION} \ + SUPERSET_PATCHUP_REPO=https://github.com/OpenLMIS/superset-patchup.git@${SUPERSET_PATCHUP_VERSION} \ + SUPERSET_HOME=/var/lib/superset \ + APP_DIR=${APP_DIR} \ + WORKER_CLASS=gevent +ENV GUNICORN_CMD_ARGS="--workers ${GUNICORN_WORKERS} -k ${WORKER_CLASS} --timeout ${GUNICORN_TIMEOUT} --bind ${GUNICORN_BIND} --limit-request-line ${GUNICORN_LIMIT_REQUEST_LINE} --limit-request-field_size ${GUNICORN_LIMIT_REQUEST_FIELD_SIZE}" + +COPY requirements.txt requirements.txt + +# Create superset user & install dependencies +RUN useradd -U -m superset && \ + mkdir /etc/superset && \ + mkdir ${SUPERSET_HOME} && \ + chown -R superset:superset /etc/superset && \ + chown -R superset:superset ${SUPERSET_HOME} && \ + apt-get update && \ + apt-get install -y \ + rsync \ + build-essential \ + curl \ + default-libmysqlclient-dev \ + freetds-bin \ + freetds-dev \ + postgresql-client \ + libssl-dev \ + libffi-dev \ + python-dev \ + libsasl2-dev \ + libldap2-dev && \ + apt-get clean && \ + rm -r /var/lib/apt/lists/* && \ + pip install --upgrade setuptools "pip<24.1" && \ + pip install --no-cache-dir \ + gunicorn==20.1.0 \ + gevent==22.10.2 \ + git+${SUPERSET_PATCHUP_REPO} \ + apache-superset==${SUPERSET_VERSION} \ + apache-superset[cors]==${SUPERSET_VERSION} \ + flask-mail==0.9.1 \ + flask-oauth==0.12 \ + flask_oauthlib==0.9.5 && \ + # MarkupSafe, fix missing 'soft_unicode' from 'markupsafe' + # fix cryptography, flask, werkzeug to last known working versions + pip install -I --no-cache-dir \ + MarkupSafe==2.0.1 \ + cryptography==38.0.2 \ + flask==1.1.4 \ + werkzeug==1.0.1 \ + psycopg2-binary==2.9.1 + +# Configure Filesystem +RUN find ${APP_DIR} \! -type l -print0 | xargs -0 chown superset:superset +COPY superset /usr/local/bin +VOLUME /etc/superset \ + /var/lib/superset +WORKDIR $APP_DIR + +# Node & npm +ENV NVM_DIR=/usr/local/nvm +ENV NODE_VERSION=v16.16.0 + +RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash +RUN . $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + +ENV NODE_PATH=$NVM_DIR/versions/node/$NODE_VERSION/lib/node_modules +ENV PATH=$NVM_DIR/versions/node/$NODE_VERSION/bin:$PATH + +RUN node -v +RUN npm -v + +# Installing dependecies via npm +RUN npm install -g po2json + +# Fetching dependecies and first build +RUN wget -P /tmp https://github.com/apache/superset/archive/${SUPERSET_VERSION}.zip \ + && unzip /tmp/${SUPERSET_VERSION}.zip -d /tmp \ + && rsync -a \ + --remove-source-files \ + --chown=superset:superset \ + /tmp/superset-${SUPERSET_VERSION}/superset-frontend $APP_DIR \ + && rm -r /tmp/${SUPERSET_VERSION}.zip + +USER superset:superset +RUN cd $APP_DIR/superset-frontend && npm ci + +# Deploy application +EXPOSE 8088 +HEALTHCHECK CMD ["curl", "-f", "http://localhost:8088/health"] +CMD ["gunicorn", "superset:app"] diff --git a/settings-sample.env b/settings-sample.env index d46fc85c..f5a174fe 100644 --- a/settings-sample.env +++ b/settings-sample.env @@ -2,14 +2,14 @@ # The base url of the OpenLMIS distribution. Will be used for communication between services. # In case of generated links pointing to the distribution, the PUBLIC_URL should be used instead. -BASE_URL=http://192.168.1.102 +BASE_URL=http://192.168.8.125 # The virtual host for the nginx server - nginx will make services available under this host. -VIRTUAL_HOST=192.168.1.102 +VIRTUAL_HOST=192.168.8.125 # The public url of the OpenLMIS distribution. Should be used in generated links pointing to the distribution. # If this variable is not set, the BASE_URL will be used for the generated links. -PUBLIC_URL=http://192.168.1.102 +PUBLIC_URL=http://192.168.8.125 ############################################################################################################ # Profile: use one of the desired deployment profiles below by uncommenting one (and only one) line below diff --git a/start-local.sh b/start-local.sh index 13678128..e8fc6d1d 100755 --- a/start-local.sh +++ b/start-local.sh @@ -49,7 +49,7 @@ setEnvByIp BOLD=$(tput bold) echo "Starting OpenLMIS Ref-Distro on ${BOLD}${HOST_ADDR}" docker-compose \ - -f docker-compose.yml \ + -f docker-compose.openlmis-prod.yml \ up \ --build \ --remove-orphans \