mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(docker): add docker-compose configuration for PostgreSQL, Redis, EZ-API, and Balancer services
This commit is contained in:
82
docker-compose.yml
Normal file
82
docker-compose.yml
Normal file
@@ -0,0 +1,82 @@
|
||||
services:
|
||||
# 1. PostgreSQL Database
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
container_name: ez-postgres
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||
POSTGRES_DB: ${POSTGRES_DB}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- ez-network
|
||||
|
||||
# 2. Redis Cache
|
||||
redis:
|
||||
image: redis:7-alpine
|
||||
container_name: ez-redis
|
||||
command: redis-server --appendonly yes
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "ping"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
networks:
|
||||
- ez-network
|
||||
|
||||
# 3. EZ-API (Control Plane)
|
||||
ez-api:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
container_name: ez-api
|
||||
ports:
|
||||
- "${EZ_API_PORT}:${EZ_API_PORT}"
|
||||
environment:
|
||||
EZ_API_PORT: ${EZ_API_PORT}
|
||||
EZ_PG_DSN: ${EZ_PG_DSN}
|
||||
EZ_REDIS_ADDR: ${EZ_REDIS_ADDR}
|
||||
EZ_REDIS_PASSWORD: ${EZ_REDIS_PASSWORD}
|
||||
EZ_REDIS_DB: ${EZ_REDIS_DB}
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- ez-network
|
||||
|
||||
# 4. Balancer (Data Plane / Gateway)
|
||||
balancer:
|
||||
build:
|
||||
context: ../balancer
|
||||
dockerfile: Dockerfile
|
||||
container_name: ez-balancer
|
||||
ports:
|
||||
- "${EZ_BALANCER_PORT}:${EZ_BALANCER_PORT}"
|
||||
environment:
|
||||
EZ_BALANCER_PORT: ${EZ_BALANCER_PORT}
|
||||
EZ_REDIS_ADDR: ${EZ_REDIS_ADDR}
|
||||
EZ_REDIS_PASSWORD: ${EZ_REDIS_PASSWORD}
|
||||
EZ_REDIS_DB: ${EZ_REDIS_DB}
|
||||
depends_on:
|
||||
redis:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- ez-network
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
redis_data:
|
||||
|
||||
networks:
|
||||
ez-network:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user