From 52802f754bd1f2f7bcc6e5b34950aa0ba06de442 Mon Sep 17 00:00:00 2001 From: Elliot Matson Date: Fri, 29 Jul 2022 23:31:17 -0500 Subject: [PATCH] fix healthcheck --- .github/workflows/stack-healthcheck.yml | 2 +- pgadmin-config-creator/Dockerfile | 3 ++- pgadmin-config-creator/app.py | 7 ++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stack-healthcheck.yml b/.github/workflows/stack-healthcheck.yml index dfd393f..28091ca 100644 --- a/.github/workflows/stack-healthcheck.yml +++ b/.github/workflows/stack-healthcheck.yml @@ -12,7 +12,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Deploy the stack, timeout if not healthy after 2m - run: timeout 120 docker compose up --wait + run: timeout 120 docker compose up --quiet-pull --wait - name: Check creating database run: docker compose logs | grep "CREATE DATABASE" - name: Check database creation diff --git a/pgadmin-config-creator/Dockerfile b/pgadmin-config-creator/Dockerfile index 779a0e2..f328f4d 100644 --- a/pgadmin-config-creator/Dockerfile +++ b/pgadmin-config-creator/Dockerfile @@ -3,4 +3,5 @@ RUN mkdir /app RUN mkdir /config ADD . /app WORKDIR /app -CMD ["python", "app.py"] \ No newline at end of file +CMD ["python", "app.py"] +HEALTHCHECK CMD test -f /config/servers.json || exit 1 \ No newline at end of file diff --git a/pgadmin-config-creator/app.py b/pgadmin-config-creator/app.py index f3cc057..4fcf492 100644 --- a/pgadmin-config-creator/app.py +++ b/pgadmin-config-creator/app.py @@ -1,10 +1,15 @@ import json import os +import time with open('/config/servers.json', 'w') as f: print("created " + f.name) template_string = '{"Servers": {"1": {"Name": "DavinciResolve", "Group": "Servers", "Port": 5432, "Username": "postgres", "Host": "postgres", "SSLMode": "prefer", "MaintenanceDB": "postgres"}}}' data = json.loads(template_string) data["Servers"]["1"]["Username"]=os.getenv("POSTGRES_USER") + print("printing json to file...") print(data) - json.dump(data, f, indent=2) \ No newline at end of file + json.dump(data, f, indent=2) +# sleep until GHA Healthchecks are complete +time.sleep(125) +