Skip to content

Commit cd43cf1

Browse files
p-hoffmannmwaiyee
andauthored
Remove publication & fix health check (#213)
* Remove publication Signed-off-by: Peter Hoffmann <954078+p-hoffmann@users.noreply.github.com> * Update cli.sh Signed-off-by: Peter Hoffmann <954078+p-hoffmann@users.noreply.github.com> * Update docker-compose.yml Signed-off-by: Peter Hoffmann <954078+p-hoffmann@users.noreply.github.com> * Update docker-compose.yml Signed-off-by: Peter Hoffmann <954078+p-hoffmann@users.noreply.github.com> * update healthcheck for dataflow-gen and dataflow-gen-worker --------- Signed-off-by: Peter Hoffmann <954078+p-hoffmann@users.noreply.github.com> Co-authored-by: mwaiyee <waiyee.man@data4life-asia.care>
1 parent 6988895 commit cd43cf1

3 files changed

Lines changed: 16 additions & 20 deletions

File tree

docker-compose.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ services:
717717
command:
718718
- sh
719719
- -c
720-
- "apt-get update && apt-get install -y curl && prefect server start"
720+
- "prefect server start"
721721
container_name: &c2 ${PROJECT_NAME:-d2e}-dataflow-gen-1
722722
depends_on:
723723
alp-logto-post-init:
@@ -726,11 +726,12 @@ services:
726726
interval: 30s
727727
retries: 30
728728
start_period: 30s
729-
test:
730-
- CMD
731-
- curl
732-
- -f
733-
- http://localhost:41120/api/health
729+
test: [
730+
"CMD",
731+
"python",
732+
"-c",
733+
"import urllib.request, sys; sys.exit(0 if 200 <= urllib.request.urlopen('http://localhost:41120/api/health', timeout=5).getcode() < 300 else 1)"
734+
]
734735
timeout: 30s
735736
hostname: dataflow-gen-1
736737
image: prefecthq/prefect:3.0.3-python3.11
@@ -765,7 +766,7 @@ services:
765766
command:
766767
- sh
767768
- -c
768-
- "apt-get update && apt-get install -y curl && pip install prefect[docker]==3.0.3 && prefect work-pool create 'docker-pool' --type docker; prefect worker start --pool 'docker-pool' --type docker --name prefect-docker-worker"
769+
- "pip install prefect[docker]==3.0.3 && prefect work-pool create 'docker-pool' --type docker; prefect worker start --pool 'docker-pool' --type docker --name prefect-docker-worker --with-healthcheck"
769770
container_name: &c83 ${PROJECT_NAME:-d2e}-dataflow-gen-worker
770771
platform: linux/amd64
771772
depends_on:
@@ -779,11 +780,12 @@ services:
779780
interval: 30s
780781
retries: 30
781782
start_period: 30s
782-
test:
783-
- CMD
784-
- curl
785-
- -f
786-
- http://${PROJECT_NAME:-d2e}-dataflow-gen-1:41120/api/health
783+
test: [
784+
"CMD",
785+
"python",
786+
"-c",
787+
"import urllib.request, sys; sys.exit(0 if 200 <= urllib.request.urlopen('http://localhost:8080/health', timeout=5).getcode() < 300 else 1)"
788+
]
787789
timeout: 30s
788790
hostname: ${PROJECT_NAME:-d2e}-dataflow-gen-worker.${TLS__INTERNAL__DOMAIN:-alp.local}
789791
image: prefecthq/prefect:3.0.3-python3.11
@@ -801,6 +803,7 @@ services:
801803
D2E_MEMORY_LIMIT: ${D2E_MEMORY_LIMIT:-16G}
802804
D2E_SWAP_LIMIT: ${D2E_SWAP_LIMIT:-64G}
803805
DOCKER_REGISTRY_URL: ${DOCKER_REGISTRY_URL:-ghcr.io}
806+
PREFECT_WORKER_WEBSERVER_HOST: 0.0.0.0
804807

805808
# Needed only for future alterations of schema when version upgrades
806809
# alp-logto-db-post-alterations-init:

scripts/cli.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ case $cmd in
239239
source "$ENVFILE"
240240
npx d2e patchdemodb
241241
database_host=${PROJECT_NAME:-d2e}-demodb
242-
docker exec $database_host psql -h localhost -U postgres -d postgres -c "CREATE PUBLICATION demo_database_publication FOR TABLES IN SCHEMA demo_cdm; ALTER TABLE demo_cdm.COHORT REPLICA IDENTITY FULL; ALTER TABLE demo_cdm.COHORT_DEFINITION REPLICA IDENTITY FULL;"
243242
npx zx $node_modules_path/scripts/load-demodatabase.mjs -v $version -d $function_path -n "$ENVFILE" &&
244243
npx zx $node_modules_path/scripts/load-demodataset.mjs
245244
npx zx $node_modules_path/scripts/check-setupdemo-flow.mjs

scripts/load-demodatabase.mjs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,7 @@ var payload = JSON.stringify({
174174
"vocabSchemas": [
175175
DEMO__DB_CDM_SCHEMA
176176
],
177-
"authenticationMode": "Password",
178-
"publications" : [
179-
{
180-
"slot": "data2evidence",
181-
"publication": `${DEMO__DB_CODE}_publication`,
182-
}
183-
]
177+
"authenticationMode": "Password"
184178
})
185179
try {
186180
var resp = await $`(curl -ks -w "status_code:%{http_code}" --location --request POST 'https://${CADDY__ALP__PUBLIC_FQDN}/trex/db/' \

0 commit comments

Comments
 (0)