Initial commit: VRBattles API
This commit is contained in:
93
docker-compose.prod.yml
Normal file
93
docker-compose.prod.yml
Normal file
@@ -0,0 +1,93 @@
|
||||
# =============================================================================
|
||||
# VRBattles API - Production Docker Compose for Dokploy
|
||||
# =============================================================================
|
||||
#
|
||||
# Dokploy Setup Instructions:
|
||||
# 1. Create a new "Compose" project in Dokploy
|
||||
# 2. Connect to your Git repository
|
||||
# 3. Set "Compose Path" to: docker-compose.prod.yml
|
||||
# 4. Add environment variables in Dokploy UI (see .env.example)
|
||||
# 5. Deploy!
|
||||
#
|
||||
# Required Environment Variables in Dokploy:
|
||||
# - DATABASE_URL (or use the db service below)
|
||||
# - JWT_SECRET (generate with: openssl rand -base64 32)
|
||||
# - FRONTEND_URL
|
||||
# - POSTGRES_PASSWORD (if using db service)
|
||||
#
|
||||
# =============================================================================
|
||||
|
||||
services:
|
||||
api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
ports:
|
||||
- "3000:3000"
|
||||
environment:
|
||||
- DATABASE_URL=${DATABASE_URL:-postgres://postgres:${POSTGRES_PASSWORD}@db:5432/vrbattles}
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
- JWT_EXPIRATION_HOURS=${JWT_EXPIRATION_HOURS:-24}
|
||||
- HOST=0.0.0.0
|
||||
- PORT=3000
|
||||
- ENVIRONMENT=production
|
||||
- RUST_LOG=${RUST_LOG:-vrbattles_api=info,tower_http=info}
|
||||
- FRONTEND_URL=${FRONTEND_URL:-http://localhost:3000}
|
||||
- BASE_URL=${BASE_URL:-http://localhost:3000}
|
||||
- UPLOAD_PATH=/app/uploads
|
||||
# Optional S3 config
|
||||
- S3_BUCKET=${S3_BUCKET:-}
|
||||
- S3_REGION=${S3_REGION:-}
|
||||
- AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID:-}
|
||||
- AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY:-}
|
||||
# Optional Email config
|
||||
- SMTP_HOST=${SMTP_HOST:-}
|
||||
- SMTP_PORT=${SMTP_PORT:-}
|
||||
- SMTP_USERNAME=${SMTP_USERNAME:-}
|
||||
- SMTP_PASSWORD=${SMTP_PASSWORD:-}
|
||||
- FROM_EMAIL=${FROM_EMAIL:-}
|
||||
volumes:
|
||||
# Persist uploaded files
|
||||
- uploads_data:/app/uploads
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
networks:
|
||||
- vrbattles-network
|
||||
|
||||
db:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}
|
||||
- POSTGRES_DB=${POSTGRES_DB:-vrbattles}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- vrbattles-network
|
||||
# Uncomment if you need external access to the database
|
||||
# ports:
|
||||
# - "5432:5432"
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
uploads_data:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
vrbattles-network:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user