mirror of
https://github.com/Mezeporta/Erupe.git
synced 2026-03-21 23:22:34 +01:00
Replace 4 independent schema management code paths (Docker shell script, setup wizard pg_restore, test helpers, manual psql) with a single migration runner embedded in the server binary. The new server/migrations/ package uses Go embed to bundle all SQL schemas. On startup, Migrate() creates a schema_version tracking table, detects existing databases (auto-marks baseline as applied), and runs pending migrations in transactions. Key changes: - Consolidated init.sql + 9.2-update + 33 patches into 0001_init.sql - Setup wizard simplified to single "Apply schema" checkbox - Test helpers use migrations.Migrate() instead of pg_restore - Docker no longer needs schema volume mounts or init script - Seed data (shops, events, gacha) embedded and applied via API - Future migrations just add 0002_*.sql files — no manual steps
67 lines
1.8 KiB
YAML
67 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/
|
|
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
|