155 lines
5.1 KiB
YAML
155 lines
5.1 KiB
YAML
# =============================================================================
|
|
# DIDI Platform - Local Data Layer + Keycloak + Kong
|
|
# For 10.11.10.11 build (does NOT touch 10.11.10.12)
|
|
# =============================================================================
|
|
name: didi-infra
|
|
|
|
services:
|
|
# ===========================================================================
|
|
# PostgreSQL - Local (replaces cluster at 10.11.50.167)
|
|
# ===========================================================================
|
|
didi-postgres:
|
|
image: postgres:17-alpine
|
|
container_name: didi-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: DIDI
|
|
POSTGRES_USER: bos_interface
|
|
POSTGRES_PASSWORD: interface
|
|
PGDATA: /var/lib/postgresql/data/pgdata
|
|
volumes:
|
|
- didi-postgres-data:/var/lib/postgresql/data
|
|
- /tmp/didi_full_dump.sql:/docker-entrypoint-initdb.d/01-dump.sql:ro
|
|
ports:
|
|
- "5432:5432"
|
|
networks:
|
|
- didi-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U bos_interface -d DIDI"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
|
|
# ===========================================================================
|
|
# Redis - Cache + Session Store
|
|
# ===========================================================================
|
|
didi-cache:
|
|
image: redis:7-alpine
|
|
container_name: didi-cache
|
|
restart: unless-stopped
|
|
command: redis-server --requirepass redis123
|
|
volumes:
|
|
- didi-redis-data:/data
|
|
ports:
|
|
- "6379:6379"
|
|
networks:
|
|
- didi-network
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "-a", "redis123", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
|
|
# ===========================================================================
|
|
# RabbitMQ - Message Queue
|
|
# ===========================================================================
|
|
staging-dataLayer-rabbitmq:
|
|
image: rabbitmq:3.12-management-alpine
|
|
container_name: staging-dataLayer-rabbitmq
|
|
restart: unless-stopped
|
|
environment:
|
|
RABBITMQ_DEFAULT_USER: admin
|
|
RABBITMQ_DEFAULT_PASS: rabbitmq123
|
|
RABBITMQ_DEFAULT_VHOST: /
|
|
volumes:
|
|
- didi-rabbitmq-data:/var/lib/rabbitmq
|
|
ports:
|
|
- "5672:5672"
|
|
- "15672:15672"
|
|
networks:
|
|
- didi-network
|
|
healthcheck:
|
|
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 60s
|
|
|
|
# ===========================================================================
|
|
# MinIO - Object Storage
|
|
# ===========================================================================
|
|
staging-dataLayer-minio:
|
|
image: minio/minio:RELEASE.2024-08-29T01-40-52Z
|
|
container_name: staging-dataLayer-minio
|
|
restart: unless-stopped
|
|
command: server /data --console-address ":9001"
|
|
environment:
|
|
MINIO_ROOT_USER: minioadmin
|
|
MINIO_ROOT_PASSWORD: minio123
|
|
ports:
|
|
- "9000:9000"
|
|
- "9001:9001"
|
|
volumes:
|
|
- didi-minio-data:/data
|
|
networks:
|
|
- didi-network
|
|
healthcheck:
|
|
test: ["CMD", "mc", "ready", "local"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
# ===========================================================================
|
|
# Keycloak - Local IAM
|
|
# ===========================================================================
|
|
didi-keycloak:
|
|
image: quay.io/keycloak/keycloak:26.0
|
|
container_name: didi-keycloak
|
|
restart: unless-stopped
|
|
command: start-dev --import-realm
|
|
environment:
|
|
KC_DB: postgres
|
|
KC_DB_URL: jdbc:postgresql://didi-postgres:5432/DIDI?currentSchema=public
|
|
KC_DB_USERNAME: bos_interface
|
|
KC_DB_PASSWORD: interface
|
|
KEYCLOAK_ADMIN: admin
|
|
KEYCLOAK_ADMIN_PASSWORD: admin123
|
|
KC_HOSTNAME_STRICT: "false"
|
|
KC_HTTP_ENABLED: "true"
|
|
KC_PROXY_HEADERS: xforwarded
|
|
KC_HTTP_RELATIVE_PATH: /auth
|
|
volumes:
|
|
- ../gateway-auth-layer/didiKeycloak/realm-import:/opt/keycloak/data/import:ro
|
|
- ../gateway-auth-layer/didiKeycloak/themes/didi-clients-theme:/opt/keycloak/themes/didi-clients-theme:ro
|
|
- ../gateway-auth-layer/didiKeycloak/themes/didi-backend-theme:/opt/keycloak/themes/didi-backend-theme:ro
|
|
- ../gateway-auth-layer/didiKeycloak/themes/didi-ai-theme:/opt/keycloak/themes/didi-ai-theme:ro
|
|
ports:
|
|
- "28080:8080"
|
|
depends_on:
|
|
didi-postgres:
|
|
condition: service_healthy
|
|
networks:
|
|
didi-network:
|
|
aliases:
|
|
- keycloak
|
|
# start-dev doesn't open the :9000 management health port, so probe a real
|
|
# served endpoint instead: /auth/realms/master returns 200 when Keycloak is
|
|
# up (valid liveness signal, no --health-enabled needed).
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/8080; echo -e 'GET /auth/realms/master HTTP/1.1\\r\\nHost: localhost\\r\\nConnection: close\\r\\n\\r\\n' >&3; timeout 2 cat <&3 | grep -q '200 OK'"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 60s
|
|
|
|
volumes:
|
|
didi-postgres-data:
|
|
didi-redis-data:
|
|
didi-rabbitmq-data:
|
|
didi-minio-data:
|
|
|
|
networks:
|
|
didi-network:
|
|
external: true
|