Fix jwt-token
This commit is contained in:
138
docker-compose.production.yml
Normal file
138
docker-compose.production.yml
Normal file
@@ -0,0 +1,138 @@
|
||||
# Multi-Tenant Nginx Configuration with Let's Encrypt Support
|
||||
# This configuration supports:
|
||||
# - Wildcard SSL certificates via Let's Encrypt
|
||||
# - Multi-tenant routing based on subdomains
|
||||
# - Automatic SSL renewal
|
||||
# - WebSocket support for Socket.IO
|
||||
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
# Nginx Reverse Proxy with SSL
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: drone-detection-nginx
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./nginx/conf.d:/etc/nginx/conf.d
|
||||
- ./nginx/ssl:/etc/nginx/ssl
|
||||
- ./certbot/conf:/etc/letsencrypt
|
||||
- ./certbot/www:/var/www/certbot
|
||||
- ./client/dist:/usr/share/nginx/html
|
||||
depends_on:
|
||||
- backend
|
||||
- frontend
|
||||
networks:
|
||||
- drone-network
|
||||
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
|
||||
|
||||
# Certbot for Let's Encrypt SSL
|
||||
certbot:
|
||||
image: certbot/certbot
|
||||
container_name: drone-detection-certbot
|
||||
restart: "no"
|
||||
volumes:
|
||||
- ./certbot/conf:/etc/letsencrypt
|
||||
- ./certbot/www:/var/www/certbot
|
||||
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
|
||||
|
||||
# PostgreSQL Database
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: drone-detection-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: drone_detection
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres123
|
||||
PGDATA: /var/lib/postgresql/data/pgdata
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./server/scripts/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql
|
||||
ports:
|
||||
- "5433:5432"
|
||||
networks:
|
||||
- drone-network
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres -d drone_detection"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
# Redis for session management and caching
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: drone-detection-redis
|
||||
restart: unless-stopped
|
||||
command: redis-server --appendonly yes
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
ports:
|
||||
- "6380:6379"
|
||||
networks:
|
||||
- drone-network
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
# Backend API Server
|
||||
backend:
|
||||
build:
|
||||
context: ./server
|
||||
dockerfile: Dockerfile
|
||||
container_name: drone-detection-backend
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- .env.production
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
PORT: 3001
|
||||
DB_HOST: postgres
|
||||
DB_PORT: 5432
|
||||
DB_NAME: drone_detection
|
||||
DB_USER: postgres
|
||||
DB_PASSWORD: postgres123
|
||||
REDIS_HOST: redis
|
||||
REDIS_PORT: 6379
|
||||
volumes:
|
||||
- ./server/logs:/app/logs
|
||||
- ./debug_logs:/app/debug_logs
|
||||
networks:
|
||||
- drone-network
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:3001/api/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
|
||||
# Frontend (React Build)
|
||||
frontend:
|
||||
build:
|
||||
context: ./client
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
REACT_APP_API_URL: https://dev.uggla.uamils.com/api
|
||||
REACT_APP_SOCKET_URL: https://dev.uggla.uamils.com
|
||||
REACT_APP_MULTI_TENANT: "true"
|
||||
container_name: drone-detection-frontend
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- drone-network
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
|
||||
networks:
|
||||
drone-network:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user