mirror of
https://github.com/bellingcat/auto-archiver-api.git
synced 2026-06-07 19:18:34 +03:00
85 lines
2.3 KiB
YAML
85 lines
2.3 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=50 -O fair --without-heartbeat --without-mingle
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: ${WORKER_MEMORY_LIMIT:-4g}
|
|
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
|
|
start_period: 30s
|
|
|
|
redis:
|
|
init: true
|
|
image: redis:6-alpine
|
|
restart: always
|
|
env_file: .env.prod
|
|
command: redis-server /conf/redis.conf --requirepass ${REDIS_PASSWORD}
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: ${REDIS_MEMORY_LIMIT:-1g}
|
|
volumes:
|
|
- ./redis/data:/data
|
|
- ./redis/config:/conf
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|