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

+3
View File
@@ -0,0 +1,3 @@
**
!server.login/build/install/server.login/**
!server.game/build/install/server.game/**
+17 -2
View File
@@ -6,17 +6,32 @@ LOGIN_DB_PORT=20011
LOGIN_DB_NAME=openmmo_login_db LOGIN_DB_NAME=openmmo_login_db
LOGIN_DB_USER=openmmo_login_user LOGIN_DB_USER=openmmo_login_user
LOGIN_DB_PASSWORD=changeMe! LOGIN_DB_PASSWORD=changeMe!
LOGIN_DB_SEED_DEV=true # Off by default. The gradle run task turns it on without this.
#LOGIN_DB_SEED_DEV=true
GAME_DB_HOST=localhost GAME_DB_HOST=localhost
GAME_DB_PORT=20021 GAME_DB_PORT=20021
GAME_DB_NAME=openmmo_game_db GAME_DB_NAME=openmmo_game_db
GAME_DB_USER=openmmo_game_user GAME_DB_USER=openmmo_game_user
GAME_DB_PASSWORD=changeMe! GAME_DB_PASSWORD=changeMe!
GAME_DB_SEED_DEV=true #GAME_DB_SEED_DEV=true
OPENMMO_SESSION_SECRET= OPENMMO_SESSION_SECRET=
# Created on first start, and only while the user table is still empty.
#OPENMMO_ADMIN_USERNAME=admin
#OPENMMO_ADMIN_PASSWORD=changeMe!
# Where the login server tells a client to reach the game server. Unset means this machine only,
# and an empty value is not the same as unset, it overrides the default with nothing.
#GAME_SERVER_PUBLIC_IPV4=203.0.113.5
#GAME_SERVER_PUBLIC_IPV6=2001:db8::1
#GAME_SERVER_PORT=7777
# Retail sends loopback for these whatever the addresses above are. Only for experimenting.
#GAME_SERVER_LOCAL_ADDRESS=127.0.0.1
#GAME_SERVER_LOCAL_HOSTNAME=localhost
# Private key for both servers. Leave empty for development, set one in production. # Private key for both servers. Leave empty for development, set one in production.
OPENMMO_GAME_PRIVATE_KEY= OPENMMO_GAME_PRIVATE_KEY=
OPENMMO_GAME_PRIVATE_KEY_FILE= OPENMMO_GAME_PRIVATE_KEY_FILE=
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Jar members are listed because a key has only ever travelled inside one, never loose.
set -euo pipefail
found=$(
find server.login/build/install server.game/build/install -type f
find server.login/build/install server.game/build/install -name '*.jar' -exec unzip -Z1 {} \;
for archive in server.login/build/distributions/*.tar server.game/build/distributions/*.tar; do
if [ -f "$archive" ]; then tar -tf "$archive"; fi
done
)
if grep -q '\.pem$' <<<"$found"; then
echo "::error::a published artifact bundles a key"
grep '\.pem$' <<<"$found"
exit 1
fi
echo "No keys in $(grep -c . <<<"$found") packaged entries."
+94
View File
@@ -0,0 +1,94 @@
name: Dev images
on:
push:
branches: [ "master" ]
permissions:
contents: read
packages: write
# Only the newest master is worth an image, so supersede a run still in flight.
concurrency:
group: dev-images-${{ github.ref }}
cancel-in-progress: true
jobs:
publish:
name: Publish dev server images
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
submodules: recursive
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "25"
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v6
# No ROMs on the runner, so dialog ids are placeholders.
- name: Build distributions
run: ./gradlew :server.login:installDist :server.game:installDist
- name: Check no keys are bundled
run: bash .github/scripts/check-no-keys.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to the GitHub container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Describe the login server image
id: login-image
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository_owner }}/openmmo-login
flavor: latest=false
labels: org.opencontainers.image.title=OpenMMO login server
annotations: org.opencontainers.image.title=OpenMMO login server
tags: |
type=raw,value=dev
type=sha,format=short
- name: Publish the login server image
uses: docker/build-push-action@v7
with:
context: .
file: server.login/Dockerfile
push: true
tags: ${{ steps.login-image.outputs.tags }}
labels: ${{ steps.login-image.outputs.labels }}
annotations: ${{ steps.login-image.outputs.annotations }}
- name: Describe the game server image
id: game-image
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository_owner }}/openmmo-game
flavor: latest=false
labels: org.opencontainers.image.title=OpenMMO game server
annotations: org.opencontainers.image.title=OpenMMO game server
tags: |
type=raw,value=dev
type=sha,format=short
- name: Publish the game server image
uses: docker/build-push-action@v7
with:
context: .
file: server.game/Dockerfile
push: true
tags: ${{ steps.game-image.outputs.tags }}
labels: ${{ steps.game-image.outputs.labels }}
annotations: ${{ steps.game-image.outputs.annotations }}
+63 -11
View File
@@ -31,10 +31,13 @@ jobs:
manifest-file: .release-please-manifest.json manifest-file: .release-please-manifest.json
publish: publish:
name: Publish server distributions name: Publish server distributions and images
needs: release-please needs: release-please
if: needs.release-please.outputs.released == 'true' if: needs.release-please.outputs.released == 'true'
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps: steps:
- name: Checkout the release tag - name: Checkout the release tag
uses: actions/checkout@v7 uses: actions/checkout@v7
@@ -53,19 +56,14 @@ jobs:
# No ROMs on the runner, so dialog ids are placeholders. # No ROMs on the runner, so dialog ids are placeholders.
- name: Build distributions - name: Build distributions
run: ./gradlew :server.login:assembleDist :server.game:assembleDist run: >
./gradlew :server.login:assembleDist :server.game:assembleDist
:server.login:installDist :server.game:installDist
- name: Check no keys are bundled - name: Check no keys are bundled
run: | run: bash .github/scripts/check-no-keys.sh
found=$(tar -tf server.login/build/distributions/*.tar \
&& tar -tf server.game/build/distributions/*.tar)
if grep -q '\.pem$' <<<"$found"; then
echo "::error::a distribution bundles a key"
grep '\.pem$' <<<"$found"
exit 1
fi
echo "No keys in the distributions."
# Before the images, so a registry failure cannot leave a tagged release with no archives.
- name: Attach distributions to the release - name: Attach distributions to the release
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -74,3 +72,57 @@ jobs:
server.login/build/distributions/* \ server.login/build/distributions/* \
server.game/build/distributions/* \ server.game/build/distributions/* \
--clobber --clobber
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to the GitHub container registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Describe the login server image
id: login-image
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository_owner }}/openmmo-login
flavor: latest=true
labels: org.opencontainers.image.title=OpenMMO login server
annotations: org.opencontainers.image.title=OpenMMO login server
tags: |
type=semver,pattern={{version}},value=${{ needs.release-please.outputs.tag }}
type=semver,pattern={{major}}.{{minor}},value=${{ needs.release-please.outputs.tag }}
- name: Publish the login server image
uses: docker/build-push-action@v7
with:
context: .
file: server.login/Dockerfile
push: true
tags: ${{ steps.login-image.outputs.tags }}
labels: ${{ steps.login-image.outputs.labels }}
annotations: ${{ steps.login-image.outputs.annotations }}
- name: Describe the game server image
id: game-image
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository_owner }}/openmmo-game
flavor: latest=true
labels: org.opencontainers.image.title=OpenMMO game server
annotations: org.opencontainers.image.title=OpenMMO game server
tags: |
type=semver,pattern={{version}},value=${{ needs.release-please.outputs.tag }}
type=semver,pattern={{major}}.{{minor}},value=${{ needs.release-please.outputs.tag }}
- name: Publish the game server image
uses: docker/build-push-action@v7
with:
context: .
file: server.game/Dockerfile
push: true
tags: ${{ steps.game-image.outputs.tags }}
labels: ${{ steps.game-image.outputs.labels }}
annotations: ${{ steps.game-image.outputs.annotations }}
+72 -2
View File
@@ -65,6 +65,35 @@ For local-only tweaks to the container setup, create a
Docker Compose merges it automatically on `docker compose up`. Docker Compose merges it automatically on `docker compose up`.
For deployment,supply a proper `.env` and run `docker compose -f docker-compose.yml up -d` to skip any override. For deployment,supply a proper `.env` and run `docker compose -f docker-compose.yml up -d` to skip any override.
### Game server address
The login server hands the client an address to reach the game server on. It
defaults to loopback, which serves a client on that same machine and nothing
else. Set `GAME_SERVER_PUBLIC_IPV4` for anything reachable from elsewhere,
`GAME_SERVER_PUBLIC_IPV6` if you serve one, and `GAME_SERVER_PORT` if it is not
7777. That is the whole of it for a normal deployment.
The same response also carries a local address and hostname, which every capture
of the retail server has as `127.0.0.1` and `localhost` no matter how public the
addresses beside them are. `GAME_SERVER_LOCAL_ADDRESS` and
`GAME_SERVER_LOCAL_HOSTNAME` exist to experiment with that, not to be pointed at
your public address.
An empty value is not the same as an unset one. It replaces the default with
nothing, and the server refuses to start rather than advertising an address no
client can reach.
### First account
A fresh login database has no users in it at all. Set `OPENMMO_ADMIN_USERNAME`
and `OPENMMO_ADMIN_PASSWORD` and the server creates that account on startup,
but only while the user table is still empty. It never touches an account that
already exists, so changing either value later does nothing and is not a way to
reset a password. Leave both unset and no account is created.
The password is stored as unsalted SHA-1, because that is what the client sends
and the server only ever compares what arrives.
### Server key ### Server key
Both servers share one private key. A local build generates it, so development Both servers share one private key. A local build generates it, so development
@@ -87,8 +116,49 @@ that do not.
breaking change bumps the minor version instead of jumping to `1.0.0`. breaking change bumps the minor version instead of jumping to `1.0.0`.
Every push to `master` opens or updates a release pull request. Merging it tags Every push to `master` opens or updates a release pull request. Merging it tags
the release and attaches the server archives. The version lives in the release and attaches the server archives. It also publishes a container
`gradle.properties` and applies to every module, do not edit it by hand. image per server, under the release version, its `major.minor` line and
`latest`:
```bash
docker pull ghcr.io/openmmo-org/openmmo-login:latest
docker pull ghcr.io/openmmo-org/openmmo-game:latest
```
Every push to `master` publishes a `dev` image alongside those, so `dev` is
always the current default branch rather than the last release. Each one also
gets a `sha-<short commit>` tag, which is what to pin when a build needs to stay
put. These are built from whatever was pushed and do not wait for the test suite,
so `dev` can be broken in a way `latest` is not.
```bash
docker pull ghcr.io/openmmo-org/openmmo-game:dev
```
`deploy/` holds a Compose stack per server, each with its own database, taking
the `dev` images by default. Copy `deploy/.env.example`, fill it in, and bring
the game side up first:
```bash
docker compose --env-file .env -f game.compose.yml up -d
docker compose --env-file .env -f login.compose.yml up -d
```
The private key is mounted as a Compose secret, so the file has to be readable
by uid 10001, which is what the servers run as. Only `2106` and `7777` are
published, and neither database is.
An image carries no keys and no `.env`, so pass the database settings, the
session secret, the private key and the game server address as environment
variables. Build one yourself with:
```bash
./gradlew :server.login:installDist
docker build -f server.login/Dockerfile -t openmmo-login .
```
The version lives in `gradle.properties` and applies to every module, do not
edit it by hand.
## Wiki ## Wiki
+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:
+16
View File
@@ -0,0 +1,16 @@
# Needs `./gradlew :server.game:installDist` to have run first.
FROM eclipse-temurin:25-jre-noble
RUN groupadd --gid 10001 openmmo \
&& useradd --no-log-init --uid 10001 --gid openmmo --home-dir /opt/openmmo \
--shell /usr/sbin/nologin openmmo
WORKDIR /opt/openmmo
COPY server.game/build/install/server.game/lib/ lib/
COPY --chmod=755 server.game/build/install/server.game/bin/ bin/
ENV JAVA_TOOL_OPTIONS="-XX:MaxRAMPercentage=75"
USER 10001:10001
EXPOSE 7777
ENTRYPOINT ["/opt/openmmo/bin/server.game"]
+2 -2
View File
@@ -40,9 +40,9 @@ tasks.named<JavaExec>("run") {
"GAME_DB_PORT", "GAME_DB_PORT",
"GAME_DB_NAME", "GAME_DB_NAME",
"GAME_DB_USER", "GAME_DB_USER",
"GAME_DB_PASSWORD", "GAME_DB_PASSWORD")
"GAME_DB_SEED_DEV")
.forEach { key -> env.fetchOrNull(key)?.let { environment(key, it) } } .forEach { key -> env.fetchOrNull(key)?.let { environment(key, it) } }
environment("GAME_DB_SEED_DEV", env.fetchOrNull("GAME_DB_SEED_DEV") ?: "true")
} }
listOf("classes", "processResources").forEach { taskName -> listOf("classes", "processResources").forEach { taskName ->
@@ -7,7 +7,7 @@ data class DbConfig(
val user: String = "openmmo_game_user", val user: String = "openmmo_game_user",
val password: String = "changeMe!", val password: String = "changeMe!",
val poolSize: Int = 4, val poolSize: Int = 4,
val seedDev: Boolean = true, val seedDev: Boolean = false,
) { ) {
val jdbcUrl: String val jdbcUrl: String
get() = "jdbc:postgresql://$host:$port/$name" get() = "jdbc:postgresql://$host:$port/$name"
@@ -24,7 +24,8 @@ db {
password = ${?GAME_DB_PASSWORD} password = ${?GAME_DB_PASSWORD}
poolSize = 4 poolSize = 4
poolSize = ${?GAME_DB_POOL_SIZE} poolSize = ${?GAME_DB_POOL_SIZE}
# Applies the dev seed data in db/dev. Turn off in production. # Applies the dev seed data in db/dev, including the admin account. The gradle run task turns
seedDev = true # this on, so a plain launch of a built distribution never seeds.
seedDev = false
seedDev = ${?GAME_DB_SEED_DEV} seedDev = ${?GAME_DB_SEED_DEV}
} }
@@ -6,6 +6,7 @@ import de.fiereu.openmmo.common.hasPermission
import de.fiereu.openmmo.server.game.config.ConfigLoader import de.fiereu.openmmo.server.game.config.ConfigLoader
import de.fiereu.openmmo.server.game.testsupport.FakeCharacterRepository import de.fiereu.openmmo.server.game.testsupport.FakeCharacterRepository
import io.kotest.core.spec.style.FunSpec import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.collections.shouldBeEmpty
import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldBe
import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest import kotlinx.coroutines.test.runTest
@@ -13,7 +14,18 @@ import kotlinx.coroutines.test.runTest
@OptIn(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
class DevCharacterSeederTest : class DevCharacterSeederTest :
FunSpec({ FunSpec({
val config = ConfigLoader.load() val loaded = ConfigLoader.load()
val config = loaded.copy(db = loaded.db.copy(seedDev = true))
test("the shipped config does not seed, whatever the caller does") {
runTest {
val store = CharacterStore(FakeCharacterRepository(), EntityIdService(), backgroundScope)
DevCharacterSeeder(store, loaded).seed()
store.getCharactersByUser(1).shouldBeEmpty()
}
}
test("seeds one developer character per region on its new game start") { test("seeds one developer character per region on its new game start") {
runTest { runTest {
+16
View File
@@ -0,0 +1,16 @@
# Needs `./gradlew :server.login:installDist` to have run first.
FROM eclipse-temurin:25-jre-noble
RUN groupadd --gid 10001 openmmo \
&& useradd --no-log-init --uid 10001 --gid openmmo --home-dir /opt/openmmo \
--shell /usr/sbin/nologin openmmo
WORKDIR /opt/openmmo
COPY server.login/build/install/server.login/lib/ lib/
COPY --chmod=755 server.login/build/install/server.login/bin/ bin/
ENV JAVA_TOOL_OPTIONS="-XX:MaxRAMPercentage=75"
USER 10001:10001
EXPOSE 2106
ENTRYPOINT ["/opt/openmmo/bin/server.login"]
+9 -2
View File
@@ -33,13 +33,20 @@ dependencies {
tasks.named<JavaExec>("run") { tasks.named<JavaExec>("run") {
listOf( listOf(
"OPENMMO_SESSION_SECRET", "OPENMMO_SESSION_SECRET",
"OPENMMO_ADMIN_USERNAME",
"OPENMMO_ADMIN_PASSWORD",
"GAME_SERVER_PUBLIC_IPV4",
"GAME_SERVER_PUBLIC_IPV6",
"GAME_SERVER_PORT",
"GAME_SERVER_LOCAL_ADDRESS",
"GAME_SERVER_LOCAL_HOSTNAME",
"LOGIN_DB_HOST", "LOGIN_DB_HOST",
"LOGIN_DB_PORT", "LOGIN_DB_PORT",
"LOGIN_DB_NAME", "LOGIN_DB_NAME",
"LOGIN_DB_USER", "LOGIN_DB_USER",
"LOGIN_DB_PASSWORD", "LOGIN_DB_PASSWORD")
"LOGIN_DB_SEED_DEV")
.forEach { key -> env.fetchOrNull(key)?.let { environment(key, it) } } .forEach { key -> env.fetchOrNull(key)?.let { environment(key, it) } }
environment("LOGIN_DB_SEED_DEV", env.fetchOrNull("LOGIN_DB_SEED_DEV") ?: "true")
} }
listOf("classes", "processResources").forEach { taskName -> listOf("classes", "processResources").forEach { taskName ->
@@ -2,10 +2,12 @@ package de.fiereu.openmmo.server.login
import de.fiereu.openmmo.server.login.config.ConfigLoader import de.fiereu.openmmo.server.login.config.ConfigLoader
import de.fiereu.openmmo.server.login.di.DaggerLoginServerComponent import de.fiereu.openmmo.server.login.di.DaggerLoginServerComponent
import kotlinx.coroutines.runBlocking
fun main() { fun main() {
val config = ConfigLoader.load() val config = ConfigLoader.load()
val component = DaggerLoginServerComponent.factory().create(config) val component = DaggerLoginServerComponent.factory().create(config)
component.databaseBootstrap().migrate() component.databaseBootstrap().migrate()
runBlocking { component.adminAccountBootstrap().ensureAdmin() }
component.server().start() component.server().start()
} }
@@ -0,0 +1,28 @@
package de.fiereu.openmmo.server.login.auth
import de.fiereu.openmmo.server.login.config.LoginServerConfig
import io.github.oshai.kotlinlogging.KotlinLogging
import javax.inject.Inject
import javax.inject.Singleton
private val log = KotlinLogging.logger {}
@Singleton
class AdminAccountBootstrap
@Inject
constructor(
private val users: UserService,
private val config: LoginServerConfig,
) {
/**
* Creates the configured account on a database that holds no user at all. It never touches an
* existing one, so a changed password in the config does not reset the account it created.
*/
suspend fun ensureAdmin() {
val admin = config.admin ?: return
if (users.hasAnyUser()) return
val id = users.addUser(admin.username, admin.password)
log.info { "Created '${admin.username}' as the first account, user $id" }
}
}
@@ -42,7 +42,10 @@ constructor(
.fetchOne(USERS.ID) .fetchOne(USERS.ID)
} }
suspend fun addUser(username: String, password: String): Int = override suspend fun hasAnyUser(): Boolean =
withContext(dispatcher) { dsl.fetchExists(dsl.selectFrom(USERS)) }
override suspend fun addUser(username: String, password: String): Int =
withContext(dispatcher) { withContext(dispatcher) {
dsl.insertInto(USERS) dsl.insertInto(USERS)
.set(USERS.USERNAME, username.lowercase()) .set(USERS.USERNAME, username.lowercase())
@@ -24,6 +24,11 @@ interface UserService {
suspend fun getUserId(username: String): Int? suspend fun getUserId(username: String): Int?
suspend fun findForToken(userId: Int): TokenUser? suspend fun findForToken(userId: Int): TokenUser?
suspend fun hasAnyUser(): Boolean
/** Takes the plain password and hashes it the way the client would before sending. */
suspend fun addUser(username: String, password: String): Int
} }
@Suppress("kotlin:S4790") @Suppress("kotlin:S4790")
@@ -44,11 +49,15 @@ class InMemoryUserStore @Inject constructor() : UserService {
private val nextId = AtomicInteger(1) private val nextId = AtomicInteger(1)
init { init {
addUser("admin", "admin") put("admin", "admin")
addUser("test", "test") put("test", "test")
} }
fun addUser(username: String, password: String): Int { override suspend fun hasAnyUser(): Boolean = users.isNotEmpty()
override suspend fun addUser(username: String, password: String): Int = put(username, password)
private fun put(username: String, password: String): Int {
val id = nextId.getAndIncrement() val id = nextId.getAndIncrement()
users[username.lowercase()] = UserInfo(id, sha1Hex(password), username) users[username.lowercase()] = UserInfo(id, sha1Hex(password), username)
return id return id
@@ -1,10 +1,9 @@
package de.fiereu.openmmo.server.login.catalog package de.fiereu.openmmo.server.login.catalog
import com.github.maltalex.ineter.base.IPAddress import com.github.maltalex.ineter.base.IPAddress
import com.github.maltalex.ineter.base.IPv4Address
import com.github.maltalex.ineter.base.IPv6Address
import de.fiereu.openmmo.net.login.packets.GameServer import de.fiereu.openmmo.net.login.packets.GameServer
import de.fiereu.openmmo.net.login.packets.GameServerNode import de.fiereu.openmmo.net.login.packets.GameServerNode
import de.fiereu.openmmo.server.login.config.GameServerEndpointConfig
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
@@ -16,7 +15,7 @@ data class GameServerEntry(
) )
@Singleton @Singleton
class GameServerCatalog @Inject constructor() { class GameServerCatalog @Inject constructor(endpoint: GameServerEndpointConfig) {
private val entries: List<GameServerEntry> = private val entries: List<GameServerEntry> =
listOf( listOf(
GameServerEntry( GameServerEntry(
@@ -30,13 +29,13 @@ class GameServerCatalog @Inject constructor() {
), ),
node = node =
GameServerNode( GameServerNode(
iPv4Address = IPv4Address.of("127.0.0.1"), iPv4Address = endpoint.ipv4Address,
iPv6Address = IPv6Address.of("::1"), iPv6Address = endpoint.ipv6Address,
port = 7777u, port = endpoint.port.toUShort(),
weight = 0x01u, weight = 0x01u,
), ),
localAddress = IPAddress.of("127.0.0.1"), localAddress = endpoint.localAddress,
localHostname = "localhost", localHostname = endpoint.localHostname,
), ),
) )
@@ -0,0 +1,16 @@
package de.fiereu.openmmo.server.login.config
private const val USERNAME_COLUMN_LENGTH = 32
data class AdminAccountConfig(val username: String, val password: String) {
init {
require(username.isNotBlank()) { "server.admin.username must not be blank" }
require(username.length <= USERNAME_COLUMN_LENGTH) {
"server.admin.username is longer than $USERNAME_COLUMN_LENGTH characters"
}
require(password.isNotBlank()) { "server.admin.password must not be blank" }
}
// Without this the generated one puts the password in any log line that prints the config.
override fun toString(): String = "AdminAccountConfig(username=$username)"
}
@@ -1,11 +1,23 @@
package de.fiereu.openmmo.server.login.config package de.fiereu.openmmo.server.login.config
import com.github.maltalex.ineter.base.IPAddress
import com.github.maltalex.ineter.base.IPv4Address
import com.github.maltalex.ineter.base.IPv6Address
import com.typesafe.config.Config import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory import com.typesafe.config.ConfigFactory
private fun Config.stringOrNull(path: String): String? = private fun Config.stringOrNull(path: String): String? =
if (hasPath(path)) getString(path) else null if (hasPath(path)) getString(path) else null
private fun adminAccount(config: Config): AdminAccountConfig? {
val username = config.stringOrNull("server.admin.username").orEmpty().trim()
val password = config.stringOrNull("server.admin.password").orEmpty()
if (username.isEmpty() && password.isBlank()) return null
require(username.isNotEmpty()) { "server.admin.password is set without server.admin.username" }
require(password.isNotBlank()) { "server.admin.username is set without server.admin.password" }
return AdminAccountConfig(username, password)
}
object ConfigLoader { object ConfigLoader {
fun load(): LoginServerConfig { fun load(): LoginServerConfig {
val config = ConfigFactory.load() val config = ConfigFactory.load()
@@ -34,6 +46,15 @@ object ConfigLoader {
poolSize = config.getInt("db.poolSize"), poolSize = config.getInt("db.poolSize"),
seedDev = config.getBoolean("db.seedDev"), seedDev = config.getBoolean("db.seedDev"),
), ),
gameServer =
GameServerEndpointConfig(
ipv4Address = IPv4Address.of(config.getString("gameServer.ipv4Address")),
ipv6Address = IPv6Address.of(config.getString("gameServer.ipv6Address")),
port = config.getInt("gameServer.port"),
localAddress = IPAddress.of(config.getString("gameServer.localAddress")),
localHostname = config.getString("gameServer.localHostname"),
),
admin = adminAccount(config),
) )
} }
} }
@@ -7,7 +7,7 @@ data class DbConfig(
val user: String = "openmmo_login_user", val user: String = "openmmo_login_user",
val password: String = "changeMe!", val password: String = "changeMe!",
val poolSize: Int = 4, val poolSize: Int = 4,
val seedDev: Boolean = true, val seedDev: Boolean = false,
) { ) {
val jdbcUrl: String val jdbcUrl: String
get() = "jdbc:postgresql://$host:$port/$name" get() = "jdbc:postgresql://$host:$port/$name"
@@ -0,0 +1,19 @@
package de.fiereu.openmmo.server.login.config
import com.github.maltalex.ineter.base.IPAddress
import com.github.maltalex.ineter.base.IPv4Address
import com.github.maltalex.ineter.base.IPv6Address
/** Retail sends loopback for [localAddress] and [localHostname] whatever the nodes are. */
data class GameServerEndpointConfig(
val ipv4Address: IPv4Address = IPv4Address.of("127.0.0.1"),
val ipv6Address: IPv6Address = IPv6Address.of("::1"),
val port: Int = 7777,
val localAddress: IPAddress = IPv4Address.of("127.0.0.1"),
val localHostname: String = "localhost",
) {
init {
require(port in 1..UShort.MAX_VALUE.toInt()) { "gameServer.port is out of range: $port" }
require(localHostname.isNotBlank()) { "gameServer.localHostname must not be blank" }
}
}
@@ -10,6 +10,8 @@ data class LoginServerConfig(
val sessionSecret: ByteArray, val sessionSecret: ByteArray,
val rememberMeMaxAge: Duration = Duration.ofDays(30), val rememberMeMaxAge: Duration = Duration.ofDays(30),
val db: DbConfig = DbConfig(), val db: DbConfig = DbConfig(),
val gameServer: GameServerEndpointConfig = GameServerEndpointConfig(),
val admin: AdminAccountConfig? = null,
val rootKey: String? = null, val rootKey: String? = null,
val rootKeyFile: String? = null, val rootKeyFile: String? = null,
) { ) {
@@ -23,7 +25,9 @@ data class LoginServerConfig(
rootKeyFile == other.rootKeyFile && rootKeyFile == other.rootKeyFile &&
sessionSecret.contentEquals(other.sessionSecret) && sessionSecret.contentEquals(other.sessionSecret) &&
rememberMeMaxAge == other.rememberMeMaxAge && rememberMeMaxAge == other.rememberMeMaxAge &&
db == other.db db == other.db &&
gameServer == other.gameServer &&
admin == other.admin
override fun hashCode(): Int { override fun hashCode(): Int {
var h = host.hashCode() var h = host.hashCode()
@@ -35,6 +39,8 @@ data class LoginServerConfig(
h = h * 31 + sessionSecret.contentHashCode() h = h * 31 + sessionSecret.contentHashCode()
h = h * 31 + rememberMeMaxAge.hashCode() h = h * 31 + rememberMeMaxAge.hashCode()
h = h * 31 + db.hashCode() h = h * 31 + db.hashCode()
h = h * 31 + gameServer.hashCode()
h = h * 31 + admin.hashCode()
return h return h
} }
} }
@@ -3,6 +3,7 @@ package de.fiereu.openmmo.server.login.di
import dagger.BindsInstance import dagger.BindsInstance
import dagger.Component import dagger.Component
import de.fiereu.openmmo.server.login.LoginServer import de.fiereu.openmmo.server.login.LoginServer
import de.fiereu.openmmo.server.login.auth.AdminAccountBootstrap
import de.fiereu.openmmo.server.login.config.LoginServerConfig import de.fiereu.openmmo.server.login.config.LoginServerConfig
import de.fiereu.openmmo.server.login.db.DatabaseBootstrap import de.fiereu.openmmo.server.login.db.DatabaseBootstrap
import de.fiereu.openmmo.server.login.handler.LoginAppHandler import de.fiereu.openmmo.server.login.handler.LoginAppHandler
@@ -19,6 +20,8 @@ interface LoginServerComponent {
fun databaseBootstrap(): DatabaseBootstrap fun databaseBootstrap(): DatabaseBootstrap
fun adminAccountBootstrap(): AdminAccountBootstrap
@Component.Factory @Component.Factory
fun interface Factory { fun interface Factory {
fun create(@BindsInstance config: LoginServerConfig): LoginServerComponent fun create(@BindsInstance config: LoginServerConfig): LoginServerComponent
@@ -12,6 +12,7 @@ import de.fiereu.openmmo.common.io.PemKeyLoader
import de.fiereu.openmmo.common.io.pemStream import de.fiereu.openmmo.common.io.pemStream
import de.fiereu.openmmo.server.login.auth.JooqUserStore import de.fiereu.openmmo.server.login.auth.JooqUserStore
import de.fiereu.openmmo.server.login.auth.UserService import de.fiereu.openmmo.server.login.auth.UserService
import de.fiereu.openmmo.server.login.config.GameServerEndpointConfig
import de.fiereu.openmmo.server.login.config.LoginServerConfig import de.fiereu.openmmo.server.login.config.LoginServerConfig
import io.netty.channel.EventLoopGroup import io.netty.channel.EventLoopGroup
import io.netty.channel.MultiThreadIoEventLoopGroup import io.netty.channel.MultiThreadIoEventLoopGroup
@@ -40,6 +41,10 @@ abstract class LoginServerModule {
PemKeyLoader.loadEcPrivate( PemKeyLoader.loadEcPrivate(
pemStream(config.rootKey, config.rootKeyFile, config.rootKeyResource)) pemStream(config.rootKey, config.rootKeyFile, config.rootKeyResource))
@Provides
@Singleton
fun gameServerEndpoint(config: LoginServerConfig): GameServerEndpointConfig = config.gameServer
@Provides @Provides
@Singleton @Singleton
fun tokenIssuer(config: LoginServerConfig): SessionTokenIssuer = fun tokenIssuer(config: LoginServerConfig): SessionTokenIssuer =
@@ -10,6 +10,26 @@ server {
# Idle window for a remember me token. Every token login issues a fresh one. # Idle window for a remember me token. Every token login issues a fresh one.
rememberMeMaxAge = 30d rememberMeMaxAge = 30d
rememberMeMaxAge = ${?OPENMMO_REMEMBER_ME_MAX_AGE} rememberMeMaxAge = ${?OPENMMO_REMEMBER_ME_MAX_AGE}
# Creates this account when both are set and the database holds no user at all. Never resets
# an existing password, so changing these later does nothing.
admin {
username = ${?OPENMMO_ADMIN_USERNAME}
password = ${?OPENMMO_ADMIN_PASSWORD}
}
}
gameServer {
ipv4Address = "127.0.0.1"
ipv4Address = ${?GAME_SERVER_PUBLIC_IPV4}
ipv6Address = "::1"
ipv6Address = ${?GAME_SERVER_PUBLIC_IPV6}
port = 7777
port = ${?GAME_SERVER_PORT}
# Loopback in every retail capture, whatever the addresses above are. Not what a client dials.
localAddress = "127.0.0.1"
localAddress = ${?GAME_SERVER_LOCAL_ADDRESS}
localHostname = "localhost"
localHostname = ${?GAME_SERVER_LOCAL_HOSTNAME}
} }
db { db {
@@ -25,7 +45,8 @@ db {
password = ${?LOGIN_DB_PASSWORD} password = ${?LOGIN_DB_PASSWORD}
poolSize = 4 poolSize = 4
poolSize = ${?LOGIN_DB_POOL_SIZE} poolSize = ${?LOGIN_DB_POOL_SIZE}
# Applies the dev seed data in db/dev. Turn off in production. # Applies the dev seed data in db/dev, including the admin account. The gradle run task turns
seedDev = true # this on, so a plain launch of a built distribution never seeds.
seedDev = false
seedDev = ${?LOGIN_DB_SEED_DEV} seedDev = ${?LOGIN_DB_SEED_DEV}
} }
@@ -0,0 +1,110 @@
package de.fiereu.openmmo.server.login.auth
import de.fiereu.openmmo.common.enums.LoginState
import de.fiereu.openmmo.server.login.config.AdminAccountConfig
import de.fiereu.openmmo.server.login.config.LoginServerConfig
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
import java.security.MessageDigest
import kotlinx.coroutines.test.runTest
private class EmptyUserStore : UserService {
val added = mutableListOf<Pair<String, String>>()
private var users = 0
override suspend fun authenticate(username: String, password: String) =
UserService.AuthResult(LoginState.INVALID_PASSWORD)
override suspend fun getUserId(username: String): Int? = null
override suspend fun findForToken(userId: Int): UserService.TokenUser? = null
override suspend fun hasAnyUser(): Boolean = users > 0
override suspend fun addUser(username: String, password: String): Int {
added += username to password
return ++users
}
}
private fun config(admin: AdminAccountConfig?) =
LoginServerConfig(
host = "127.0.0.1",
port = 2106,
checksumSize = 16,
rootKeyResource = "game.private.pem",
sessionSecret = ByteArray(32),
admin = admin,
)
class AdminAccountBootstrapTest :
FunSpec({
test("creates the configured account when the database holds nobody") {
runTest {
val users = EmptyUserStore()
AdminAccountBootstrap(users, config(AdminAccountConfig("root", "hunter2"))).ensureAdmin()
users.added shouldBe listOf("root" to "hunter2")
}
}
test("creates nobody when the config names nobody") {
runTest {
val users = EmptyUserStore()
AdminAccountBootstrap(users, config(null)).ensureAdmin()
users.added shouldBe emptyList()
}
}
test("leaves a populated database alone, so a changed password is not a reset") {
runTest {
val users = EmptyUserStore()
users.addUser("someone", "their-password")
users.added.clear()
AdminAccountBootstrap(users, config(AdminAccountConfig("root", "hunter2"))).ensureAdmin()
users.added shouldBe emptyList()
}
}
test("running twice adds one account, not two") {
runTest {
val users = EmptyUserStore()
val bootstrap = AdminAccountBootstrap(users, config(AdminAccountConfig("root", "pw")))
bootstrap.ensureAdmin()
bootstrap.ensureAdmin()
users.added shouldBe listOf("root" to "pw")
}
}
test("the store hashes the password the way the client sends it") {
runTest {
val store = InMemoryUserStore()
store.addUser("root", "hunter2")
val sha1 =
MessageDigest.getInstance("SHA-1").digest("hunter2".toByteArray()).joinToString("") {
"%02x".format(it)
}
store.authenticate("root", sha1).state shouldBe LoginState.AUTHED
}
}
test("a blank or oversized username is refused before it reaches the database") {
runCatching { AdminAccountConfig("", "pw") }.isFailure shouldBe true
runCatching { AdminAccountConfig("a".repeat(33), "pw") }.isFailure shouldBe true
runCatching { AdminAccountConfig("root", " ") }.isFailure shouldBe true
}
test("the password stays out of the string form that would reach a log") {
AdminAccountConfig("root", "hunter2").toString() shouldBe
"AdminAccountConfig(username=root)"
}
})
@@ -0,0 +1,59 @@
package de.fiereu.openmmo.server.login.catalog
import com.github.maltalex.ineter.base.IPAddress
import com.github.maltalex.ineter.base.IPv4Address
import com.github.maltalex.ineter.base.IPv6Address
import de.fiereu.openmmo.server.login.config.GameServerEndpointConfig
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
class GameServerCatalogTest :
FunSpec({
test("an unconfigured server is only reachable from the machine it runs on") {
val entry = GameServerCatalog(GameServerEndpointConfig()).find(0x00u)!!
entry.node.iPv4Address shouldBe IPv4Address.of("127.0.0.1")
entry.node.iPv6Address shouldBe IPv6Address.of("::1")
entry.node.port shouldBe 7777u
entry.localAddress shouldBe IPAddress.of("127.0.0.1")
entry.localHostname shouldBe "localhost"
}
test("the advertised endpoint is what the config says") {
val endpoint =
GameServerEndpointConfig(
ipv4Address = IPv4Address.of("203.0.113.5"),
ipv6Address = IPv6Address.of("2001:db8::1"),
port = 7000,
localHostname = "game.example.test",
)
val entry = GameServerCatalog(endpoint).find(0x00u)!!
entry.node.iPv4Address shouldBe IPv4Address.of("203.0.113.5")
entry.node.iPv6Address shouldBe IPv6Address.of("2001:db8::1")
entry.node.port shouldBe 7000u
entry.localHostname shouldBe "game.example.test"
}
test("a public node address leaves the local pair on loopback, as retail sends it") {
val endpoint = GameServerEndpointConfig(ipv4Address = IPv4Address.of("203.0.113.5"))
endpoint.localAddress shouldBe IPAddress.of("127.0.0.1")
endpoint.localHostname shouldBe "localhost"
}
test("a port off the wire's range is refused rather than truncated") {
shouldThrow<IllegalArgumentException> { GameServerEndpointConfig(port = 70000) }
shouldThrow<IllegalArgumentException> { GameServerEndpointConfig(port = 0) }
}
test("a blank hostname is refused") {
shouldThrow<IllegalArgumentException> { GameServerEndpointConfig(localHostname = " ") }
}
test("an unknown server id has no entry") {
GameServerCatalog(GameServerEndpointConfig()).find(0x7Fu) shouldBe null
}
})
@@ -0,0 +1,46 @@
package de.fiereu.openmmo.server.login.config
import com.github.maltalex.ineter.base.IPAddress
import com.github.maltalex.ineter.base.IPv4Address
import com.typesafe.config.ConfigFactory
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe
class ConfigLoaderTest :
FunSpec({
test("the shipped config carries the loopback endpoint") {
val endpoint = ConfigLoader.load().gameServer
endpoint.ipv4Address shouldBe IPv4Address.of("127.0.0.1")
endpoint.port shouldBe 7777
endpoint.localAddress shouldBe IPAddress.of("127.0.0.1")
endpoint.localHostname shouldBe "localhost"
}
test("a public node address does not drag the local one off loopback") {
val config =
ConfigFactory.parseString("gameServer.ipv4Address = \"203.0.113.5\"")
.withFallback(ConfigFactory.parseResources("application.conf"))
.resolve()
config.getString("gameServer.localAddress") shouldBe "127.0.0.1"
config.getString("gameServer.localHostname") shouldBe "localhost"
}
test("no admin account is configured out of the box") {
ConfigLoader.load().admin shouldBe null
}
test("the local address is still settable for anyone testing what the client does with it") {
val config =
ConfigFactory.parseString(
"""
gameServer.ipv4Address = "203.0.113.5"
gameServer.localAddress = "10.0.0.2"
""")
.withFallback(ConfigFactory.parseResources("application.conf"))
.resolve()
config.getString("gameServer.localAddress") shouldBe "10.0.0.2"
}
})
@@ -21,6 +21,7 @@ import de.fiereu.openmmo.net.login.packets.TokenLogin
import de.fiereu.openmmo.server.login.auth.InMemoryUserStore import de.fiereu.openmmo.server.login.auth.InMemoryUserStore
import de.fiereu.openmmo.server.login.auth.sha1Hex import de.fiereu.openmmo.server.login.auth.sha1Hex
import de.fiereu.openmmo.server.login.catalog.GameServerCatalog import de.fiereu.openmmo.server.login.catalog.GameServerCatalog
import de.fiereu.openmmo.server.login.config.GameServerEndpointConfig
import de.fiereu.openmmo.server.login.config.LoginServerConfig import de.fiereu.openmmo.server.login.config.LoginServerConfig
import de.fiereu.openmmo.server.login.di.DaggerLoginServerComponent import de.fiereu.openmmo.server.login.di.DaggerLoginServerComponent
import de.fiereu.openmmo.server.login.session.AUTHED_USER_ID import de.fiereu.openmmo.server.login.session.AUTHED_USER_ID
@@ -112,7 +113,7 @@ class LoginAppHandlerTest :
): LoginAppHandler = ): LoginAppHandler =
LoginAppHandler( LoginAppHandler(
users = users, users = users,
catalog = GameServerCatalog(), catalog = GameServerCatalog(GameServerEndpointConfig()),
tokenIssuer = SessionTokenIssuer(secret, clock), tokenIssuer = SessionTokenIssuer(secret, clock),
rememberMeIssuer = RememberMeTokenIssuer(secret, clock), rememberMeIssuer = RememberMeTokenIssuer(secret, clock),
rememberMeVerifier = RememberMeTokenVerifier(secret, maxAge, clock), rememberMeVerifier = RememberMeTokenVerifier(secret, maxAge, clock),