Implementación inicial del sistema de automatización de redes sociales
- Estructura completa del proyecto con FastAPI - Modelos de base de datos (productos, servicios, posts, calendario, interacciones) - Publishers para X, Threads, Instagram, Facebook - Generador de contenido con DeepSeek API - Worker de Celery con tareas programadas - Dashboard básico con templates HTML - Docker Compose para despliegue - Documentación completa Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
182
docker-compose.yml
Normal file
182
docker-compose.yml
Normal file
@@ -0,0 +1,182 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# ===========================================
|
||||
# APLICACIÓN PRINCIPAL (FastAPI)
|
||||
# ===========================================
|
||||
app:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: social-automation-app
|
||||
ports:
|
||||
- "8000:8000"
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://social_user:social_pass@db:5432/social_automation
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- ./app:/app/app
|
||||
- ./templates:/app/templates
|
||||
- ./data:/app/data
|
||||
- uploaded_images:/app/uploads
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- social-network
|
||||
|
||||
# ===========================================
|
||||
# CELERY WORKER (Procesamiento de tareas)
|
||||
# ===========================================
|
||||
worker:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: social-automation-worker
|
||||
command: celery -A worker.celery_app worker --loglevel=info --concurrency=2
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://social_user:social_pass@db:5432/social_automation
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- ./app:/app/app
|
||||
- ./worker:/app/worker
|
||||
- ./templates:/app/templates
|
||||
- uploaded_images:/app/uploads
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- social-network
|
||||
|
||||
# ===========================================
|
||||
# CELERY BEAT (Programador de tareas)
|
||||
# ===========================================
|
||||
beat:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: social-automation-beat
|
||||
command: celery -A worker.celery_app beat --loglevel=info
|
||||
environment:
|
||||
- DATABASE_URL=postgresql://social_user:social_pass@db:5432/social_automation
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- ./worker:/app/worker
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_started
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- social-network
|
||||
|
||||
# ===========================================
|
||||
# FLOWER (Monitor de Celery)
|
||||
# ===========================================
|
||||
flower:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: social-automation-flower
|
||||
command: celery -A worker.celery_app flower --port=5555
|
||||
ports:
|
||||
- "5555:5555"
|
||||
environment:
|
||||
- REDIS_URL=redis://redis:6379/0
|
||||
env_file:
|
||||
- .env
|
||||
depends_on:
|
||||
- redis
|
||||
- worker
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- social-network
|
||||
|
||||
# ===========================================
|
||||
# POSTGRESQL (Base de datos)
|
||||
# ===========================================
|
||||
db:
|
||||
image: postgres:15-alpine
|
||||
container_name: social-automation-db
|
||||
environment:
|
||||
- POSTGRES_USER=social_user
|
||||
- POSTGRES_PASSWORD=social_pass
|
||||
- POSTGRES_DB=social_automation
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./scripts/init_db.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
ports:
|
||||
- "5432:5432"
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U social_user -d social_automation"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- social-network
|
||||
|
||||
# ===========================================
|
||||
# REDIS (Cola de mensajes)
|
||||
# ===========================================
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: social-automation-redis
|
||||
command: redis-server --appendonly yes
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
ports:
|
||||
- "6379:6379"
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- social-network
|
||||
|
||||
# ===========================================
|
||||
# NGINX (Reverse Proxy)
|
||||
# ===========================================
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: social-automation-nginx
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./nginx/ssl:/etc/nginx/ssl
|
||||
- ./dashboard/static:/usr/share/nginx/html/static
|
||||
depends_on:
|
||||
- app
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- social-network
|
||||
|
||||
# ===========================================
|
||||
# VOLÚMENES
|
||||
# ===========================================
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
redis_data:
|
||||
driver: local
|
||||
uploaded_images:
|
||||
driver: local
|
||||
|
||||
# ===========================================
|
||||
# REDES
|
||||
# ===========================================
|
||||
networks:
|
||||
social-network:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user