Update test to valkey as well

This commit is contained in:
Christian Mäder 2024-04-19 21:14:21 +02:00
parent 5e492c63c6
commit 6a3ba4409e
2 changed files with 28 additions and 26 deletions

View File

@ -1,6 +1,6 @@
services:
netbox: &netbox
image: ${IMAGE-netboxcommunity/netbox:latest}
image: ${IMAGE-docker.io/netboxcommunity/netbox:latest}
depends_on:
postgres:
condition: service_healthy
@ -13,10 +13,10 @@ services:
volumes:
- ./test-configuration/test_config.py:/etc/netbox/config/test_config.py:z,ro
healthcheck:
test: curl -f http://localhost:8080/api/ || exit 1
start_period: ${NETBOX_START_PERIOD-120s}
timeout: 3s
interval: 15s
test: "curl -f http://localhost:8080/api/ || exit 1"
netbox-worker:
<<: *netbox
command:
@ -24,42 +24,47 @@ services:
- /opt/netbox/netbox/manage.py
- rqworker
healthcheck:
test: ps -aux | grep -v grep | grep -q rqworker || exit 1
start_period: 40s
timeout: 3s
interval: 15s
test: "ps -aux | grep -v grep | grep -q rqworker || exit 1"
netbox-housekeeping:
<<: *netbox
command:
- /opt/netbox/housekeeping.sh
healthcheck:
test: ps -aux | grep -v grep | grep -q housekeeping || exit 1
start_period: 40s
timeout: 3s
interval: 15s
test: "ps -aux | grep -v grep | grep -q housekeeping || exit 1"
postgres:
image: postgres:16-alpine
image: docker.io/postgres:16-alpine
env_file: env/postgres.env
healthcheck:
test: "pg_isready -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER" ## $$ because of docker-compose
interval: 10s
test: pg_isready -q -t 2 -d $$POSTGRES_DB -U $$POSTGRES_USER ## $$ because of docker-compose
start_period: 20s
interval: 1s
timeout: 5s
retries: 5
redis: &redis
image: redis:7-alpine
image: docker.io/valkey/valkey:7.2-alpine
command:
- sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env
- redis-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
- valkey-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
env_file: env/redis.env
healthcheck:
start_period: 20s
test: "[ $$(valkey-cli --pass \"$${REDIS_PASSWORD}\" ping) = 'PONG' ]"
start_period: 5s
timeout: 3s
interval: 15s
test: "timeout 2 redis-cli ping"
interval: 1s
retries: 5
redis-cache:
<<: *redis
env_file: env/redis-cache.env
volumes:
netbox-media-files:
driver: local

View File

@ -8,10 +8,10 @@ services:
env_file: env/netbox.env
user: 'unit:root'
healthcheck:
test: curl -f http://localhost:8081/login/ || exit 1
start_period: 90s
timeout: 3s
interval: 15s
test: "curl -f http://localhost:8080/login/ || exit 1"
volumes:
- ./configuration:/etc/netbox/config:z,ro
- netbox-media-files:/opt/netbox/netbox/media:rw
@ -27,10 +27,10 @@ services:
- /opt/netbox/netbox/manage.py
- rqworker
healthcheck:
test: ps -aux | grep -v grep | grep -q rqworker || exit 1
start_period: 20s
timeout: 3s
interval: 15s
test: "ps -aux | grep -v grep | grep -q rqworker || exit 1"
netbox-housekeeping:
<<: *netbox
depends_on:
@ -39,20 +39,20 @@ services:
command:
- /opt/netbox/housekeeping.sh
healthcheck:
test: ps -aux | grep -v grep | grep -q housekeeping || exit 1
start_period: 20s
timeout: 3s
interval: 15s
test: "ps -aux | grep -v grep | grep -q housekeeping || exit 1"
# postgres
postgres:
image: docker.io/postgres:16-alpine
healthcheck:
test: pg_isready -q -U netbox -d netbox
interval: 10s
timeout: 30s
retries: 5
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
volumes:
- netbox-postgres-data:/var/lib/postgresql/data
@ -64,10 +64,11 @@ services:
- sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env
- valkey-server --appendonly yes --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
healthcheck:
healthcheck: &redis-healthcheck
test: "[ $$(valkey-cli --pass \"$${REDIS_PASSWORD}\" ping) = 'PONG' ]"
interval: 1s
start_period: 5s
timeout: 3s
interval: 1s
retries: 5
env_file: env/redis.env
volumes:
@ -78,11 +79,7 @@ services:
- sh
- -c # this is to evaluate the $REDIS_PASSWORD from the env
- valkey-server --requirepass $$REDIS_PASSWORD ## $$ because of docker-compose
healthcheck:
test: "[ $$(valkey-cli --pass \"$${REDIS_PASSWORD}\" ping) = 'PONG' ]"
interval: 1s
timeout: 3s
retries: 5
healthcheck: *redis-healthcheck
env_file: env/redis-cache.env
volumes:
- netbox-redis-cache-data:/data