temporal
temporal copied to clipboard
Feature: implement docker healthcheck
Is your feature request related to a problem? Please describe. Currently docker will assume the container is ready once it is running, while the temporal engine is still warming up, leading to all sorts of problems.
Describe the solution you'd like Implement the HEALTHCHECK directive in your Dockerfile(s).
Describe alternatives you've considered Restarting clients.
Additional context
As a work around, until the HEALTHCHECK is added to the docker image, I was able to implement a healthcheck in the docker-compose file as follow:
healthcheck:
test: [ "CMD", "tctl","cluster","h" ]
interval: 10s
timeout: 1m
retries: 10
This is the docker-compose health-check that worked for me:
healthcheck:
test:
[
"CMD",
"tctl",
"--address",
"temporal:7233",
"workflow",
"list"
]
interval: 1s
timeout: 5s
retries: 30
My temporal service didn't listen on 127.0.0.1, so I added an --address. I used workflow list instead of cluster h as the latter doesn't seem to wait for the default namespace to be created causing a race condition for the error "namespace:default not found".
In addition, if you didn't want to set the container name, you can force temporal listening on any interface, eg:
services:
temporal:
image: temporalio/auto-setup:1.19
ports: ['7233:7233/tcp']
environment: # https://github.com/temporalio/docker-builds/blob/main/docker/auto-setup.sh
# ...
BIND_ON_IP: 0.0.0.0
TEMPORAL_BROADCAST_ADDRESS: 127.0.0.1
healthcheck:
test: ['CMD-SHELL', 'tctl --address 127.0.0.1:7233 workflow list']
interval: 1s
timeout: 5s
start_period: 2s