Files
project-carrier/replication_service/docker-compose.yml
2026-03-29 23:24:15 +09:00

84 lines
2.1 KiB
YAML

version: '3.8'
services:
# PostgreSQL база для хранения конфигурации и логов репликации
postgres:
image: postgres:15-alpine
container_name: replication-postgres
environment:
POSTGRES_DB: replication_db
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres_password
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- replication-network
# Основной сервис репликации
replication-service:
build:
context: .
dockerfile: Dockerfile
container_name: replication-service
environment:
# MSSQL Connection
MSSQL_SERVER: ${MSSQL_SERVER:-mssql}
MSSQL_DATABASE: ${MSSQL_DATABASE:-production_db}
MSSQL_USERNAME: ${MSSQL_USERNAME:-sa}
MSSQL_PASSWORD: ${MSSQL_PASSWORD:-YourPassword123!}
MSSQL_PORT: ${MSSQL_PORT:-1433}
# PostgreSQL Connection
POSTGRES_HOST: postgres
POSTGRES_DATABASE: replication_db
POSTGRES_USERNAME: postgres
POSTGRES_PASSWORD: postgres_password
POSTGRES_PORT: 5432
# Redis (optional)
REDIS_HOST: ${REDIS_HOST:-localhost}
REDIS_PORT: ${REDIS_PORT:-6379}
ports:
- "8000:8000"
depends_on:
postgres:
condition: service_healthy
volumes:
- ./logs:/app/logs
networks:
- replication-network
restart: unless-stopped
command: uvicorn main:app --host 0.0.0.0 --port 8000
# Redis для кэширования и сессий (optional)
redis:
image: redis:7-alpine
container_name: replication-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
networks:
- replication-network
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
volumes:
postgres_data:
redis_data:
networks:
replication-network:
driver: bridge