generated from hjess/PythonTemplateProject
Nomad stuff
Some checks are pending
Build, Push, and Deploy to Nomad / docker-nomad (push) Waiting to run
Some checks are pending
Build, Push, and Deploy to Nomad / docker-nomad (push) Waiting to run
This commit is contained in:
104
.gitea/workflows/lifefaq.nomad
Normal file
104
.gitea/workflows/lifefaq.nomad
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
job "lifefaq" {
|
||||||
|
region = "global"
|
||||||
|
datacenters = ["dc1"]
|
||||||
|
type = "service"
|
||||||
|
|
||||||
|
meta {
|
||||||
|
uuid = uuidv4()
|
||||||
|
deployed_at = "[[ timeNowUTC ]]"
|
||||||
|
}
|
||||||
|
|
||||||
|
update {
|
||||||
|
max_parallel = 1
|
||||||
|
canary = 2
|
||||||
|
auto_revert = false
|
||||||
|
min_healthy_time = "10s"
|
||||||
|
healthy_deadline = "10m"
|
||||||
|
auto_promote = true
|
||||||
|
progress_deadline = "15m"
|
||||||
|
}
|
||||||
|
|
||||||
|
group "lifefaq-group" {
|
||||||
|
count = 2
|
||||||
|
|
||||||
|
network {
|
||||||
|
port "http" {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constraint {
|
||||||
|
attribute = "${node.unique.name}"
|
||||||
|
value = "autobox.i80.dk"
|
||||||
|
}
|
||||||
|
|
||||||
|
reschedule {
|
||||||
|
attempts = 5
|
||||||
|
interval = "10m"
|
||||||
|
delay = "30s"
|
||||||
|
delay_function = "exponential"
|
||||||
|
max_delay = "120s"
|
||||||
|
unlimited = false
|
||||||
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
provider = "consul"
|
||||||
|
name = "lifefaq"
|
||||||
|
port = "http"
|
||||||
|
|
||||||
|
tags = [
|
||||||
|
"traefik.enable=true",
|
||||||
|
"traefik.http.routers.lifefaq.rule=Host(`lifefaq.i80.dk`)",
|
||||||
|
"traefik.http.routers.lifefaq.tls=true"
|
||||||
|
]
|
||||||
|
|
||||||
|
check {
|
||||||
|
address_mode = "host"
|
||||||
|
name = "http_health_check"
|
||||||
|
type = "http"
|
||||||
|
path = "/health"
|
||||||
|
interval = "10s"
|
||||||
|
timeout = "5s"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task "lifefaq-task" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "registry.i80.dk/gitea/lifefaq:latest"
|
||||||
|
ports = ["http"]
|
||||||
|
force_pull = true
|
||||||
|
auth {
|
||||||
|
username = "robot$gitserver"
|
||||||
|
password = "${HARBOR_ROBOT_TOKEN}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
restart {
|
||||||
|
attempts = 10
|
||||||
|
interval = "10m"
|
||||||
|
delay = "10s"
|
||||||
|
mode = "fail"
|
||||||
|
}
|
||||||
|
|
||||||
|
env {
|
||||||
|
APP_ENV = "production"
|
||||||
|
PORT = "${NOMAD_PORT_http}"
|
||||||
|
HOST = "0.0.0.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
template {
|
||||||
|
data = <<EOH
|
||||||
|
HARBOR_ROBOT_TOKEN="{{ key "harbor/robot/token" }}"
|
||||||
|
EOH
|
||||||
|
destination = "secrets/registry.env"
|
||||||
|
env = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
cpu = 300
|
||||||
|
memory = 256
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
job "lifefaq" {
|
|
||||||
region = "global"
|
|
||||||
datacenters = ["dc1"]
|
|
||||||
type = "service"
|
|
||||||
|
|
||||||
update {
|
|
||||||
stagger = "60s"
|
|
||||||
max_parallel = 1
|
|
||||||
canary = 1
|
|
||||||
auto_revert = true
|
|
||||||
auto_promote = true
|
|
||||||
progress_deadline = "6m"
|
|
||||||
}
|
|
||||||
|
|
||||||
group "lifefaq-group" {
|
|
||||||
count = 1
|
|
||||||
|
|
||||||
network {
|
|
||||||
port "port-app" {
|
|
||||||
to = 9210 # Internal application port
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Register the service with Consul
|
|
||||||
service {
|
|
||||||
provider = "consul"
|
|
||||||
name = "lifefaq"
|
|
||||||
port = "port-app"
|
|
||||||
|
|
||||||
# Traefik-specific tags for routing
|
|
||||||
tags = [
|
|
||||||
"PORT=${NOMAD_PORT_port-app}"
|
|
||||||
]
|
|
||||||
|
|
||||||
# Define a health check using TCP
|
|
||||||
check {
|
|
||||||
name = "tcp_check"
|
|
||||||
type = "tcp"
|
|
||||||
interval = "10s"
|
|
||||||
timeout = "2s"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task "lifefaq-task" {
|
|
||||||
driver = "docker"
|
|
||||||
|
|
||||||
config {
|
|
||||||
image = "registry.i80.dk/gitea/lifefaq:latest"
|
|
||||||
ports = ["port-app"]
|
|
||||||
}
|
|
||||||
|
|
||||||
env {
|
|
||||||
APP_ENV = "production"
|
|
||||||
PORT = "${NOMAD_PORT_port-app}"
|
|
||||||
}
|
|
||||||
|
|
||||||
resources {
|
|
||||||
cpu = 250
|
|
||||||
memory = 80
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user