Commit Graph

18 Commits

Author SHA1 Message Date
Houmgaor
27fb0faa1e feat(db): add embedded auto-migrating schema system
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
2026-02-23 21:19:21 +01:00
Houmgaor
a72ac43f1d feat(api): add /health endpoint with Docker healthchecks
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.
2026-02-23 20:34:20 +01:00
Houmgaor
b96cd0904b fix: ease onboarding with startup warnings and doc corrections
- Warn at startup when quest files are missing (clients crash without
  them) and point users to the download link
- Fix Host config description: it's the advertised IP, not a bind
  address — 0.0.0.0 was wrong advice
- Load bundled schemas (shops, events, gacha) in Docker init so new
  users get working demo data out of the box
- Renumber duplicate patch schema 28 → 32 to resolve numbering
  collision
- Fix patch schema example filename to use hyphens matching actual
  files
2026-02-23 20:23:08 +01:00
Houmgaor
2d4f9aeefa fix(docker): correct volume mount paths to match container WORKDIR
The Dockerfile sets WORKDIR to /app but docker-compose.yml mounted
volumes to /app/erupe/, causing "config not found" on startup.

Closes #162
2026-02-22 22:42:08 +01:00
Houmgaor
486be65a38 fix(protbot,channelserver): fix sign protocol and entrance parsing, guard nil save data
The protbot sent "DSGN:\x00" as the sign request type, but the server
strips the last 3 characters as a version suffix. Send "DSGN:041"
(ZZ client mode 41) to match the real client format.

The entrance channel entry parser read 14 bytes for remaining fields
but the server writes 18 bytes (9 uint16, not 7), causing a panic
when parsing the server list.

The channel server panicked on disconnect when a session had no
decompressed save data (e.g. protbot or early client disconnect).
Guard Save() against nil decompSave.

Also fix docker-compose volume mount for Postgres 18 which changed
its data directory layout.
2026-02-20 14:17:40 +01:00
Houmgaor
a8f70df1fb fix: clean up Docker setup (compose, README, gitignore)
- Remove deprecated version field from docker-compose.yml
- Pin Postgres to 18-alpine (matches existing db-data)
- Remove undocumented web (Apache) service
- Fix config/bin volume mounts to use docker/ directory
- Gitignore docker/savedata, docker/bin, docker/config.json
- Rewrite docker/README.md: fix typos, use docker compose V2
  commands, match actual compose file behavior
- Link docker/README.md from main README Docker section
2026-02-17 15:16:57 +01:00
Houmgaor
7d54dd0ee6 ci: add Docker CD workflow to push images to GHCR
Multi-stage Dockerfile for smaller runtime image, CD workflow triggers
on main branch pushes and version tags, docker-compose defaults to the
prebuilt GHCR image.
2026-02-17 00:28:37 +01:00
Houmgaor
4c3810df7e fix: Docker DB init fails due to pg_restore error on existing database (#129)
pg_restore would fail because the dump contains CREATE DATABASE but
POSTGRES_DB already creates it. With set -e this aborted the script
before update/patch schemas could run.

- Allow pg_restore to continue past non-fatal errors
- Add --no-owner --no-acl to avoid permission mismatches
- Force LF line endings for .sh files via .gitattributes
- Quote file path variables in schema loops
2026-02-16 22:53:09 +01:00
Houmgaor
36065ce273 fix(plate data): was not save, nor transmog data. 2025-11-01 18:14:30 +01:00
Houmgaor
25d218fbcd tests(integration): more complete tests with integration of a test database, 2025-10-27 11:58:12 +01:00
Houmgaor
f410cbd48b chore: minor files update. 2025-10-18 18:57:16 +02:00
stratic-dev
ae32951671 Add troubleshooting for setup on docker and add opcode dec and hex to logger 2024-10-05 22:56:53 +01:00
nageld
5342dc4df1 reference the bin and config in the root directory so they don't need to be duplicated in docker folder 2024-03-23 14:19:23 -04:00
nageld
a10ecf2a11 update init path 2024-03-23 14:17:14 -04:00
stratic-dev
851301b088 Updated readme and added init schemas to folder 2024-01-26 17:59:34 +00:00
stratic-dev
abe4744587 Added db init script. Combined all schemas under schemas. Persisted
updates and init
2024-01-24 04:35:24 +00:00
stratic-dev
76e62c6af2 Added readme and comments to docker-compose 2024-01-22 22:35:45 +00:00
stratic-dev
4a7f7b8041 Added docker and docker-compose 2024-01-22 20:06:40 +00:00