Changes: - Uncommented frontend service in docker-compose.yml - Updated README.md with complete setup instructions for both backend and frontend - Added DEPLOYMENT.md with comprehensive production deployment guide Docker Compose: - Frontend now included in docker-compose up - All services (postgres, redis, backend, frontend) start together - Frontend runs on port 3000 with hot reload in development mode README Updates: - Added frontend .env setup instructions - Listed all required environment variables for both services - Updated "Access the application" section with frontend URL - Clarified that database tables are created automatically on first run DEPLOYMENT.md (new): - Complete production deployment guide - Server setup with Docker installation - Production environment configuration - Nginx reverse proxy setup with SSL/TLS - Let's Encrypt SSL certificate instructions - Database backup and restore procedures - Monitoring and logging setup - Security checklist - Performance optimization tips - Scaling strategies for high-traffic scenarios - Troubleshooting guide Now users can: 1. Run `docker-compose up --build` to start all services 2. Access frontend at http://localhost:3000 3. Access backend API at http://localhost:8000 4. Follow DEPLOYMENT.md for production deployment Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
94 lines
2.1 KiB
YAML
94 lines
2.1 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL database
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: apac_ops_bot_postgres
|
|
environment:
|
|
POSTGRES_USER: apac_ops_bot
|
|
POSTGRES_PASSWORD: secure_password
|
|
POSTGRES_DB: apac_ops_bot
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U apac_ops_bot"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- apac_network
|
|
restart: unless-stopped
|
|
|
|
# Redis for caching and rate limiting
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: apac_ops_bot_redis
|
|
ports:
|
|
- "6379:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- apac_network
|
|
restart: unless-stopped
|
|
|
|
# FastAPI backend
|
|
backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
target: development
|
|
container_name: apac_ops_bot_backend
|
|
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
|
|
volumes:
|
|
- ./backend:/app
|
|
ports:
|
|
- "8000:8000"
|
|
env_file:
|
|
- ./backend/.env
|
|
environment:
|
|
- DATABASE_URL=postgresql+asyncpg://apac_ops_bot:secure_password@postgres:5432/apac_ops_bot
|
|
- REDIS_URL=redis://redis:6379/0
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- apac_network
|
|
restart: unless-stopped
|
|
|
|
# React frontend
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
target: development
|
|
container_name: apac_ops_bot_frontend
|
|
volumes:
|
|
- ./frontend:/app
|
|
- /app/node_modules
|
|
ports:
|
|
- "3000:3000"
|
|
env_file:
|
|
- ./frontend/.env
|
|
environment:
|
|
- REACT_APP_API_URL=http://localhost:8000/api/v1
|
|
- REACT_APP_WS_URL=ws://localhost:8000/ws
|
|
depends_on:
|
|
- backend
|
|
networks:
|
|
- apac_network
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
|
|
networks:
|
|
apac_network:
|
|
driver: bridge
|