add redis healthcheck
This commit is contained in:
parent
e8edce6497
commit
6225e7b237
13
compose.yml
13
compose.yml
@ -120,6 +120,9 @@ services:
|
||||
- source: redis_entrypoint
|
||||
target: /custom-entrypoint.sh
|
||||
mode: 0555
|
||||
- source: redis_healthcheck
|
||||
target: /healthcheck.sh
|
||||
mode: 0555
|
||||
entrypoint: /custom-entrypoint.sh
|
||||
secrets:
|
||||
- redis_password
|
||||
@ -131,6 +134,11 @@ services:
|
||||
exec redis-server /etc/redis.conf
|
||||
volumes:
|
||||
- "redis:/data:rw"
|
||||
healthcheck:
|
||||
test: [ "CMD-SHELL", "/healthcheck.sh" ]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
networks:
|
||||
- internal
|
||||
|
||||
@ -172,10 +180,13 @@ configs:
|
||||
template_driver: golang
|
||||
rabbitmq_healthcheck:
|
||||
name: ${STACK_NAME}_rabbitmq_healthcheck_${RABBIT_HEALTHCHECK_VERSION}
|
||||
file: rabbitmq_healthcheck.sh
|
||||
file: healthcheck.rabbitmq.sh
|
||||
rabbitmq_entrypoint:
|
||||
name: ${STACK_NAME}_rabbitmq_entrypoint_${RABBIT_ENTRYPOINT_VERSION}
|
||||
file: entrypoint.rabbitmq.sh.tmpl
|
||||
redis_healthcheck:
|
||||
name: ${STACK_NAME}_redis_healthcheck_${REDIS_HEALTHCHECK_VERSION}
|
||||
file: healthcheck.redis.sh
|
||||
|
||||
volumes:
|
||||
zulip:
|
||||
|
10
healthcheck.redis.sh
Normal file
10
healthcheck.redis.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
set -eo pipefail
|
||||
|
||||
host="$(hostname -i || echo '127.0.0.1')"
|
||||
|
||||
if ping="$(redis-cli -h "$host" ping)" && [ "$ping" = 'PONG' ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exit 1
|
Loading…
x
Reference in New Issue
Block a user