autoGranted / docker-compose.yml
Ig0tU
feat: initial agent deployment to Hugging Face Spaces
2f8f181
services:
# PostgreSQL Database
db:
image: postgres:13
environment:
POSTGRES_DB: autogranted
POSTGRES_USER: autogranted
POSTGRES_PASSWORD: autogranted_password
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U autogranted"]
interval: 10s
timeout: 5s
retries: 5
# Redis Cache and Message Broker
redis:
image: redis:6-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# Flask Web Application
web:
build: .
mem_limit: 1g
ports:
- "5000:5000"
environment:
- FLASK_ENV=production
- DATABASE_URL=postgresql://autogranted:autogranted_password@db:5432/autogranted
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
volumes:
- ./logs:/app/logs
- ./uploads:/app/uploads
- ./generated_documents:/app/generated_documents
- ./migrations:/app/migrations
command: sh -c "flask db upgrade && gunicorn --bind 0.0.0.0:5000 'autogranted:app'"
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
# Celery Worker for Background Tasks
worker:
build: .
command: celery -A autogranted.celery worker --loglevel=info --concurrency=4
environment:
- DATABASE_URL=postgresql://autogranted:autogranted_password@db:5432/autogranted
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
volumes:
- ./logs:/app/logs
- ./uploads:/app/uploads
- ./generated_documents:/app/generated_documents
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
# Celery Beat Scheduler
scheduler:
build: .
command: celery -A autogranted.celery beat --loglevel=info
environment:
- DATABASE_URL=postgresql://autogranted:autogranted_password@db:5432/autogranted
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
volumes:
- ./logs:/app/logs
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
# Nginx Reverse Proxy (Optional)
nginx:
image: nginx:alpine
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./ssl:/etc/nginx/ssl:ro
depends_on:
- web
restart: unless-stopped
profiles:
- production
volumes:
postgres_data:
redis_data:
networks:
default:
name: autogranted_network