74 lines
1.3 KiB
HCL
74 lines
1.3 KiB
HCL
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
|
|
}
|
|
}
|
|
}
|
|
}
|