Last active
February 18, 2022 07:19
-
-
Save omerkaya1/5ddce070abfa7cadb19541f6ed33329e to your computer and use it in GitHub Desktop.
#nomad
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 "api-gw" { | |
datacenters = ["dc1"] | |
type = "service" | |
# Update policy | |
update { | |
max_parallel = 1 | |
min_healthy_time = "10s" | |
healthy_deadline = "3m" | |
progress_deadline = "10m" | |
auto_revert = true | |
} | |
group "api-gw" { | |
count = 1 | |
# Network | |
network { | |
port "http" { | |
to = 8080 | |
} | |
} | |
service { | |
name = "api-gateway" | |
port = "http" | |
# Health check | |
check { | |
name = "health check of the api-gateway service" | |
port = "http" | |
type = "http" | |
path = "/api-gw/api/v1/ping" | |
method = "GET" | |
interval = "5s" | |
timeout = "2s" | |
} | |
} | |
# Restart policy | |
restart { | |
attempts = 2 | |
interval = "15s" | |
delay = "5s" | |
mode = "fail" | |
} | |
# Job task definitions | |
task "api-gw-service" { | |
# driver = "exec" | |
# config { | |
# command = "api_gw" | |
# ports = ["http"] | |
# args = [] | |
# } | |
# TODO: replace with exec once the project is fully operational | |
driver = "docker" | |
config { | |
image = "image:tag" | |
ports = ["http"] | |
} | |
resources { | |
cpu = 500 # 500 MHz | |
memory = 128 # 128MB | |
} | |
template { | |
data = <<EOH | |
host: ":8080" | |
debug: true | |
profile: true | |
EOH | |
destination = "local/config.yaml" | |
change_mode = "signal" | |
change_signal = "SIGHUP" | |
} | |
logs { | |
max_files = 10 | |
max_file_size = 15 # 15MB | |
} | |
kill_timeout = "10s" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment