Merge pull request #1203 from cimnine/valkey
Switch from Redis to Valkey and add Healthchecks
This commit is contained in:
commit
e4315245b0
@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
netbox: &netbox
|
netbox: &netbox
|
||||||
image: ${IMAGE-netboxcommunity/netbox:latest}
|
image: ${IMAGE-docker.io/netboxcommunity/netbox:latest}
|
||||||
depends_on:
|
depends_on:
|
||||||
postgres:
|
postgres:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@ -13,10 +13,10 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./test-configuration/test_config.py:/etc/netbox/config/test_config.py:z,ro
|
- ./test-configuration/test_config.py:/etc/netbox/config/test_config.py:z,ro
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
test: curl -f http://localhost:8080/login/ || exit 1
|
||||||
start_period: ${NETBOX_START_PERIOD-120s}
|
start_period: ${NETBOX_START_PERIOD-120s}
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
interval: 15s
|
interval: 15s
|
||||||
test: "curl -f http://localhost:8080/api/ || exit 1"
|
|
||||||
netbox-worker:
|
netbox-worker:
|
||||||
<<: *netbox
|
<<: *netbox
|
||||||
command:
|
command:
|
||||||
@ -24,42 +24,47 @@ services:
|
|||||||
- /opt/netbox/netbox/manage.py
|
- /opt/netbox/netbox/manage.py
|
||||||
- rqworker
|
- rqworker
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
test: ps -aux | grep -v grep | grep -q rqworker || exit 1
|
||||||
start_period: 40s
|
start_period: 40s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
interval: 15s
|
interval: 15s
|
||||||
test: "ps -aux | grep -v grep | grep -q rqworker || exit 1"
|
|
||||||
netbox-housekeeping:
|
netbox-housekeeping:
|
||||||
<<: *netbox
|
<<: *netbox
|
||||||
command:
|
command:
|
||||||
- /opt/netbox/housekeeping.sh
|
- /opt/netbox/housekeeping.sh
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
test: ps -aux | grep -v grep | grep -q housekeeping || exit 1
|
||||||
start_period: 40s
|
start_period: 40s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
interval: 15s
|
interval: 15s
|
||||||
test: "ps -aux | grep -v grep | grep -q housekeeping || exit 1"
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:16-alpine
|
image: docker.io/postgres:16-alpine
|
||||||
env_file: env/postgres.env
|
env_file: env/postgres.env
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: "pg_isready -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER" ## $$ because of docker-compose
|
test: pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER ## $$ because of docker-compose
|
||||||
interval: 10s
|
start_period: 20s
|
||||||
|
interval: 1s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|
||||||
redis: &redis
|
redis: &redis
|
||||||
image: redis:7-alpine
|
image: docker.io/valkey/valkey:7.2-alpine
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c # this is to evaluate the $REDIS_PASSWORD from the env
|
- -c # this is to evaluate the $REDIS_PASSWORD from the env
|
||||||
- redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
|
- valkey-server --save "" --appendonly no --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
|
||||||
env_file: env/redis.env
|
env_file: env/redis.env
|
||||||
healthcheck:
|
healthcheck:
|
||||||
start_period: 20s
|
test: "[ $$(valkey-cli --pass \"$${REDIS_PASSWORD}\" ping) = 'PONG' ]"
|
||||||
|
start_period: 5s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
interval: 15s
|
interval: 1s
|
||||||
test: "timeout 2 redis-cli ping"
|
retries: 5
|
||||||
redis-cache:
|
redis-cache:
|
||||||
<<: *redis
|
<<: *redis
|
||||||
env_file: env/redis-cache.env
|
env_file: env/redis-cache.env
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
netbox-media-files:
|
netbox-media-files:
|
||||||
driver: local
|
driver: local
|
||||||
|
@ -8,10 +8,10 @@ services:
|
|||||||
env_file: env/netbox.env
|
env_file: env/netbox.env
|
||||||
user: 'unit:root'
|
user: 'unit:root'
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
test: curl -f http://localhost:8080/login/ || exit 1
|
||||||
start_period: 90s
|
start_period: 90s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
interval: 15s
|
interval: 15s
|
||||||
test: "curl -f http://localhost:8080/login/ || exit 1"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./configuration:/etc/netbox/config:z,ro
|
- ./configuration:/etc/netbox/config:z,ro
|
||||||
- netbox-media-files:/opt/netbox/netbox/media:rw
|
- netbox-media-files:/opt/netbox/netbox/media:rw
|
||||||
@ -27,10 +27,10 @@ services:
|
|||||||
- /opt/netbox/netbox/manage.py
|
- /opt/netbox/netbox/manage.py
|
||||||
- rqworker
|
- rqworker
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
test: ps -aux | grep -v grep | grep -q rqworker || exit 1
|
||||||
start_period: 20s
|
start_period: 20s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
interval: 15s
|
interval: 15s
|
||||||
test: "ps -aux | grep -v grep | grep -q rqworker || exit 1"
|
|
||||||
netbox-housekeeping:
|
netbox-housekeeping:
|
||||||
<<: *netbox
|
<<: *netbox
|
||||||
depends_on:
|
depends_on:
|
||||||
@ -39,34 +39,47 @@ services:
|
|||||||
command:
|
command:
|
||||||
- /opt/netbox/housekeeping.sh
|
- /opt/netbox/housekeeping.sh
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
test: ps -aux | grep -v grep | grep -q housekeeping || exit 1
|
||||||
start_period: 20s
|
start_period: 20s
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
interval: 15s
|
interval: 15s
|
||||||
test: "ps -aux | grep -v grep | grep -q housekeeping || exit 1"
|
|
||||||
|
|
||||||
# postgres
|
# postgres
|
||||||
postgres:
|
postgres:
|
||||||
image: docker.io/postgres:16-alpine
|
image: docker.io/postgres:16-alpine
|
||||||
|
healthcheck:
|
||||||
|
test: pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER
|
||||||
|
start_period: 20s
|
||||||
|
timeout: 30s
|
||||||
|
interval: 10s
|
||||||
|
retries: 5
|
||||||
env_file: env/postgres.env
|
env_file: env/postgres.env
|
||||||
volumes:
|
volumes:
|
||||||
- netbox-postgres-data:/var/lib/postgresql/data
|
- netbox-postgres-data:/var/lib/postgresql/data
|
||||||
|
|
||||||
# redis
|
# redis
|
||||||
redis:
|
redis:
|
||||||
image: docker.io/redis:7-alpine
|
image: docker.io/valkey/valkey:7.2-alpine
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c # this is to evaluate the $REDIS_PASSWORD from the env
|
- -c # this is to evaluate the $REDIS_PASSWORD from the env
|
||||||
- redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
|
- valkey-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
|
||||||
|
healthcheck: &redis-healthcheck
|
||||||
|
test: "[ $$(valkey-cli --pass \"$${REDIS_PASSWORD}\" ping) = 'PONG' ]"
|
||||||
|
start_period: 5s
|
||||||
|
timeout: 3s
|
||||||
|
interval: 1s
|
||||||
|
retries: 5
|
||||||
env_file: env/redis.env
|
env_file: env/redis.env
|
||||||
volumes:
|
volumes:
|
||||||
- netbox-redis-data:/data
|
- netbox-redis-data:/data
|
||||||
redis-cache:
|
redis-cache:
|
||||||
image: docker.io/redis:7-alpine
|
image: docker.io/valkey/valkey:7.2-alpine
|
||||||
command:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c # this is to evaluate the $REDIS_PASSWORD from the env
|
- -c # this is to evaluate the $REDIS_PASSWORD from the env
|
||||||
- redis-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
|
- valkey-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
|
||||||
|
healthcheck: *redis-healthcheck
|
||||||
env_file: env/redis-cache.env
|
env_file: env/redis-cache.env
|
||||||
volumes:
|
volumes:
|
||||||
- netbox-redis-cache-data:/data
|
- netbox-redis-cache-data:/data
|
||||||
|
Loading…
Reference in New Issue
Block a user