.
This commit is contained in:
parent
b7623bab85
commit
d6e4cae9c6
60 changed files with 486 additions and 93 deletions
|
|
@ -1,21 +1,14 @@
|
|||
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"
|
||||
type = "batch"
|
||||
|
||||
parameterized {
|
||||
meta_required = ["mode", "image"]
|
||||
meta_optional = ["plugins"]
|
||||
}
|
||||
|
||||
meta {
|
||||
plugins = ""
|
||||
}
|
||||
|
||||
group "lobby" {
|
||||
count = 1
|
||||
|
|
@ -31,10 +24,12 @@ job "minecraft" {
|
|||
}
|
||||
|
||||
service {
|
||||
name = var.mode
|
||||
name = "minecraft"
|
||||
port = "minecraft"
|
||||
address_mode = "alloc"
|
||||
tags = ["minecraft", var.mode]
|
||||
meta {
|
||||
mode = "${NOMAD_META_MODE}"
|
||||
}
|
||||
check {
|
||||
type = "tcp"
|
||||
interval = "5s"
|
||||
|
|
@ -42,22 +37,37 @@ job "minecraft" {
|
|||
}
|
||||
}
|
||||
|
||||
task "run" {
|
||||
task "download-plugins" {
|
||||
driver = "docker"
|
||||
|
||||
dynamic "artifact" {
|
||||
for_each = var.plugins
|
||||
content {
|
||||
source = artifact.value
|
||||
destination = "local/plugins"
|
||||
}
|
||||
lifecycle {
|
||||
hook = "prestart"
|
||||
sidecar = false
|
||||
}
|
||||
|
||||
config {
|
||||
image = var.image
|
||||
force_pull = false
|
||||
image = "busybox"
|
||||
command = "sh"
|
||||
volumes = ["../alloc/data:/mnt"]
|
||||
args = [
|
||||
"-cxe",
|
||||
<<-EOF
|
||||
set -eu
|
||||
mkdir /mnt/plugins
|
||||
wget -P /mnt/plugins ${NOMAD_META_PLUGINS}
|
||||
EOF
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
task "run" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
image = "${NOMAD_META_IMAGE}"
|
||||
force_pull = true
|
||||
ports = ["minecraft"]
|
||||
volumes = ["local:/mnt"]
|
||||
volumes = ["../alloc/data:/mnt"]
|
||||
}
|
||||
|
||||
env {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
job "velocity" {
|
||||
type = "service"
|
||||
datacenters = ["dc1"]
|
||||
|
||||
group "velocity" {
|
||||
|
||||
network {
|
||||
mode = "bridge"
|
||||
port "ingress" {
|
||||
static = 25565
|
||||
}
|
||||
|
|
@ -13,52 +12,19 @@ job "velocity" {
|
|||
}
|
||||
}
|
||||
|
||||
service {
|
||||
name = "velocity"
|
||||
port = "ingress"
|
||||
address_mode = "host"
|
||||
|
||||
check {
|
||||
type = "tcp"
|
||||
interval = "5s"
|
||||
timeout = "1s"
|
||||
}
|
||||
}
|
||||
|
||||
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-velocity/UNVERSIONED/CoreVelocity.jar
|
||||
EOF
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
task "velocity" {
|
||||
driver = "docker"
|
||||
|
||||
artifact {
|
||||
source = "https://git.lab0x13.site/api/packages/scrow/generic/core-velocity/UNVERSIONED/CoreVelocity.jar"
|
||||
destination = "local/plugins"
|
||||
}
|
||||
|
||||
config {
|
||||
image = "git.lab0x13.site/scrow/velocity:0.1"
|
||||
image = "git.lab0x13.site/scrow/velocity:0.3"
|
||||
force_pull = true
|
||||
ports = ["ingress"]
|
||||
volumes = ["../alloc/data:/mnt"]
|
||||
volumes = ["local:/mnt"]
|
||||
}
|
||||
|
||||
env {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue