Created
March 26, 2020 15:52
-
-
Save lgfa29/51c50d2617287efaf706f2078fa72e0e to your computer and use it in GitHub Desktop.
Nomad job for running a Minecraft server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
job "minecraft" { | |
datacenters = ["dc1"] | |
group "minecraft" { | |
volume "minecraft" { | |
type = "host" | |
source = "minecraft" | |
} | |
task "eula" { | |
driver = "exec" | |
config { | |
command = "mv" | |
args = ["local/eula.txt", "/var/volume/"] | |
} | |
lifecycle { | |
hook = "prestart" | |
sidecar = false | |
} | |
template { | |
data = "eula=true" | |
destination = "local/eula.txt" | |
} | |
volume_mount { | |
volume = "minecraft" | |
destination = "/var/volume" | |
} | |
} | |
task "minecraft" { | |
driver = "exec" | |
config { | |
command = "/bin/sh" | |
args = ["-c", "cd /var/volume && exec java -Xms1024M -Xmx2048M -jar /local/server.jar --nogui"] | |
} | |
artifact { | |
source = "https://launcher.mojang.com/v1/objects/bb2b6b1aefcd70dfd1892149ac3a215f6c636b07/server.jar" | |
} | |
resources { | |
cpu = 4000 | |
memory = 2048 | |
} | |
volume_mount { | |
volume = "minecraft" | |
destination = "/var/volume" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment