Skip to content

Instantly share code, notes, and snippets.

@Neutrollized
Last active February 1, 2023 01:24
Show Gist options
  • Save Neutrollized/a51eccb660f25d580e6daf7f3485733a to your computer and use it in GitHub Desktop.
Save Neutrollized/a51eccb660f25d580e6daf7f3485733a to your computer and use it in GitHub Desktop.
Medium: Migrating off of Pivotal Cloud Foundry? Consider HashiCorp Nomad!
job "minecraft" {
datacenters = ["gcp-test"]
priority = 80
group "mc-server" {
network {
port "access" { static = 25565 }
}
# reserved disk
# https://developer.hashicorp.com/nomad/docs/job-specification/ephemeral_disk
ephemeral_disk {
migrate = true
size = 2000
sticky = true
}
task "minecraft" {
driver = "java"
config {
jar_path = "server.jar"
jvm_options = ["-Xmx1152M", "-Xms1152M"]
args = ["EULA=true", "nogui"]
}
resources {
cores = 1
memory = 1280
}
# you will need a file that says "eula=true" to accept in order for server to start
# https://help.akliz.net/docs/agree-to-the-eula-on-a-minecraft-server
artifact {
source = "https://storage.googleapis.com/public-file-server/minecraft-eula.txt"
mode = "file"
destination = "eula.txt"
}
artifact {
# https://mcversions.net/ to get server.jar download links
# NOTE 1: if constantly preparing spawn area 0% then failing,
# it means it needs more memory allocation
# NOTE 2: v1.17+ has a much higher memory requirement (3GB+)
source = "https://launcher.mojang.com/v1/objects/1b557e7b033b583cd9f66746b7a9ab1ec1673ced/server.jar"
mode = "file"
destination = "server.jar"
}
service {
name = "minecraft-server"
provider = "nomad"
port = "access"
tags = ["v1.16.5"]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment