fast failover
This commit is contained in:
109
docker-compose.prod.yml
Normal file
109
docker-compose.prod.yml
Normal file
@@ -0,0 +1,109 @@
|
||||
services:
|
||||
phoenix1:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: phoenix1
|
||||
hostname: phoenix1
|
||||
environment:
|
||||
- RELEASE_NODE=backend@phoenix1
|
||||
- RELEASE_DISTRIBUTION=sname
|
||||
- RELEASE_COOKIE=super_secret_cookie_change_in_production
|
||||
- PHX_HOST=localhost
|
||||
- PHX_SERVER=true
|
||||
- PORT=4000
|
||||
- DATABASE_URL=ecto://postgres:postgres@db/backend_dev
|
||||
- SECRET_KEY_BASE=W8nGKNhNR8vKj6A4VnwN5h5h7RZvkKmZPqxqzLzYxXGQqC6HnKp2Wm8MNqKpQxZv
|
||||
- CLUSTER_NODES=backend@phoenix1,backend@phoenix2,backend@phoenix3
|
||||
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
|
||||
ports:
|
||||
- "4001:4000"
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://localhost:4000/api/health"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
phoenix2:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: phoenix2
|
||||
hostname: phoenix2
|
||||
environment:
|
||||
- RELEASE_NODE=backend@phoenix2
|
||||
- RELEASE_DISTRIBUTION=sname
|
||||
- RELEASE_COOKIE=super_secret_cookie_change_in_production
|
||||
- PHX_HOST=localhost
|
||||
- PHX_SERVER=true
|
||||
- PORT=4000
|
||||
- DATABASE_URL=ecto://postgres:postgres@db/backend_dev
|
||||
- SECRET_KEY_BASE=W8nGKNhNR8vKj6A4VnwN5h5h7RZvkKmZPqxqzLzYxXGQqC6HnKp2Wm8MNqKpQxZv
|
||||
- CLUSTER_NODES=backend@phoenix1,backend@phoenix2,backend@phoenix3
|
||||
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
|
||||
ports:
|
||||
- "4002:4000"
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://localhost:4000/api/health"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
phoenix3:
|
||||
build:
|
||||
context: ./backend
|
||||
dockerfile: Dockerfile
|
||||
container_name: phoenix3
|
||||
hostname: phoenix3
|
||||
environment:
|
||||
- RELEASE_NODE=backend@phoenix3
|
||||
- RELEASE_DISTRIBUTION=sname
|
||||
- RELEASE_COOKIE=super_secret_cookie_change_in_production
|
||||
- PHX_HOST=localhost
|
||||
- PHX_SERVER=true
|
||||
- PORT=4000
|
||||
- DATABASE_URL=ecto://postgres:postgres@db/backend_dev
|
||||
- SECRET_KEY_BASE=W8nGKNhNR8vKj6A4VnwN5h5h7RZvkKmZPqxqzLzYxXGQqC6HnKp2Wm8MNqKpQxZv
|
||||
- CLUSTER_NODES=backend@phoenix1,backend@phoenix2,backend@phoenix3
|
||||
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
|
||||
ports:
|
||||
- "4003:4000"
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://localhost:4000/api/health"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
|
||||
nginx-lb:
|
||||
image: nginx:alpine
|
||||
container_name: nginx-lb
|
||||
volumes:
|
||||
- ./nginx-lb.conf:/etc/nginx/conf.d/default.conf
|
||||
ports:
|
||||
- "4000:80"
|
||||
depends_on:
|
||||
- phoenix1
|
||||
- phoenix2
|
||||
- phoenix3
|
||||
|
||||
client:
|
||||
build:
|
||||
context: ./client
|
||||
dockerfile: Dockerfile
|
||||
container_name: client
|
||||
ports:
|
||||
- "5173:80"
|
||||
depends_on:
|
||||
- nginx-lb
|
||||
|
||||
otel-collector:
|
||||
image: otel/opentelemetry-collector-contrib:latest
|
||||
container_name: otel-collector
|
||||
command: ["--config=/etc/otel-collector-config.yaml"]
|
||||
volumes:
|
||||
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
|
||||
ports:
|
||||
- "4318:4318" # OTLP HTTP receiver
|
||||
- "4317:4317" # OTLP gRPC receiver
|
||||
- "8888:8888" # Prometheus metrics
|
||||
- "8889:8889" # Prometheus exporter metrics
|
||||
Reference in New Issue
Block a user