forked from cardosofelipe/fast-next-template
Infrastructure: - Add Redis and Celery workers to all docker-compose files - Fix celery migration race condition in entrypoint.sh - Add healthchecks and resource limits to dev compose - Update .env.template with Redis/Celery variables Backend Models & Schemas: - Rename Sprint.completed_points to velocity (per requirements) - Add AgentInstance.name as required field - Rename Issue external tracker fields for consistency - Add IssueSource and TrackerType enums - Add Project.default_tracker_type field Backend Fixes: - Add Celery retry configuration with exponential backoff - Remove unused sequence counter from EventBus - Add mypy overrides for test dependencies - Fix test file using wrong schema (UserUpdate -> dict) Frontend Fixes: - Fix memory leak in useProjectEvents (proper cleanup) - Fix race condition with stale closure in reconnection - Sync TokenWithUser type with regenerated API client - Fix expires_in null handling in useAuth - Clean up unused imports in prototype pages - Add ESLint relaxed rules for prototype files CI/CD: - Add E2E testing stage with Testcontainers - Add security scanning with Trivy and pip-audit - Add dependency caching for faster builds Tests: - Update all tests to use renamed fields (velocity, name, etc.) - Fix 14 schema test failures - All 1500 tests pass with 91% coverage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
233 lines
6.3 KiB
YAML
233 lines
6.3 KiB
YAML
# Docker Compose configuration for DEPLOYMENT with pre-built images
|
|
#
|
|
# IMPORTANT: This configuration is designed for deployment scenarios where you have
|
|
# already built and pushed your Docker images to a container registry.
|
|
#
|
|
# Since this is a template project, you'll need to:
|
|
# 1. Build your images: docker-compose build
|
|
# 2. Tag them appropriately: docker tag <image> <your-registry>/<your-project>:<tag>
|
|
# 3. Push to your registry: docker push <your-registry>/<your-project>:<tag>
|
|
# 4. Update the image references below to point to your registry
|
|
#
|
|
# Example registry paths:
|
|
# - Docker Hub: username/project-backend:latest
|
|
# - GitHub Container Registry: ghcr.io/username/project-backend:latest
|
|
# - GitLab Registry: registry.gitlab.com/username/project/backend:latest
|
|
# - Private Registry: registry.example.com/project-backend:latest
|
|
|
|
services:
|
|
db:
|
|
image: pgvector/pgvector:pg17
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data/
|
|
# Note: Port not exposed in production for security
|
|
environment:
|
|
- POSTGRES_USER=${POSTGRES_USER}
|
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
|
- POSTGRES_DB=${POSTGRES_DB}
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
volumes:
|
|
- redis_data:/data
|
|
command: redis-server --appendonly yes
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
|
|
backend:
|
|
# REPLACE THIS with your actual image from your container registry
|
|
# Examples:
|
|
# image: ghcr.io/your-username/your-project-backend:latest
|
|
# image: your-registry.com/your-project/backend:v1.0.0
|
|
# image: username/your-project-backend:latest
|
|
image: YOUR_REGISTRY/YOUR_PROJECT_BACKEND:latest
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- DATABASE_URL=${DATABASE_URL}
|
|
- SECRET_KEY=${SECRET_KEY}
|
|
- ENVIRONMENT=production
|
|
- DEBUG=false
|
|
- BACKEND_CORS_ORIGINS=${BACKEND_CORS_ORIGINS}
|
|
- REDIS_URL=redis://redis:6379/0
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
# Uncomment if you need persistent data storage for uploads, etc.
|
|
# volumes:
|
|
# - ${HOST_DATA_FILES_DIR:-./data}:${DATA_FILES_DIR:-/app/data}
|
|
|
|
# Celery workers for background task processing (per ADR-003)
|
|
celery-agent:
|
|
# REPLACE THIS with your backend image
|
|
image: YOUR_REGISTRY/YOUR_PROJECT_BACKEND:latest
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- DATABASE_URL=${DATABASE_URL}
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- CELERY_QUEUE=agent
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
command: ["celery", "-A", "app.celery_app", "worker", "-Q", "agent", "-l", "info", "-c", "4"]
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '2.0'
|
|
memory: 4G
|
|
reservations:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
|
|
celery-git:
|
|
# REPLACE THIS with your backend image
|
|
image: YOUR_REGISTRY/YOUR_PROJECT_BACKEND:latest
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- DATABASE_URL=${DATABASE_URL}
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- CELERY_QUEUE=git
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
command: ["celery", "-A", "app.celery_app", "worker", "-Q", "git", "-l", "info", "-c", "2"]
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1.0'
|
|
memory: 2G
|
|
reservations:
|
|
cpus: '0.25'
|
|
memory: 256M
|
|
|
|
celery-sync:
|
|
# REPLACE THIS with your backend image
|
|
image: YOUR_REGISTRY/YOUR_PROJECT_BACKEND:latest
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- DATABASE_URL=${DATABASE_URL}
|
|
- REDIS_URL=redis://redis:6379/0
|
|
- CELERY_QUEUE=sync
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
command: ["celery", "-A", "app.celery_app", "worker", "-Q", "sync", "-l", "info", "-c", "2"]
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '1.0'
|
|
memory: 2G
|
|
reservations:
|
|
cpus: '0.25'
|
|
memory: 256M
|
|
|
|
celery-beat:
|
|
# REPLACE THIS with your backend image
|
|
image: YOUR_REGISTRY/YOUR_PROJECT_BACKEND:latest
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- DATABASE_URL=${DATABASE_URL}
|
|
- REDIS_URL=redis://redis:6379/0
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
command: ["celery", "-A", "app.celery_app", "beat", "-l", "info"]
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
cpus: '0.5'
|
|
memory: 512M
|
|
reservations:
|
|
cpus: '0.1'
|
|
memory: 128M
|
|
|
|
frontend:
|
|
# REPLACE THIS with your actual image from your container registry
|
|
# Examples:
|
|
# image: ghcr.io/your-username/your-project-frontend:latest
|
|
# image: your-registry.com/your-project/frontend:v1.0.0
|
|
# image: username/your-project-frontend:latest
|
|
image: YOUR_REGISTRY/YOUR_PROJECT_FRONTEND:latest
|
|
environment:
|
|
- NODE_ENV=production
|
|
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
|
depends_on:
|
|
backend:
|
|
condition: service_healthy
|
|
networks:
|
|
- app-network
|
|
restart: unless-stopped
|
|
|
|
# Optional: Add a reverse proxy like nginx or traefik here
|
|
# nginx:
|
|
# image: nginx:alpine
|
|
# ports:
|
|
# - "80:80"
|
|
# - "443:443"
|
|
# volumes:
|
|
# - ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
# - ./ssl:/etc/nginx/ssl:ro
|
|
# depends_on:
|
|
# - frontend
|
|
# - backend
|
|
# networks:
|
|
# - app-network
|
|
# restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
redis_data:
|
|
|
|
networks:
|
|
app-network:
|
|
driver: bridge
|