varnish add

This commit is contained in:
Mateusz Gruszczyński
2025-09-24 12:32:48 +02:00
parent f4ebcdb5b1
commit 7495a6baca
2 changed files with 80 additions and 4 deletions

View File

@@ -2,10 +2,12 @@ services:
app:
build: .
container_name: zbiorka-app
ports:
- "${APP_PORT:-8080}:${APP_PORT}"
#ports:
# - "${APP_PORT:-8080}:${APP_PORT}"
expose:
- "${APP_PORT}"
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; import sys; req = urllib.request.Request('http://localhost:${APP_PORT}/healthcheck', headers={'X-Internal-Check': '${HEALTHCHECK_TOKEN}'}); sys.exit(0) if urllib.request.urlopen(req).read() == b'OK' else sys.exit(1)"]
test: [ "CMD", "python", "-c", "import urllib.request; import sys; req = urllib.request.Request('http://localhost:${APP_PORT}/healthcheck', headers={'X-Internal-Check': '${HEALTHCHECK_TOKEN}'}); sys.exit(0) if urllib.request.urlopen(req).read() == b'OK' else sys.exit(1)" ]
interval: 30s
timeout: 10s
retries: 3
@@ -14,4 +16,25 @@ services:
- .env
volumes:
- ./instance:/app/instance
restart: unless-stopped
restart: unless-stopped
varnish:
image: varnish:fresh
container_name: zbiorka-varnish
depends_on:
app:
condition: service_healthy
ports:
- "${APP_PORT:-8080}:80"
volumes:
- ./deploy/varnish/default.vcl:/etc/varnish/default.vcl:ro
environment:
- VARNISH_SIZE=256m
healthcheck:
test: [ "CMD-SHELL", "curl -fsS -H 'X-Internal-Check=${HEALTHCHECK_TOKEN}' http://localhost/healthcheck | grep -q OK" ]
interval: 30s
timeout: 5s
retries: 3
env_file:
- .env
restart: unless-stopped