k8s redesign complete
This commit is contained in:
@@ -12,21 +12,18 @@ services:
|
||||
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
|
||||
- ./certs:/etc/nginx/certs:ro
|
||||
depends_on:
|
||||
- mvp-platform-tenants
|
||||
- mvp-platform-tenants
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -s http://localhost:3000 || exit 1"]
|
||||
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
|
||||
@@ -37,17 +34,20 @@ services:
|
||||
AUTH0_DOMAIN: ${AUTH0_DOMAIN:-motovaultpro.us.auth0.com}
|
||||
AUTH0_AUDIENCE: ${AUTH0_AUDIENCE:-https://api.motovaultpro.com}
|
||||
ports:
|
||||
- "8001:8000"
|
||||
- 8001:8000
|
||||
depends_on:
|
||||
- platform-postgres
|
||||
- platform-redis
|
||||
- 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\""]
|
||||
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
|
||||
@@ -55,33 +55,35 @@ services:
|
||||
POSTGRES_DB: platform
|
||||
POSTGRES_USER: platform_user
|
||||
POSTGRES_PASSWORD: ${PLATFORM_DB_PASSWORD:-platform123}
|
||||
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
|
||||
POSTGRES_INITDB_ARGS: --encoding=UTF8
|
||||
volumes:
|
||||
- platform_postgres_data:/var/lib/postgresql/data
|
||||
- ./mvp-platform-services/tenants/sql/schema:/docker-entrypoint-initdb.d
|
||||
- platform_postgres_data:/var/lib/postgresql/data
|
||||
- ./mvp-platform-services/tenants/sql/schema:/docker-entrypoint-initdb.d
|
||||
ports:
|
||||
- "5434:5432"
|
||||
- 5434:5432
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U platform_user -d platform"]
|
||||
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
|
||||
- platform_redis_data:/data
|
||||
ports:
|
||||
- "6381:6379"
|
||||
- 6381:6379
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
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
|
||||
@@ -89,31 +91,34 @@ services:
|
||||
POSTGRES_DB: motovaultpro
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: localdev123
|
||||
POSTGRES_INITDB_ARGS: "--encoding=UTF8"
|
||||
POSTGRES_INITDB_ARGS: --encoding=UTF8
|
||||
volumes:
|
||||
- admin_postgres_data:/var/lib/postgresql/data
|
||||
- admin_postgres_data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "5432:5432"
|
||||
- 5432:5432
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
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
|
||||
- admin_redis_data:/data
|
||||
ports:
|
||||
- "6379:6379"
|
||||
- 6379:6379
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
test:
|
||||
- CMD
|
||||
- redis-cli
|
||||
- ping
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
admin-minio:
|
||||
image: minio/minio:latest
|
||||
container_name: admin-minio
|
||||
@@ -122,22 +127,25 @@ services:
|
||||
MINIO_ROOT_USER: minioadmin
|
||||
MINIO_ROOT_PASSWORD: minioadmin123
|
||||
volumes:
|
||||
- admin_minio_data:/data
|
||||
- admin_minio_data:/data
|
||||
ports:
|
||||
- "9000:9000" # API
|
||||
- "9001:9001" # Console
|
||||
- 9000:9000
|
||||
- 9001:9001
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
||||
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
|
||||
- node:20-alpine
|
||||
container_name: admin-backend
|
||||
environment:
|
||||
TENANT_ID: ${TENANT_ID:-admin}
|
||||
@@ -164,27 +172,29 @@ services:
|
||||
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"
|
||||
- 3001:3001
|
||||
depends_on:
|
||||
- admin-postgres
|
||||
- admin-redis
|
||||
- admin-minio
|
||||
- mvp-platform-vehicles-api
|
||||
- mvp-platform-tenants
|
||||
- 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))\""]
|
||||
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
|
||||
context: ./frontend
|
||||
dockerfile: Dockerfile
|
||||
cache_from:
|
||||
- node:20-alpine
|
||||
- nginx:alpine
|
||||
- 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}
|
||||
@@ -197,54 +207,70 @@ services:
|
||||
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
|
||||
- ./certs:/etc/nginx/certs:ro
|
||||
depends_on:
|
||||
- admin-backend
|
||||
- admin-backend
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "curl -s http://localhost:3000 || exit 1"]
|
||||
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
|
||||
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"
|
||||
POSTGRES_INITDB_ARGS: --encoding=UTF8
|
||||
volumes:
|
||||
- platform_vehicles_data:/var/lib/postgresql/data
|
||||
- ./mvp-platform-services/vehicles/sql/schema:/docker-entrypoint-initdb.d
|
||||
- platform_vehicles_data:/var/lib/postgresql/data
|
||||
- ./mvp-platform-services/vehicles/sql/schema:/docker-entrypoint-initdb.d
|
||||
ports:
|
||||
- "5433:5432"
|
||||
- 5433:5432
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
@@ -254,91 +280,28 @@ services:
|
||||
memory: 4G
|
||||
cpus: '4.0'
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U mvp_platform_user -d vehicles"]
|
||||
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
|
||||
- platform_vehicles_redis_data:/data
|
||||
ports:
|
||||
- "6380:6379"
|
||||
- 6380:6379
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
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
|
||||
@@ -356,28 +319,50 @@ services:
|
||||
DEBUG: true
|
||||
CORS_ORIGINS: '["http://localhost:3000", "https://motovaultpro.com", "http://localhost:3001"]'
|
||||
ports:
|
||||
- "8000:8000"
|
||||
- 8000:8000
|
||||
depends_on:
|
||||
- mvp-platform-vehicles-db
|
||||
- mvp-platform-vehicles-redis
|
||||
- mvp-platform-vehicles-db
|
||||
- mvp-platform-vehicles-redis
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8000/health"]
|
||||
test:
|
||||
- CMD
|
||||
- wget
|
||||
- --quiet
|
||||
- --tries=1
|
||||
- --spider
|
||||
- http://localhost:8000/health
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 30s
|
||||
|
||||
nginx-proxy:
|
||||
image: nginx:alpine
|
||||
container_name: nginx-proxy
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
volumes:
|
||||
- ./nginx-proxy/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- ./certs:/etc/nginx/certs:ro
|
||||
depends_on:
|
||||
- mvp-platform-landing
|
||||
- admin-frontend
|
||||
- admin-backend
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test:
|
||||
- CMD
|
||||
- nginx
|
||||
- -t
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
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:
|
||||
platform_postgres_data: null
|
||||
platform_redis_data: null
|
||||
admin_postgres_data: null
|
||||
admin_redis_data: null
|
||||
admin_minio_data: null
|
||||
platform_vehicles_data: null
|
||||
platform_vehicles_redis_data: null
|
||||
platform_vehicles_mssql_data: null
|
||||
|
||||
Reference in New Issue
Block a user