Skip to content

Instantly share code, notes, and snippets.

@liemle3893
Last active November 15, 2022 15:30
Show Gist options
  • Save liemle3893/fcb67882cfba3a7739c9ade4bd73453a to your computer and use it in GitHub Desktop.
Save liemle3893/fcb67882cfba3a7739c9ade4bd73453a to your computer and use it in GitHub Desktop.
job "demo" {
datacenters = [
"dc1"]
group "api" {
count = "1"
task "demo_api" {
driver = "docker"
config {
image = "saboteurkid/go-demo:latest-debug"
port_map {
http = 1323
}
sysctl = {
"net.core.somaxconn" = "65535"
}
ulimit {
nofile = "65536"
nproc = "8192"
}
}
service {
name = "go-demo"
port = "http"
address_mode = "driver"
tags = [
"traefik.enable=true",
"traefik.http.middlewares.strip-go-demo.stripprefix.prefixes=/go-demo",
"traefik.http.routers.go-demo.entrypoints=http",
"traefik.http.routers.go-demo.rule=PathPrefix(`/go-demo`)",
"traefik.http.routers.go-demo.middlewares=strip-go-demo"
]
check {
name = "http"
type = "http"
port = "http"
path = "/healthz"
timeout = "2s"
interval = "5s"
}
}
template {
data = <<ENV
GOMAXPROCS={{ env "attr.cpu.numcores" }}
ENV
env = true
destination = "local/env"
}
resources {
network {
port "http" {}
}
cpu = "20"
memory = "20"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment