This commit is contained in:
kento2 2026-08-19 19:12:32 +02:00
parent 8f29a4f56d
commit b7623bab85
8 changed files with 60 additions and 32 deletions

View file

@ -13,6 +13,12 @@ RUN curl -s "https://fill.papermc.io/v3/projects/paper/versions/$MINECRAFT_VERSI
| jq -r '.downloads."server:default".url' \
| xargs curl -o server.jar
RUN wget -P /data/plugins \
https://git.lab0x13.site/api/packages/scrow/generic/core-bukkit/UNVERSIONED/CoreBukkit.jar \
https://download.luckperms.net/1652/bukkit/loader/LuckPerms-Bukkit-5.5.65.jar \
https://hangarcdn.papermc.io/plugins/ViaVersion/ViaVersion/versions/5.11.0/PAPER/ViaVersion-5.11.0.jar \
https://hangarcdn.papermc.io/plugins/ViaVersion/ViaBackwards/versions/5.11.0/PAPER/ViaBackwards-5.11.0.jar
RUN printf eula=true > eula.txt
RUN java -jar server.jar --initSettings

11
jobs/README.minecraft.md Normal file
View file

@ -0,0 +1,11 @@
we reuse the same minecraft job/service for all gamemodes and the lobby.
the following variables are supported:
- mode(<string>, required): name of the gamemode to run. this is used to advertise.
- image(<string>, required): image to use, something based on papermc normally.
- plugins(<list(string)>, optional): space-separated list of URLs to download to the plugins folder.
We use images to make gamemode specific changes cause else we'd need a lot of
variables and it'd just become a mess. we still need the plugins variable cause
we don't want to rebuild our images every time we release a new update.
our plugins also are usually unversioned, so we'd break reproducability if we'd
fetch them in the images directly.

View file

@ -1,4 +1,20 @@
job "lobby" {
variable "mode" {
type = string
description = "gamemode to advertise as; e.g. lobby or bedwars"
}
variable "image" {
type = string
description = "docker image to use"
}
variable "plugins" {
type = list(string)
description = "list of URLs to download to the plugins directory"
default = []
}
job "minecraft" {
type = "service"
group "lobby" {
@ -15,10 +31,10 @@ job "lobby" {
}
service {
name = "lobby"
name = var.mode
port = "minecraft"
address_mode = "alloc"
tags = ["minecraft"]
tags = ["minecraft", var.mode]
check {
type = "tcp"
interval = "5s"
@ -26,41 +42,22 @@ job "lobby" {
}
}
ephemeral_disk {
size = 5000 # 5 gb
}
task "download-plugins" {
driver = "docker"
lifecycle {
hook = "prestart"
sidecar = false
}
config {
image = "busybox"
command = "sh"
volumes = ["../alloc/data:/mnt"]
args = [
"-xec",
<<-EOF
mkdir -p /mnt/plugins
wget -P /mnt/plugins \
https://git.lab0x13.site/api/packages/scrow/generic/core-bukkit/UNVERSIONED/CoreBukkit.jar
EOF
]
}
}
task "run" {
driver = "docker"
dynamic "artifact" {
for_each = var.plugins
content {
source = artifact.value
destination = "local/plugins"
}
}
config {
image = "git.lab0x13.site/scrow/papermc:0.2"
image = var.image
force_pull = false
ports = ["minecraft"]
volumes = ["../alloc/data:/mnt"]
volumes = ["local:/mnt"]
}
env {

View file

@ -0,0 +1,5 @@
mode = "lobby"
image = "git.lab0x13.site/scrow/papermc:0.2"
plugins = [
"https://git.lab0x13.site/api/packages/scrow/generic/core-bukkit/UNVERSIONED/CoreBukkit.jar",
]

9
minigame/run Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
set -eu
varfile="${1:-}"
test -n "$varfile" || {
printf 'usage: %s VARFILE\n' "$0"
exit 1
}
nomad job run -var-file "$varfile" ../jobs/minecraft.nomad.hcl