101 lines
2.6 KiB
YAML
101 lines
2.6 KiB
YAML
services:
|
|
db:
|
|
image: postgres:17
|
|
environment:
|
|
POSTGRES_USER: elixir_ai
|
|
POSTGRES_PASSWORD: elixir_ai
|
|
POSTGRES_DB: elixir_ai_dev
|
|
command: postgres -c hba_file=/etc/postgresql/pg_hba.conf
|
|
volumes:
|
|
- ./postgres/schema/:/docker-entrypoint-initdb.d/
|
|
- ./postgres/pg_hba.conf:/etc/postgresql/pg_hba.conf
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U elixir_ai -d elixir_ai_dev"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
node1:
|
|
build:
|
|
context: .
|
|
dockerfile: dev.Dockerfile
|
|
container_name: node1
|
|
hostname: node1
|
|
env_file: .env
|
|
environment:
|
|
DATABASE_URL: ecto://elixir_ai:elixir_ai@db/elixir_ai_dev
|
|
PHX_HOST: localhost
|
|
PHX_SERVER: "true"
|
|
PORT: 4000
|
|
MIX_ENV: dev
|
|
RELEASE_NODE: elixir_ai@node1
|
|
RELEASE_COOKIE: secret_cluster_cookie
|
|
SECRET_KEY_BASE: F1nY5uSyD0HfoWejcuuQiaQoMQrjrlFigb3bJ7p4hTXwpTza6sPLpmd+jLS7p0Sh
|
|
user: root
|
|
command: |
|
|
sh -c '
|
|
chown -R elixir:elixir /app/_build
|
|
chown -R elixir:elixir /app/deps
|
|
su elixir -c "elixir --sname elixir_ai@node1 --cookie secret_cluster_cookie -S mix phx.server"
|
|
'
|
|
volumes:
|
|
- .:/app
|
|
- /app/_build
|
|
ports:
|
|
- "4001:4000"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:4000/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
node2:
|
|
build:
|
|
context: .
|
|
dockerfile: dev.Dockerfile
|
|
container_name: node2
|
|
hostname: node2
|
|
env_file: .env
|
|
environment:
|
|
DATABASE_URL: ecto://elixir_ai:elixir_ai@db/elixir_ai_dev
|
|
PHX_HOST: localhost
|
|
PHX_SERVER: "true"
|
|
PORT: 4000
|
|
MIX_ENV: dev
|
|
RELEASE_NODE: elixir_ai@node2
|
|
RELEASE_COOKIE: secret_cluster_cookie
|
|
SECRET_KEY_BASE: F1nY5uSyD0HfoWejcuuQiaQoMQrjrlFigb3bJ7p4hTXwpTza6sPLpmd+jLS7p0Sh
|
|
user: root
|
|
command: |
|
|
sh -c '
|
|
chown -R elixir:elixir /app/_build
|
|
chown -R elixir:elixir /app/deps
|
|
su elixir -c "elixir --sname elixir_ai@node2 --cookie secret_cluster_cookie -S mix phx.server"
|
|
'
|
|
volumes:
|
|
- .:/app
|
|
- /app/_build
|
|
ports:
|
|
- "4002:4000"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:4000/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
ports:
|
|
- "8080:80"
|
|
volumes:
|
|
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf:ro
|
|
depends_on:
|
|
- node1
|
|
- node2
|