Exact meaning of HEALTHCHECK_PORT #84
Replies: 3 comments
-
no need to keep questions open that are not going being be answered |
Beta Was this translation helpful? Give feedback.
-
Healthcheck is using the go-cron application healthcheck port. |
Beta Was this translation helpful? Give feedback.
-
Behind the port runs a webserver that outputs a report in json format. A healthy report looks like {
"Running": {},
"Last": {
"Exit_status": 0,
"Stdout": "",
"Stderr": "",
"ExitTime": "",
"Pid": 0,
"StartingTime": ""
},
"Schedule": "* * * * *"
} An unhealthy report can look like {
"Running": {},
"Last": {
"Exit_status": 1,
"Stdout": "You need to set the POSTGRES_DB or POSTGRES_DB_FILE environment variable.\n",
"Stderr": "",
"ExitTime": "2023-11-02T12:27:00Z",
"Pid": 42,
"StartingTime": "2023-11-02T12:27:00Z"
},
"Schedule": "* * * * *"
} I came up with a very ugly but working docker-compose healtcheck :) services:
your_service:
image: prodrigestivill/postgres-backup-local
ports:
- "8083:8083"
environment:
- HEALTHCHECK_PORT=8080
- SCHEDULE=* * * * *
healthcheck:
test: ["CMD-SHELL", "curl -s http://localhost:8080 && exit $(curl -s http://localhost:8080 | grep -o '\"Exit_status\": [0-9]*' | awk -F: '{print $2}' | tr -d ' ')"]
interval: 10s
timeout: 5s
retries: 3 I am pretty sure somebody can come up with a more elegant healthcheck :) but this works for now. |
Beta Was this translation helpful? Give feedback.
-
Before anything else, thank you for providing this awesome docker image!
Currently writing a help chart for this (which i will share) and asking myself, what the exact meaning of HEALTHCHECK_PORT will be.
I currently assume it will fail if backups fail, but maybe it's more a liveness probe? Could you explain under which circumumstanes it will be non 2xx?
Thank you a lot
Beta Was this translation helpful? Give feedback.
All reactions