193 lines
5.3 KiB
YAML
Executable File
193 lines
5.3 KiB
YAML
Executable File
version: '3.8'
|
|
|
|
services:
|
|
# ==========================================
|
|
# Backend - Rust Application
|
|
# ==========================================
|
|
backend:
|
|
build: ./backend
|
|
container_name: sap-sync-backend
|
|
ports:
|
|
- "3001:3001"
|
|
environment:
|
|
- DATABASE_URL=postgresql://sap_user:${DB_PASSWORD}@pgsql:5432/sap_sync
|
|
- APP__SERVER__HOST=0.0.0.0
|
|
- APP__SERVER__PORT=3001
|
|
- APP__SESSION__SECURE=false
|
|
- APP__SESSION__HTTP_ONLY=true
|
|
- APP__SESSION__SAME_SITE=Strict
|
|
- APP__SESSION__MAX_AGE=1800
|
|
- APP__CSRF__ENABLED=true
|
|
- APP__MFA__ENABLED=true
|
|
- APP__MFA__QR_CODE_SERVICE_NAME=SAP Sync
|
|
- APP__SYNC__DEFAULT_INTERVAL_SECONDS=3600
|
|
- APP__SYNC__DEFAULT_DIRECTION=sap_to_plesk
|
|
- APP__SYNC__CONFLICT_RESOLUTION=timestamp_based
|
|
- APP__SYNC__MAX_WORKERS=4
|
|
- APP__SAP__URL=${SAP_URL:-https://sap-server:50000/b1s/v1}
|
|
- APP__SAP__COMPANY_DB=${SAP_COMPANY_DB:-SBODemoDE}
|
|
- APP__SAP__USERNAME=${SAP_USERNAME:-manager}
|
|
- APP__SAP__PASSWORD=${SAP_PASSWORD:-manager}
|
|
- APP__PLESK__URL=${PLESK_URL:-https://plesk-server:8443/api/v2}
|
|
- APP__PLESK__API_KEY=${PLESK_API_KEY:-}
|
|
- ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
|
|
- ADMIN_EMAIL=${ADMIN_EMAIL:-admin@sap-sync.local}
|
|
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-Admin123!}
|
|
- RUST_LOG=info
|
|
- NODE_ENV=development
|
|
- SMTP_HOST=${SMTP_HOST}
|
|
- SMTP_PORT=${SMTP_PORT}
|
|
- SMTP_USERNAME=${SMTP_USERNAME}
|
|
- SMTP_PASSWORD=${SMTP_PASSWORD}
|
|
- SMTP_FROM=${SMTP_FROM}
|
|
depends_on:
|
|
pgsql:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./logs/backend:/app/logs
|
|
- ./backend/src:/app/src:ro
|
|
restart: unless-stopped
|
|
networks:
|
|
- sap_network
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:3001/api/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# ==========================================
|
|
# Frontend - React Application
|
|
# ==========================================
|
|
frontend:
|
|
build: ./frontend
|
|
container_name: sap-sync-frontend
|
|
ports:
|
|
- "3000:80"
|
|
environment:
|
|
- VITE_API_URL=http://localhost:3001/api
|
|
depends_on:
|
|
- backend
|
|
restart: unless-stopped
|
|
networks:
|
|
- sap_network
|
|
|
|
# ==========================================
|
|
# PostgreSQL Database
|
|
# ==========================================
|
|
pgsql:
|
|
image: postgres:15-alpine
|
|
container_name: sap-sync-postgres
|
|
ports:
|
|
- "5432:5432"
|
|
environment:
|
|
- POSTGRES_USER=sap_user
|
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
|
- POSTGRES_DB=sap_sync
|
|
- POSTGRES_INITDB_ARGS=--encoding=UTF8 --locale=C
|
|
volumes:
|
|
- pgsql_data:/var/lib/postgresql/data
|
|
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
|
- ./database/seeds:/docker-entrypoint-initdb.d/seeds:ro
|
|
- ./database/migrations:/docker-entrypoint-initdb.d/migrations:ro
|
|
restart: unless-stopped
|
|
networks:
|
|
- sap_network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U sap_user -d sap_sync"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 10s
|
|
|
|
# ==========================================
|
|
# pgAdmin - PostgreSQL Administration
|
|
# ==========================================
|
|
pgadmin:
|
|
image: dpage/pgadmin4:latest
|
|
container_name: sap-sync-pgadmin
|
|
ports:
|
|
- "8080:80"
|
|
environment:
|
|
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_EMAIL}
|
|
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PASSWORD}
|
|
- PGADMIN_CONFIG_SERVER_MODE=False
|
|
depends_on:
|
|
- pgsql
|
|
volumes:
|
|
- pgadmin_data:/var/lib/pgadmin
|
|
restart: unless-stopped
|
|
networks:
|
|
- sap_network
|
|
|
|
# ==========================================
|
|
# Redis - Caching Layer
|
|
# ==========================================
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: sap-sync-redis
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
command: redis-server --appendonly yes --maxmemory 512mb --maxmemory-policy allkeys-lru
|
|
restart: unless-stopped
|
|
networks:
|
|
- sap_network
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 5s
|
|
|
|
# ==========================================
|
|
# Nginx - Reverse Proxy & SSL
|
|
# ==========================================
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: sap-sync-nginx
|
|
ports:
|
|
- "443:443"
|
|
- "80:80"
|
|
volumes:
|
|
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./nginx/ssl:/etc/nginx/ssl:ro
|
|
- ./logs/nginx:/var/log/nginx
|
|
- ./frontend/dist:/usr/share/nginx/html:ro
|
|
depends_on:
|
|
- frontend
|
|
- backend
|
|
restart: unless-stopped
|
|
networks:
|
|
- sap_network
|
|
|
|
# ==========================================
|
|
# Mailhog - SMTP Test Server (Development)
|
|
# ==========================================
|
|
mailhog:
|
|
image: mailhog/mailhog:latest
|
|
container_name: sap-sync-mailhog
|
|
ports:
|
|
- "1025:1025" # SMTP
|
|
- "8025:8025" # Web UI
|
|
restart: unless-stopped
|
|
networks:
|
|
- sap_network
|
|
|
|
volumes:
|
|
pgsql_data:
|
|
driver: local
|
|
pgadmin_data:
|
|
driver: local
|
|
redis_data:
|
|
driver: local
|
|
|
|
networks:
|
|
sap_network:
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: 172.20.0.0/16 |