Files
auto-archiver-api/docker-compose.yml

75 lines
2.1 KiB
YAML

volumes:
crawls:
name: "auto-archiver-api"
services:
web:
init: true
build:
context: .
dockerfile: docker/web/Dockerfile
restart: always
env_file: .env.prod
environment:
ENVIRONMENT_FILE: .env.prod
REDIS_HOSTNAME: redis
ports:
- "127.0.0.1:8004:8000"
command: uvicorn app.web:app --factory --host 0.0.0.0
volumes:
- ./logs:/aa-api/logs
- ./database:/aa-api/database
- ./secrets:/aa-api/secrets
depends_on:
- redis
healthcheck:
test: ["CMD", "python3", "-c", 'import sys, urllib.request; sys.exit(urllib.request.urlopen("http://localhost:8000/health").getcode() != 200)']
interval: 30s
timeout: 10s
retries: 3
worker:
init: true
build:
context: .
dockerfile: docker/worker/Dockerfile
restart: always
env_file: .env.prod
command: celery --app=app.worker.main.celery worker -Q high_priority,low_priority --concurrency=${CONCURRENCY} --max-tasks-per-child=100 -O fair
volumes:
- ./logs:/aa-api/logs
- ./database:/aa-api/database
- ./secrets:/aa-api/secrets
- /var/run/docker.sock:/var/run/docker.sock
- crawls:/crawls # BROWSERTRIX_HOME_HOST:BROWSERTRIX_HOME_CONTAINER, do not change /crawls
environment:
REDIS_HOSTNAME: redis
ENVIRONMENT_FILE: .env.prod
WACZ_ENABLE_DOCKER: 1 # Enable calling docker from this container
BROWSERTRIX_HOME_HOST: auto-archiver-api_crawls
BROWSERTRIX_HOME_CONTAINER: /crawls
depends_on:
- web
- redis
healthcheck:
test: ["CMD-SHELL", "./poetry-venv/bin/poetry run celery -A app.worker.main.celery inspect ping || exit 1"]
interval: 30s
timeout: 10s
retries: 3
redis:
init: true
image: redis:6-alpine
restart: always
env_file: .env.prod
command: redis-server /conf/redis.conf --requirepass ${REDIS_PASSWORD}
volumes:
- ./redis/data:/data
- ./redis/config:/conf
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 30s
timeout: 10s
retries: 3