91 lines
2.1 KiB
YAML
91 lines
2.1 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
web:
|
|
build: .
|
|
command: gunicorn --bind 0.0.0.0:5000 app:app
|
|
ports:
|
|
- "10335:5000"
|
|
environment:
|
|
- FLASK_APP=app.py
|
|
- FLASK_ENV=production
|
|
- DATABASE_URL=postgresql://postgres:postgres@db:5432/docupulse
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=postgres
|
|
- POSTGRES_DB=docupulse
|
|
- REDIS_URL=redis://redis:6379/0
|
|
volumes:
|
|
- uploads:/data
|
|
depends_on:
|
|
- db
|
|
- redis
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1'
|
|
memory: 1G
|
|
|
|
db:
|
|
image: postgres:13
|
|
environment:
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=postgres
|
|
- POSTGRES_DB=docupulse
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
redis:
|
|
image: redis:7
|
|
ports:
|
|
- "6379:6379"
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
|
|
celery_worker:
|
|
build: .
|
|
command: celery -A celery_worker.celery worker --loglevel=info
|
|
volumes:
|
|
- .:/app
|
|
environment:
|
|
- FLASK_APP=app.py
|
|
- FLASK_ENV=development
|
|
- DATABASE_URL=postgresql://postgres:postgres@db:5432/docupulse
|
|
- REDIS_URL=redis://redis:6379/0
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "celery", "-A", "celery_worker.celery", "inspect", "ping"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
|
|
volumes:
|
|
postgres_data:
|
|
name: ${COMPOSE_PROJECT_NAME:-default}_postgres_data
|
|
uploads:
|
|
name: ${COMPOSE_PROJECT_NAME:-default}_uploads |