feat(server): make both servers deployable as container images (#147)

This commit is contained in:
LananaHWP authored and GitHub committed 2026-08-10 17:05:02 +02:00
1 parent 70449971cb
commit aba1226794
33 files changed
+825 -40

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
# Copy to `.env` next to this file and replace every value. Both stacks need the same
# session secret and the same private key, and the key file has to be readable by uid 10001.
#
# docker compose --env-file .env -f game.compose.yml up -d
# docker compose --env-file .env -f login.compose.yml up -d
# The head of the default branch, rebuilt on every push and not gated on the test suite.
OPENMMO_LOGIN_IMAGE=ghcr.io/openmmo-org/openmmo-login:dev
OPENMMO_GAME_IMAGE=ghcr.io/openmmo-org/openmmo-game:dev
# Swap for the last release, or a sha- tag to pin a build that stops moving:
#OPENMMO_LOGIN_IMAGE=ghcr.io/openmmo-org/openmmo-login:latest
#OPENMMO_GAME_IMAGE=ghcr.io/openmmo-org/openmmo-game:latest
OPENMMO_SESSION_SECRET=replace-with-a-long-random-value
OPENMMO_GAME_PRIVATE_KEY_PATH=/srv/openmmo/game.private.pem
# Created on first start, and only while the user table is still empty. Changing either later
# does nothing, so treat this as bootstrap rather than as a way to reset a password.
OPENMMO_ADMIN_USERNAME=admin
OPENMMO_ADMIN_PASSWORD=replace-with-a-random-password
# The address the login server hands to clients, so it has to be the public one.
GAME_SERVER_PUBLIC_IPV4=203.0.113.10
# Leave alone without public IPv6. A v4-only host has nothing useful to put here.
#GAME_SERVER_PUBLIC_IPV6=2001:db8::1
GAME_SERVER_PORT=7777
LOGIN_DB_NAME=openmmo_login_db
LOGIN_DB_USER=openmmo_login_user
LOGIN_DB_PASSWORD=replace-with-a-random-password
GAME_DB_NAME=openmmo_game_db
GAME_DB_USER=openmmo_game_user
GAME_DB_PASSWORD=replace-with-another-random-password
+48
View File
@@ -0,0 +1,48 @@
name: openmmo-game
services:
database:
image: postgres:18
restart: unless-stopped
environment:
POSTGRES_DB: ${GAME_DB_NAME:-openmmo_game_db}
POSTGRES_USER: ${GAME_DB_USER:-openmmo_game_user}
POSTGRES_PASSWORD: ${GAME_DB_PASSWORD:?Set GAME_DB_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
volumes:
- database:/var/lib/postgresql
server:
image: ${OPENMMO_GAME_IMAGE:-ghcr.io/openmmo-org/openmmo-game:dev}
pull_policy: always
restart: unless-stopped
# The shutdown hook flushes characters for up to 10s, which is docker's whole default budget.
stop_grace_period: 30s
depends_on:
database:
condition: service_healthy
environment:
GAME_DB_HOST: database
GAME_DB_PORT: 5432
GAME_DB_NAME: ${GAME_DB_NAME:-openmmo_game_db}
GAME_DB_USER: ${GAME_DB_USER:-openmmo_game_user}
GAME_DB_PASSWORD: ${GAME_DB_PASSWORD:?Set GAME_DB_PASSWORD}
GAME_DB_SEED_DEV: ${GAME_DB_SEED_DEV:-false}
OPENMMO_SESSION_SECRET: ${OPENMMO_SESSION_SECRET:?Set OPENMMO_SESSION_SECRET}
OPENMMO_GAME_PRIVATE_KEY_FILE: /run/secrets/game.private.pem
ports:
- "7777:7777/tcp"
secrets:
- source: game_private_key
target: game.private.pem
secrets:
game_private_key:
file: ${OPENMMO_GAME_PRIVATE_KEY_PATH:?Set OPENMMO_GAME_PRIVATE_KEY_PATH}
volumes:
database:
+51
View File
@@ -0,0 +1,51 @@
name: openmmo-login
services:
database:
image: postgres:18
restart: unless-stopped
environment:
POSTGRES_DB: ${LOGIN_DB_NAME:-openmmo_login_db}
POSTGRES_USER: ${LOGIN_DB_USER:-openmmo_login_user}
POSTGRES_PASSWORD: ${LOGIN_DB_PASSWORD:?Set LOGIN_DB_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
volumes:
- database:/var/lib/postgresql
server:
image: ${OPENMMO_LOGIN_IMAGE:-ghcr.io/openmmo-org/openmmo-login:dev}
pull_policy: always
restart: unless-stopped
depends_on:
database:
condition: service_healthy
environment:
LOGIN_DB_HOST: database
LOGIN_DB_PORT: 5432
LOGIN_DB_NAME: ${LOGIN_DB_NAME:-openmmo_login_db}
LOGIN_DB_USER: ${LOGIN_DB_USER:-openmmo_login_user}
LOGIN_DB_PASSWORD: ${LOGIN_DB_PASSWORD:?Set LOGIN_DB_PASSWORD}
LOGIN_DB_SEED_DEV: ${LOGIN_DB_SEED_DEV:-false}
OPENMMO_SESSION_SECRET: ${OPENMMO_SESSION_SECRET:?Set OPENMMO_SESSION_SECRET}
OPENMMO_ADMIN_USERNAME: ${OPENMMO_ADMIN_USERNAME:-}
OPENMMO_ADMIN_PASSWORD: ${OPENMMO_ADMIN_PASSWORD:-}
OPENMMO_GAME_PRIVATE_KEY_FILE: /run/secrets/game.private.pem
GAME_SERVER_PUBLIC_IPV4: ${GAME_SERVER_PUBLIC_IPV4:?Set GAME_SERVER_PUBLIC_IPV4}
GAME_SERVER_PUBLIC_IPV6: "${GAME_SERVER_PUBLIC_IPV6:-::1}"
GAME_SERVER_PORT: ${GAME_SERVER_PORT:-7777}
ports:
- "2106:2106/tcp"
secrets:
- source: game_private_key
target: game.private.pem
secrets:
game_private_key:
file: ${OPENMMO_GAME_PRIVATE_KEY_PATH:?Set OPENMMO_GAME_PRIVATE_KEY_PATH}
volumes:
database: