384 lines
12 KiB
Plaintext
384 lines
12 KiB
Plaintext
services:
|
|
mvp-platform-landing:
|
|
build:
|
|
context: ./mvp-platform-services/landing
|
|
dockerfile: Dockerfile
|
|
args:
|
|
VITE_AUTH0_DOMAIN: ${AUTH0_DOMAIN:-motovaultpro.us.auth0.com}
|
|
VITE_AUTH0_CLIENT_ID: ${AUTH0_CLIENT_ID:-yspR8zdnSxmV8wFIghHynQ08iXAPoQJ3}
|
|
VITE_TENANTS_API_URL: http://mvp-platform-tenants:8000
|
|
container_name: mvp-platform-landing
|
|
environment:
|
|
VITE_AUTH0_DOMAIN: ${AUTH0_DOMAIN:-motovaultpro.us.auth0.com}
|
|
VITE_AUTH0_CLIENT_ID: ${AUTH0_CLIENT_ID:-yspR8zdnSxmV8wFIghHynQ08iXAPoQJ3}
|
|
VITE_TENANTS_API_URL: http://mvp-platform-tenants:8000
|
|
ports:
|
|
- "80:3000" # HTTP port
|
|
- "443:3443" # HTTPS port
|
|
volumes:
|
|
- ./certs:/etc/nginx/certs:ro # Mount SSL certificates
|
|
depends_on:
|
|
- mvp-platform-tenants
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -s http://localhost:3000 || exit 1"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 20s
|
|
# Platform Services (Shared Infrastructure)
|
|
|
|
mvp-platform-tenants:
|
|
build:
|
|
context: ./mvp-platform-services/tenants
|
|
dockerfile: docker/Dockerfile.api
|
|
container_name: mvp-platform-tenants
|
|
environment:
|
|
DATABASE_URL: postgresql://platform_user:${PLATFORM_DB_PASSWORD:-platform123}@platform-postgres:5432/platform
|
|
AUTH0_DOMAIN: ${AUTH0_DOMAIN:-motovaultpro.us.auth0.com}
|
|
AUTH0_AUDIENCE: ${AUTH0_AUDIENCE:-https://api.motovaultpro.com}
|
|
ports:
|
|
- "8001:8000"
|
|
depends_on:
|
|
- platform-postgres
|
|
- platform-redis
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "python -c \"import urllib.request,sys;\ntry:\n with urllib.request.urlopen('http://localhost:8000/health', timeout=3) as r:\n sys.exit(0 if r.getcode()==200 else 1)\nexcept Exception:\n sys.exit(1)\n\""]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
platform-postgres:
|
|
image: postgres:15-alpine
|
|
container_name: platform-postgres
|
|
environment:
|
|
POSTGRES_DB: platform
|
|
POSTGRES_USER: platform_user
|
|
POSTGRES_PASSWORD: ${PLATFORM_DB_PASSWORD:-platform123}
|
|
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
|
|
volumes:
|
|
- platform_postgres_data:/var/lib/postgresql/data
|
|
- ./mvp-platform-services/tenants/sql/schema:/docker-entrypoint-initdb.d
|
|
ports:
|
|
- "5434:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U platform_user -d platform"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
platform-redis:
|
|
image: redis:7-alpine
|
|
container_name: platform-redis
|
|
command: redis-server --appendonly yes
|
|
volumes:
|
|
- platform_redis_data:/data
|
|
ports:
|
|
- "6381:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Admin Tenant (Converted Current Implementation)
|
|
admin-postgres:
|
|
image: postgres:15-alpine
|
|
container_name: admin-postgres
|
|
environment:
|
|
POSTGRES_DB: motovaultpro
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: localdev123
|
|
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
|
|
volumes:
|
|
- admin_postgres_data:/var/lib/postgresql/data
|
|
ports:
|
|
- "5432:5432"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
admin-redis:
|
|
image: redis:7-alpine
|
|
container_name: admin-redis
|
|
command: redis-server --appendonly yes
|
|
volumes:
|
|
- admin_redis_data:/data
|
|
ports:
|
|
- "6379:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
admin-minio:
|
|
image: minio/minio:latest
|
|
container_name: admin-minio
|
|
command: server /data --console-address ":9001"
|
|
environment:
|
|
MINIO_ROOT_USER: minioadmin
|
|
MINIO_ROOT_PASSWORD: minioadmin123
|
|
volumes:
|
|
- admin_minio_data:/data
|
|
ports:
|
|
- "9000:9000" # API
|
|
- "9001:9001" # Console
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
|
interval: 30s
|
|
timeout: 20s
|
|
retries: 3
|
|
|
|
admin-backend:
|
|
build:
|
|
context: ./backend
|
|
dockerfile: Dockerfile
|
|
cache_from:
|
|
- node:20-alpine
|
|
container_name: admin-backend
|
|
environment:
|
|
TENANT_ID: ${TENANT_ID:-admin}
|
|
PORT: 3001
|
|
DB_HOST: admin-postgres
|
|
DB_PORT: 5432
|
|
DB_NAME: motovaultpro
|
|
DB_USER: postgres
|
|
DB_PASSWORD: localdev123
|
|
REDIS_HOST: admin-redis
|
|
REDIS_PORT: 6379
|
|
MINIO_ENDPOINT: admin-minio
|
|
MINIO_PORT: 9000
|
|
MINIO_ACCESS_KEY: minioadmin
|
|
MINIO_SECRET_KEY: minioadmin123
|
|
MINIO_BUCKET: motovaultpro
|
|
AUTH0_DOMAIN: ${AUTH0_DOMAIN:-motovaultpro.us.auth0.com}
|
|
AUTH0_CLIENT_ID: ${AUTH0_CLIENT_ID:-your-client-id}
|
|
AUTH0_CLIENT_SECRET: ${AUTH0_CLIENT_SECRET:-your-client-secret}
|
|
AUTH0_AUDIENCE: ${AUTH0_AUDIENCE:-https://api.motovaultpro.com}
|
|
GOOGLE_MAPS_API_KEY: ${GOOGLE_MAPS_API_KEY:-your-google-maps-key}
|
|
VPIC_API_URL: https://vpic.nhtsa.dot.gov/api/vehicles
|
|
PLATFORM_VEHICLES_API_URL: http://mvp-platform-vehicles-api:8000
|
|
PLATFORM_VEHICLES_API_KEY: mvp-platform-vehicles-secret-key
|
|
PLATFORM_TENANTS_API_URL: ${PLATFORM_TENANTS_API_URL:-http://mvp-platform-tenants:8000}
|
|
ports:
|
|
- "3001:3001"
|
|
depends_on:
|
|
- admin-postgres
|
|
- admin-redis
|
|
- admin-minio
|
|
- mvp-platform-vehicles-api
|
|
- mvp-platform-tenants
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "node -e \"require('http').get('http://localhost:3001/health', r => process.exit(r.statusCode===200?0:1)).on('error', () => process.exit(1))\""]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
admin-frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
cache_from:
|
|
- node:20-alpine
|
|
- nginx:alpine
|
|
args:
|
|
VITE_AUTH0_DOMAIN: ${VITE_AUTH0_DOMAIN:-motovaultpro.us.auth0.com}
|
|
VITE_AUTH0_CLIENT_ID: ${VITE_AUTH0_CLIENT_ID:-yspR8zdnSxmV8wFIghHynQ08iXAPoQJ3}
|
|
VITE_AUTH0_AUDIENCE: ${VITE_AUTH0_AUDIENCE:-https://api.motovaultpro.com}
|
|
VITE_API_BASE_URL: ${VITE_API_BASE_URL:-/api}
|
|
container_name: admin-frontend
|
|
environment:
|
|
VITE_TENANT_ID: ${TENANT_ID:-admin}
|
|
VITE_API_BASE_URL: /api
|
|
VITE_AUTH0_DOMAIN: ${VITE_AUTH0_DOMAIN:-motovaultpro.us.auth0.com}
|
|
VITE_AUTH0_CLIENT_ID: ${VITE_AUTH0_CLIENT_ID:-yspR8zdnSxmV8wFIghHynQ08iXAPoQJ3}
|
|
VITE_AUTH0_AUDIENCE: ${VITE_AUTH0_AUDIENCE:-https://api.motovaultpro.com}
|
|
ports:
|
|
- "8080:3000" # HTTP (redirects to HTTPS) - using 8080 to avoid conflict with landing
|
|
- "8443:3443" # HTTPS - using 8443 to avoid conflict with landing
|
|
volumes:
|
|
- ./certs:/etc/nginx/certs:ro # Mount SSL certificates
|
|
depends_on:
|
|
- admin-backend
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -s http://localhost:3000 || exit 1"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 20s
|
|
|
|
# MVP Platform Vehicles Service - Database
|
|
mvp-platform-vehicles-db:
|
|
image: postgres:15-alpine
|
|
container_name: mvp-platform-vehicles-db
|
|
command: |
|
|
postgres
|
|
-c shared_buffers=4GB
|
|
-c work_mem=256MB
|
|
-c maintenance_work_mem=1GB
|
|
-c effective_cache_size=12GB
|
|
-c max_connections=100
|
|
-c checkpoint_completion_target=0.9
|
|
-c wal_buffers=256MB
|
|
-c max_wal_size=8GB
|
|
-c min_wal_size=2GB
|
|
-c synchronous_commit=off
|
|
-c full_page_writes=off
|
|
-c fsync=off
|
|
-c random_page_cost=1.1
|
|
-c seq_page_cost=1
|
|
-c max_worker_processes=8
|
|
-c max_parallel_workers=8
|
|
-c max_parallel_workers_per_gather=4
|
|
-c max_parallel_maintenance_workers=4
|
|
environment:
|
|
POSTGRES_DB: vehicles
|
|
POSTGRES_USER: mvp_platform_user
|
|
POSTGRES_PASSWORD: platform123
|
|
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
|
|
volumes:
|
|
- platform_vehicles_data:/var/lib/postgresql/data
|
|
- ./mvp-platform-services/vehicles/sql/schema:/docker-entrypoint-initdb.d
|
|
ports:
|
|
- "5433:5432"
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 6G
|
|
cpus: '6.0'
|
|
reservations:
|
|
memory: 4G
|
|
cpus: '4.0'
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U mvp_platform_user -d vehicles"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# MVP Platform Vehicles Service - Redis Cache
|
|
mvp-platform-vehicles-redis:
|
|
image: redis:7-alpine
|
|
container_name: mvp-platform-vehicles-redis
|
|
command: redis-server --appendonly yes
|
|
volumes:
|
|
- platform_vehicles_redis_data:/data
|
|
ports:
|
|
- "6380:6379"
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# MVP Platform Vehicles Service - MSSQL Source (for ETL)
|
|
mvp-platform-vehicles-mssql:
|
|
image: mcr.microsoft.com/mssql/server:2019-CU32-ubuntu-20.04
|
|
container_name: mvp-platform-vehicles-mssql
|
|
profiles: ["mssql-monthly"]
|
|
user: root
|
|
environment:
|
|
ACCEPT_EULA: Y
|
|
SA_PASSWORD: Platform123!
|
|
MSSQL_PID: Developer
|
|
volumes:
|
|
- platform_vehicles_mssql_data:/var/opt/mssql/data
|
|
- ./mvp-platform-services/vehicles/mssql/backups:/backups
|
|
ports:
|
|
- "1433:1433"
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "/opt/mssql-tools18/bin/sqlcmd -C -S localhost -U sa -P 'Platform123!' -Q 'SELECT 1' || exit 1"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 60s
|
|
|
|
# MVP Platform Vehicles Service - ETL
|
|
mvp-platform-vehicles-etl:
|
|
build:
|
|
context: ./mvp-platform-services/vehicles
|
|
dockerfile: docker/Dockerfile.etl
|
|
container_name: mvp-platform-vehicles-etl
|
|
environment:
|
|
MSSQL_HOST: mvp-platform-vehicles-mssql
|
|
MSSQL_PORT: 1433
|
|
MSSQL_DATABASE: VPICList
|
|
MSSQL_USER: sa
|
|
MSSQL_PASSWORD: Platform123!
|
|
POSTGRES_HOST: mvp-platform-vehicles-db
|
|
POSTGRES_PORT: 5432
|
|
POSTGRES_DATABASE: vehicles
|
|
POSTGRES_USER: mvp_platform_user
|
|
POSTGRES_PASSWORD: platform123
|
|
REDIS_HOST: mvp-platform-vehicles-redis
|
|
REDIS_PORT: 6379
|
|
ETL_SCHEDULE: "0 2 * * 0" # Weekly at 2 AM on Sunday
|
|
volumes:
|
|
- ./mvp-platform-services/vehicles/etl:/app/etl
|
|
- ./mvp-platform-services/vehicles/logs:/app/logs
|
|
- ./mvp-platform-services/vehicles/mssql/backups:/app/shared
|
|
depends_on:
|
|
- mvp-platform-vehicles-db
|
|
- mvp-platform-vehicles-redis
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 6G
|
|
cpus: '4.0'
|
|
reservations:
|
|
memory: 3G
|
|
cpus: '2.0'
|
|
healthcheck:
|
|
test: ["CMD", "python", "-c", "import psycopg2; psycopg2.connect(host='mvp-platform-vehicles-db', port=5432, database='vehicles', user='mvp_platform_user', password='platform123').close()"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|
|
|
|
# MVP Platform Vehicles Service - API
|
|
mvp-platform-vehicles-api:
|
|
build:
|
|
context: ./mvp-platform-services/vehicles
|
|
dockerfile: docker/Dockerfile.api
|
|
container_name: mvp-platform-vehicles-api
|
|
environment:
|
|
POSTGRES_HOST: mvp-platform-vehicles-db
|
|
POSTGRES_PORT: 5432
|
|
POSTGRES_DATABASE: vehicles
|
|
POSTGRES_USER: mvp_platform_user
|
|
POSTGRES_PASSWORD: platform123
|
|
REDIS_HOST: mvp-platform-vehicles-redis
|
|
REDIS_PORT: 6379
|
|
API_KEY: mvp-platform-vehicles-secret-key
|
|
DEBUG: true
|
|
CORS_ORIGINS: '["http://localhost:3000", "https://motovaultpro.com", "http://localhost:3001"]'
|
|
ports:
|
|
- "8000:8000"
|
|
depends_on:
|
|
- mvp-platform-vehicles-db
|
|
- mvp-platform-vehicles-redis
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
volumes:
|
|
# Platform Services
|
|
platform_postgres_data:
|
|
platform_redis_data:
|
|
|
|
# Admin Tenant (renamed from original)
|
|
admin_postgres_data:
|
|
admin_redis_data:
|
|
admin_minio_data:
|
|
|
|
# Platform Vehicles Service
|
|
platform_vehicles_data:
|
|
platform_vehicles_redis_data:
|
|
platform_vehicles_mssql_data:
|