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

+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_NAME",
"GAME_DB_USER",
"GAME_DB_PASSWORD",
"GAME_DB_SEED_DEV")
"GAME_DB_PASSWORD")
.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 ->
@@ -7,7 +7,7 @@ data class DbConfig(
val user: String = "openmmo_game_user",
val password: String = "changeMe!",
val poolSize: Int = 4,
val seedDev: Boolean = true,
val seedDev: Boolean = false,
) {
val jdbcUrl: String
get() = "jdbc:postgresql://$host:$port/$name"
@@ -24,7 +24,8 @@ db {
password = ${?GAME_DB_PASSWORD}
poolSize = 4
poolSize = ${?GAME_DB_POOL_SIZE}
# Applies the dev seed data in db/dev. Turn off in production.
seedDev = true
# Applies the dev seed data in db/dev, including the admin account. The gradle run task turns
# this on, so a plain launch of a built distribution never seeds.
seedDev = false
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.testsupport.FakeCharacterRepository
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.collections.shouldBeEmpty
import io.kotest.matchers.shouldBe
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runTest
@@ -13,7 +14,18 @@ import kotlinx.coroutines.test.runTest
@OptIn(ExperimentalCoroutinesApi::class)
class DevCharacterSeederTest :
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") {
runTest {