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

74
jobs/minecraft.nomad.hcl Normal file
View file

@ -0,0 +1,74 @@
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" {
count = 1
network {
mode = "bridge"
port "minecraft" {
to = 25565
}
dns {
servers = ["172.17.0.1"]
}
}
service {
name = var.mode
port = "minecraft"
address_mode = "alloc"
tags = ["minecraft", var.mode]
check {
type = "tcp"
interval = "5s"
timeout = "1s"
}
}
task "run" {
driver = "docker"
dynamic "artifact" {
for_each = var.plugins
content {
source = artifact.value
destination = "local/plugins"
}
}
config {
image = var.image
force_pull = false
ports = ["minecraft"]
volumes = ["local:/mnt"]
}
env {
HOST_POSTGRES = "jdbc:postgresql://postgres.service.consul/scrow"
HOST_NATS = "nats://nats.service.consul"
}
resources {
cpu = 1000
memory = 2048
}
}
}
}