Files
elixir-websocket-testing/docker-compose.yml
2026-02-24 14:39:01 -07:00

122 lines
2.9 KiB
YAML

services:
phoenix1:
build:
context: ./backend
dockerfile: dev.Dockerfile
container_name: phoenix1
hostname: phoenix1
environment:
- PHX_SERVER=true
- PORT=4000
- MIX_ENV=dev
- NODE_NAME=backend@phoenix1
- COOKIE=dev_cookie
- CLUSTER_NODES=backend@phoenix1,backend@phoenix2,backend@phoenix3
user: root
command: |
sh -c '
chown -R elixir:elixir /app/_build
su elixir -c "elixir --sname $${NODE_NAME} --cookie $${COOKIE} -S mix phx.server"
'
volumes:
- ./backend:/app
- /app/_build
ports:
- 4001:4000 # http://localhost:4001/dev/dashboard/
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:4000/api/health"]
interval: 10s
timeout: 5s
retries: 5
phoenix2:
build:
context: ./backend
dockerfile: dev.Dockerfile
container_name: phoenix2
hostname: phoenix2
environment:
- PHX_SERVER=true
- PORT=4000
- MIX_ENV=dev
- NODE_NAME=backend@phoenix2
- COOKIE=dev_cookie
- CLUSTER_NODES=backend@phoenix1,backend@phoenix2,backend@phoenix3
user: root
command: |
sh -c '
chown -R elixir:elixir /app/_build
su elixir -c "elixir --sname $${NODE_NAME} --cookie $${COOKIE} -S mix phx.server"
'
volumes:
- ./backend:/app
- /app/_build
ports:
- 4002:4000
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:4000/api/health"]
interval: 10s
timeout: 5s
retries: 5
phoenix3:
build:
context: ./backend
dockerfile: dev.Dockerfile
container_name: phoenix3
hostname: phoenix3
environment:
- PHX_SERVER=true
- PORT=4000
- MIX_ENV=dev
- NODE_NAME=backend@phoenix3
- COOKIE=dev_cookie
- CLUSTER_NODES=backend@phoenix1,backend@phoenix2,backend@phoenix3
user: root
command: |
sh -c '
chown -R elixir:elixir /app/_build
su elixir -c "elixir --sname $${NODE_NAME} --cookie $${COOKIE} -S mix phx.server"
'
volumes:
- ./backend:/app
- /app/_build
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: dev.Dockerfile
container_name: client
volumes:
- ./client:/app
ports:
- 5173:5173
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