Skip to content

Commit

Permalink
Merge pull request #249 from jembi/hotfix-hapi-fhir-tag-fixing
Browse files Browse the repository at this point in the history
Hotfix: hapi fhir tag fixing
  • Loading branch information
bradsawadye authored Sep 5, 2023
2 parents 8f6b5ca + 51da35e commit 2d2d10d
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 136 deletions.
2 changes: 2 additions & 0 deletions .env.cluster
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ OPENHIM_MONGO_ATNAURL=mongodb://mongo-1:27017,mongo-2:27017,mongo-3:27017/openhi

# FHIR Datastore - HAPI FHIR
HAPI_FHIR_INSTANCES=3
# (pool size * instances) should be less than 100
HF_MAX_POOL_SIZE=30
REPMGR_PARTNER_NODES=postgres-1,postgres-2,postgres-3
POSTGRES_REPLICA_SET=postgres-1:5432,postgres-2:5432,postgres-3:5432
HAPI_DB_SET=pgpool-1:5432,pgpool-2:5432,pgpool-3:5432
Expand Down
2 changes: 2 additions & 0 deletions .env.remote
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ ES_HOSTS="\"analytics-datastore-elastic-search-01:9200","analytics-datastore-ela
CLICKHOUSE_HOST=analytics-datastore-clickhouse-01

# FHIR Datastore - HAPI FHIR
HAPI_FHIR_INSTANCES=3
HF_MAX_POOL_SIZE=30
REPMGR_PARTNER_NODES=postgres-1,postgres-2,postgres-3
POSTGRES_REPLICA_SET=postgres-1:5432,postgres-2:5432,postgres-3:5432
HAPI_DB_SET=postgres-1:5432,postgres-2:5432,postgres-3:5432
Expand Down
2 changes: 1 addition & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
projectName: platform
image: jembi/platform:2.4.1
image: jembi/platform:2.4.2
logPath: /tmp/logs

packages:
Expand Down
7 changes: 1 addition & 6 deletions fhir-datastore-hapi-fhir/config/custom_pgpool.conf
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
failover_on_backend_error='on'
detach_false_primary='on'
auto_failback='on'
health_check_period=25
health_check_max_retries=3
health_check_user='postgres'
reserved_connections=1
max_pool=6
max_pool=5
client_idle_limit=300
connection_life_time=300
child_max_connections=25

use_watchdog='on'
hostname0='pgpool-1'
Expand Down
2 changes: 2 additions & 0 deletions fhir-datastore-hapi-fhir/config/custom_postgresql.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
max_connections = 250
shared_buffers = 768MB
126 changes: 126 additions & 0 deletions fhir-datastore-hapi-fhir/docker-compose-pgpool.cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
version: '3.9'

services:
pgpool-1:
image: bitnami/pgpool:4.4.3
deploy:
placement:
constraints:
- "node.labels.name==node-1"
replicas: 1
resources:
limits:
cpus: ${HF_PGPOOL_CPU_LIMIT}
memory: ${HF_PGPOOL_MEMORY_LIMIT}
reservations:
cpus: ${HF_PGPOOL_CPU_RESERVE}
memory: ${HF_PGPOOL_MEMORY_RESERVE}
configs:
- target: /config/custom_pgpool.conf
source: pgpool.conf
- target: /opt/bitnami/pgpool/conf/pgpool_node_id
source: pgpool_node_id0.conf
environment:
PGPOOL_BACKEND_NODES: ${HF_PGPOOL_NODES}
PGPOOL_BACKEND_APPLICATION_NAMES: ${REPMGR_PARTNER_NODES}
PGPOOL_SR_CHECK_USER: postgres
PGPOOL_SR_CHECK_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
PGPOOL_POSTGRES_USERNAME: postgres
PGPOOL_POSTGRES_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
PGPOOL_ADMIN_USERNAME: ${HF_PGPOOL_USERNAME}
PGPOOL_ADMIN_PASSWORD: ${HF_PGPOOL_PASSWORD}
PGPOOL_POSTGRES_CUSTOM_USERS: ${HF_POSTGRESQL_USERNAME}
PGPOOL_POSTGRES_CUSTOM_PASSWORDS: ${HF_POSTGRESQL_PASSWORD}
PGPOOL_ENABLE_LOAD_BALANCING: "no"
PGPOOL_AUTO_FAILBACK: "yes"
PGPOOL_USER_CONF_FILE: "/config/custom_pgpool.conf"

pgpool-2:
image: bitnami/pgpool:4.4.3
deploy:
placement:
constraints:
- "node.labels.name==node-2"
replicas: 1
resources:
limits:
cpus: ${HF_PGPOOL_CPU_LIMIT}
memory: ${HF_PGPOOL_MEMORY_LIMIT}
reservations:
cpus: ${HF_PGPOOL_CPU_RESERVE}
memory: ${HF_PGPOOL_MEMORY_RESERVE}
configs:
- target: /config/custom_pgpool.conf
source: pgpool.conf
- target: /opt/bitnami/pgpool/conf/pgpool_node_id
source: pgpool_node_id1.conf
environment:
PGPOOL_BACKEND_NODES: ${HF_PGPOOL_NODES}
PGPOOL_BACKEND_APPLICATION_NAMES: ${REPMGR_PARTNER_NODES}
PGPOOL_SR_CHECK_USER: postgres
PGPOOL_SR_CHECK_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
PGPOOL_POSTGRES_USERNAME: postgres
PGPOOL_POSTGRES_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
PGPOOL_ADMIN_USERNAME: ${HF_PGPOOL_USERNAME}
PGPOOL_ADMIN_PASSWORD: ${HF_PGPOOL_PASSWORD}
PGPOOL_POSTGRES_CUSTOM_USERS: ${HF_POSTGRESQL_USERNAME}
PGPOOL_POSTGRES_CUSTOM_PASSWORDS: ${HF_POSTGRESQL_PASSWORD}
PGPOOL_ENABLE_LOAD_BALANCING: "no"
PGPOOL_AUTO_FAILBACK: "yes"
PGPOOL_USER_CONF_FILE: "/config/custom_pgpool.conf"

pgpool-3:
image: bitnami/pgpool:4.4.3
deploy:
placement:
constraints:
- "node.labels.name==node-3"
replicas: 1
resources:
limits:
cpus: ${HF_PGPOOL_CPU_LIMIT}
memory: ${HF_PGPOOL_MEMORY_LIMIT}
reservations:
cpus: ${HF_PGPOOL_CPU_RESERVE}
memory: ${HF_PGPOOL_MEMORY_RESERVE}
configs:
- target: /config/custom_pgpool.conf
source: pgpool.conf
- target: /opt/bitnami/pgpool/conf/pgpool_node_id
source: pgpool_node_id2.conf
environment:
PGPOOL_BACKEND_NODES: ${HF_PGPOOL_NODES}
PGPOOL_BACKEND_APPLICATION_NAMES: ${REPMGR_PARTNER_NODES}
PGPOOL_SR_CHECK_USER: postgres
PGPOOL_SR_CHECK_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
PGPOOL_POSTGRES_USERNAME: postgres
PGPOOL_POSTGRES_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
PGPOOL_ADMIN_USERNAME: ${HF_PGPOOL_USERNAME}
PGPOOL_ADMIN_PASSWORD: ${HF_PGPOOL_PASSWORD}
PGPOOL_POSTGRES_CUSTOM_USERS: ${HF_POSTGRESQL_USERNAME}
PGPOOL_POSTGRES_CUSTOM_PASSWORDS: ${HF_POSTGRESQL_PASSWORD}
PGPOOL_ENABLE_LOAD_BALANCING: "no"
PGPOOL_AUTO_FAILBACK: "yes"
PGPOOL_USER_CONF_FILE: "/config/custom_pgpool.conf"

configs:
pgpool.conf:
name: pgpool_conf-${pgpool_conf_DIGEST:?err}
file: ./config/custom_pgpool.conf
labels:
name: hapi-fhir
pgpool_node_id0.conf:
name: pgpool_node_id0-${pgpool_node_id0_DIGEST:?err}
file: ./config/pgpool_node_id0
labels:
name: hapi-fhir
pgpool_node_id1.conf:
name: pgpool_node_id1-${pgpool_node_id1_DIGEST:?err}
file: ./config/pgpool_node_id1
labels:
name: hapi-fhir
pgpool_node_id2.conf:
name: pgpool_node_id2-${pgpool_node_id2_DIGEST:?err}
file: ./config/pgpool_node_id2
labels:
name: hapi-fhir
134 changes: 10 additions & 124 deletions fhir-datastore-hapi-fhir/docker-compose-postgres.cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ services:
REPMGR_PRIMARY_HOST: ${REPMGR_PRIMARY_HOST}
REPMGR_PARTNER_NODES: ${REPMGR_PARTNER_NODES}
POSTGRESQL_POSTGRES_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
REPMGR_FAILOVER: ${HF_POSTGRES_FAILOVER}
REPMGR_DEGRADED_MONITORING_TIMEOUT: ${HF_POSTGRES_DEGRADED_MONITORING_TIMEOUT}
volumes:
- 'hapi-postgres-2-data:/bitnami/postgresql'
configs:
- target: /bitnami/postgresql/conf/conf.d/custom_postgresql.conf
source: postgresql.conf
deploy:
placement:
constraints:
Expand Down Expand Up @@ -53,8 +58,13 @@ services:
REPMGR_PRIMARY_HOST: ${REPMGR_PRIMARY_HOST}
REPMGR_PARTNER_NODES: ${REPMGR_PARTNER_NODES}
POSTGRESQL_POSTGRES_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
REPMGR_FAILOVER: ${HF_POSTGRES_FAILOVER}
REPMGR_DEGRADED_MONITORING_TIMEOUT: ${HF_POSTGRES_DEGRADED_MONITORING_TIMEOUT}
volumes:
- 'hapi-postgres-3-data:/bitnami/postgresql'
configs:
- target: /bitnami/postgresql/conf/conf.d/custom_postgresql.conf
source: postgresql.conf
deploy:
placement:
constraints:
Expand All @@ -71,130 +81,6 @@ services:
default:
pg_backup_net:

pgpool-1:
image: bitnami/pgpool:4.4.3
deploy:
placement:
max_replicas_per_node: 1
resources:
limits:
cpus: ${HF_PGPOOL_CPU_LIMIT}
memory: ${HF_PGPOOL_MEMORY_LIMIT}
reservations:
cpus: ${HF_PGPOOL_CPU_RESERVE}
memory: ${HF_PGPOOL_MEMORY_RESERVE}
configs:
- target: /config/custom_pgpool.conf
source: pgpool.conf
- target: /opt/bitnami/pgpool/conf/pgpool_node_id
source: pgpool_node_id0.conf
environment:
PGPOOL_BACKEND_NODES: ${HF_PGPOOL_NODES}
PGPOOL_BACKEND_APPLICATION_NAMES: ${REPMGR_PARTNER_NODES}
PGPOOL_SR_CHECK_USER: postgres
PGPOOL_SR_CHECK_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
PGPOOL_POSTGRES_USERNAME: postgres
PGPOOL_POSTGRES_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
PGPOOL_ADMIN_USERNAME: ${HF_PGPOOL_USERNAME}
PGPOOL_ADMIN_PASSWORD: ${HF_PGPOOL_PASSWORD}
PGPOOL_POSTGRES_CUSTOM_USERS: ${HF_POSTGRESQL_USERNAME}
PGPOOL_POSTGRES_CUSTOM_PASSWORDS: ${HF_POSTGRESQL_PASSWORD}
PGPOOL_ENABLE_LOAD_BALANCING: "no"
PGPOOL_AUTO_FAILBACK: "yes"
PGPOOL_USER_CONF_FILE: "/config/custom_pgpool.conf"
networks:
default:

pgpool-2:
image: bitnami/pgpool:4.4.3
deploy:
placement:
max_replicas_per_node: 1
resources:
limits:
cpus: ${HF_PGPOOL_CPU_LIMIT}
memory: ${HF_PGPOOL_MEMORY_LIMIT}
reservations:
cpus: ${HF_PGPOOL_CPU_RESERVE}
memory: ${HF_PGPOOL_MEMORY_RESERVE}
configs:
- target: /config/custom_pgpool.conf
source: pgpool.conf
- target: /opt/bitnami/pgpool/conf/pgpool_node_id
source: pgpool_node_id1.conf
environment:
PGPOOL_BACKEND_NODES: ${HF_PGPOOL_NODES}
PGPOOL_BACKEND_APPLICATION_NAMES: ${REPMGR_PARTNER_NODES}
PGPOOL_SR_CHECK_USER: postgres
PGPOOL_SR_CHECK_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
PGPOOL_POSTGRES_USERNAME: postgres
PGPOOL_POSTGRES_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
PGPOOL_ADMIN_USERNAME: ${HF_PGPOOL_USERNAME}
PGPOOL_ADMIN_PASSWORD: ${HF_PGPOOL_PASSWORD}
PGPOOL_POSTGRES_CUSTOM_USERS: ${HF_POSTGRESQL_USERNAME}
PGPOOL_POSTGRES_CUSTOM_PASSWORDS: ${HF_POSTGRESQL_PASSWORD}
PGPOOL_ENABLE_LOAD_BALANCING: "no"
PGPOOL_AUTO_FAILBACK: "yes"
PGPOOL_USER_CONF_FILE: "/config/custom_pgpool.conf"
networks:
default:

pgpool-3:
image: bitnami/pgpool:4.4.3
deploy:
placement:
max_replicas_per_node: 1
resources:
limits:
cpus: ${HF_PGPOOL_CPU_LIMIT}
memory: ${HF_PGPOOL_MEMORY_LIMIT}
reservations:
cpus: ${HF_PGPOOL_CPU_RESERVE}
memory: ${HF_PGPOOL_MEMORY_RESERVE}
configs:
- target: /config/custom_pgpool.conf
source: pgpool.conf
- target: /opt/bitnami/pgpool/conf/pgpool_node_id
source: pgpool_node_id2.conf
environment:
PGPOOL_BACKEND_NODES: ${HF_PGPOOL_NODES}
PGPOOL_BACKEND_APPLICATION_NAMES: ${REPMGR_PARTNER_NODES}
PGPOOL_SR_CHECK_USER: postgres
PGPOOL_SR_CHECK_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
PGPOOL_POSTGRES_USERNAME: postgres
PGPOOL_POSTGRES_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
PGPOOL_ADMIN_USERNAME: ${HF_PGPOOL_USERNAME}
PGPOOL_ADMIN_PASSWORD: ${HF_PGPOOL_PASSWORD}
PGPOOL_POSTGRES_CUSTOM_USERS: ${HF_POSTGRESQL_USERNAME}
PGPOOL_POSTGRES_CUSTOM_PASSWORDS: ${HF_POSTGRESQL_PASSWORD}
PGPOOL_ENABLE_LOAD_BALANCING: "no"
PGPOOL_AUTO_FAILBACK: "yes"
PGPOOL_USER_CONF_FILE: "/config/custom_pgpool.conf"
networks:
default:

configs:
pgpool.conf:
name: pgpool_conf-${pgpool_conf_DIGEST:?err}
file: ./config/custom_pgpool.conf
labels:
name: hapi-fhir
pgpool_node_id0.conf:
name: pgpool_node_id0-${pgpool_node_id0_DIGEST:?err}
file: ./config/pgpool_node_id0
labels:
name: hapi-fhir
pgpool_node_id1.conf:
name: pgpool_node_id1-${pgpool_node_id1_DIGEST:?err}
file: ./config/pgpool_node_id1
labels:
name: hapi-fhir
pgpool_node_id2.conf:
name: pgpool_node_id2-${pgpool_node_id2_DIGEST:?err}
file: ./config/pgpool_node_id2
labels:
name: hapi-fhir

volumes:
hapi-postgres-2-data:
hapi-postgres-3-data:
12 changes: 12 additions & 0 deletions fhir-datastore-hapi-fhir/docker-compose-postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ services:
REPMGR_PRIMARY_HOST: ${REPMGR_PRIMARY_HOST}
REPMGR_PARTNER_NODES: ${REPMGR_PARTNER_NODES}
POSTGRESQL_POSTGRES_PASSWORD: ${HAPI_POSTGRES_PASSWORD}
REPMGR_FAILOVER: ${HF_POSTGRES_FAILOVER}
REPMGR_DEGRADED_MONITORING_TIMEOUT: ${HF_POSTGRES_DEGRADED_MONITORING_TIMEOUT}
volumes:
- "hapi-postgres-1-data:/bitnami/postgresql"
configs:
- target: /bitnami/postgresql/conf/conf.d/custom_postgresql.conf
source: postgresql.conf
deploy:
replicas: 1
resources:
Expand All @@ -33,6 +38,13 @@ services:
volumes:
hapi-postgres-1-data:

configs:
postgresql.conf:
name: postgresql_conf-${postgresql_conf_DIGEST:?err}
file: ./config/custom_postgresql.conf
labels:
name: hapi-fhir

networks:
default:
hapi-fhir-postgres:
Expand Down
8 changes: 4 additions & 4 deletions fhir-datastore-hapi-fhir/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.9'

services:
hapi-fhir:
image: jembi/hapi:v6.0.1-wget
image: jembi/hapi:${HF_IMAGE_TAG}
networks:
mpi:
public:
Expand All @@ -13,7 +13,7 @@ services:
- spring.datasource.password=${HF_POSTGRESQL_PASSWORD}
- spring.datasource.driverClassName=org.postgresql.Driver
- spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect
- spring.datasource.hikari.maximumPoolSize=250
- spring.datasource.hikari.maximumPoolSize=${HF_MAX_POOL_SIZE}
- spring.datasource.hikari.minimumIdle=20
- spring.datasource.hikari.connectionTimeout=60000
- spring.datasource.hikari.idleTimeout=600000
Expand All @@ -36,8 +36,8 @@ services:
healthcheck:
test: /bin/wget --no-verbose --tries=1 --spider http://localhost:8080/fhir/Organization?identifier=urn:healthcheck
interval: 30s
timeout: 30s
retries: 2
timeout: 5s
retries: 5
start_period: 2m

networks:
Expand Down
7 changes: 6 additions & 1 deletion fhir-datastore-hapi-fhir/package-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
"HF_PGPOOL_MEMORY_LIMIT": "500M",
"HF_PGPOOL_CPU_RESERVE": "0.05",
"HF_PGPOOL_MEMORY_RESERVE": "50M",
"HF_JAVA_OPTS": "-Xmx2g"
"HF_JAVA_OPTS": "-Xmx2g",
"HF_IMAGE_TAG": "v6.0.1-wget",
"HF_MAX_POOL_SIZE": "80",
"HF_PGPOOL_ENABLED": "true",
"HF_POSTGRES_FAILOVER": "automatic",
"HF_POSTGRES_DEGRADED_MONITORING_TIMEOUT": "5"
}
}
Loading

0 comments on commit 2d2d10d

Please sign in to comment.