fix healthcheck

This commit is contained in:
Elliot Matson 2022-07-29 23:31:17 -05:00
parent e61a1e5345
commit 52802f754b
3 changed files with 9 additions and 3 deletions

View File

@ -12,7 +12,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Deploy the stack, timeout if not healthy after 2m - 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 - name: Check creating database
run: docker compose logs | grep "CREATE DATABASE" run: docker compose logs | grep "CREATE DATABASE"
- name: Check database creation - name: Check database creation

View File

@ -3,4 +3,5 @@ RUN mkdir /app
RUN mkdir /config RUN mkdir /config
ADD . /app ADD . /app
WORKDIR /app WORKDIR /app
CMD ["python", "app.py"] CMD ["python", "app.py"]
HEALTHCHECK CMD test -f /config/servers.json || exit 1

View File

@ -1,10 +1,15 @@
import json import json
import os import os
import time
with open('/config/servers.json', 'w') as f: with open('/config/servers.json', 'w') as f:
print("created " + f.name) print("created " + f.name)
template_string = '{"Servers": {"1": {"Name": "DavinciResolve", "Group": "Servers", "Port": 5432, "Username": "postgres", "Host": "postgres", "SSLMode": "prefer", "MaintenanceDB": "postgres"}}}' template_string = '{"Servers": {"1": {"Name": "DavinciResolve", "Group": "Servers", "Port": 5432, "Username": "postgres", "Host": "postgres", "SSLMode": "prefer", "MaintenanceDB": "postgres"}}}'
data = json.loads(template_string) data = json.loads(template_string)
data["Servers"]["1"]["Username"]=os.getenv("POSTGRES_USER") data["Servers"]["1"]["Username"]=os.getenv("POSTGRES_USER")
print("printing json to file...")
print(data) print(data)
json.dump(data, f, indent=2) json.dump(data, f, indent=2)
# sleep until GHA Healthchecks are complete
time.sleep(125)