mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-22 07:32:32 +01:00
Allow Docker to distinguish a running container from one actually serving traffic by adding a /health endpoint that pings the database. Returns 200 when healthy, 503 when the DB connection is lost. Add HEALTHCHECK to Dockerfile and healthcheck config to the server service in docker-compose.yml. Also add start_period to the existing db healthcheck for consistency.
69 lines
1.8 KiB
YAML
69 lines
1.8 KiB
YAML
# 1. Copy config.example.json to docker/config.json and edit it
|
|
# (set Database.Host to "db", adjust password to match below)
|
|
# 2. Place quest/scenario files in docker/bin/
|
|
# 3. docker compose up
|
|
services:
|
|
db:
|
|
image: postgres:18-alpine
|
|
environment:
|
|
# Change this password and match it in docker/config.json
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=password
|
|
- POSTGRES_DB=erupe
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- ./db-data/:/var/lib/postgresql/
|
|
- ../schemas/:/schemas/
|
|
- ./init/setup.sh:/docker-entrypoint-initdb.d/setup.sh
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
start_period: 5s
|
|
retries: 5
|
|
pgadmin:
|
|
image: dpage/pgadmin4
|
|
restart: always
|
|
environment:
|
|
PGADMIN_DEFAULT_EMAIL: user@pgadmin.com
|
|
PGADMIN_DEFAULT_PASSWORD: password
|
|
ports:
|
|
- "5050:80"
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
server:
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
image: ghcr.io/mezeporta/erupe:main
|
|
# To build locally instead of using the prebuilt image, comment out
|
|
# the 'image' line above and uncomment the 'build' section below:
|
|
# build:
|
|
# context: ../
|
|
volumes:
|
|
- ./config.json:/app/config.json
|
|
- ./bin:/app/bin
|
|
- ./savedata:/app/savedata
|
|
ports:
|
|
# (Make sure these match config.json)
|
|
- "53312:53312" #Sign V1
|
|
- "8080:8080" #Sign V2
|
|
- "53310:53310" #Entrance
|
|
# Channels
|
|
- "54001:54001"
|
|
- "54002:54002"
|
|
- "54003:54003"
|
|
- "54004:54004"
|
|
- "54005:54005"
|
|
- "54006:54006"
|
|
- "54007:54007"
|
|
- "54008:54008"
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:8080/health"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
start_period: 15s
|
|
retries: 3
|