105 lines
2.4 KiB
HCL
105 lines
2.4 KiB
HCL
job "salience-editor-qwik-city" {
|
|
datacenters = ["ord10"]
|
|
type = "service"
|
|
|
|
constraint {
|
|
attribute = "${node.unique.name}"
|
|
value = "chicago-web01"
|
|
}
|
|
|
|
group "app" {
|
|
count = 1
|
|
|
|
network {
|
|
mode = "host"
|
|
|
|
port "http" {
|
|
# Nomad will assign an available port
|
|
}
|
|
}
|
|
|
|
# Blue-green deployment strategy using canary
|
|
update {
|
|
max_parallel = 1
|
|
health_check = "checks"
|
|
min_healthy_time = "10s"
|
|
healthy_deadline = "5m"
|
|
auto_promote = true
|
|
auto_revert = true
|
|
canary = 1
|
|
}
|
|
|
|
task "node-server" {
|
|
driver = "raw_exec"
|
|
|
|
user = "peoplesgrocers"
|
|
|
|
config {
|
|
# Set working directory to release path
|
|
# RELEASE_PATH will be interpolated during deployment
|
|
work_dir = "$RELEASE_PATH"
|
|
command = "/home/peoplesgrocers/.nvm/versions/node/v24.10.0/bin/yarn"
|
|
args = ["node", "server/entry.express.js"]
|
|
}
|
|
|
|
# Template to set working directory path dynamically
|
|
# This will be replaced during deployment
|
|
env {
|
|
PORT = "${NOMAD_PORT_http}"
|
|
ORIGIN = "https://peoplesgrocers.com"
|
|
PATH = "/home/peoplesgrocers/.nvm/versions/node/v24.10.0/bin:/usr/local/bin:/usr/bin:/bin"
|
|
HOME = "/home/peoplesgrocers"
|
|
}
|
|
|
|
# Release path set during deployment via envsubst
|
|
template {
|
|
data = <<EOH
|
|
RELEASE_PATH="$RELEASE_PATH"
|
|
EOH
|
|
destination = "local/env"
|
|
env = true
|
|
}
|
|
|
|
resources {
|
|
cpu = 500 # MHz
|
|
memory = 256 # MB
|
|
}
|
|
|
|
# Consul service registration with health check
|
|
service {
|
|
name = "salience-editor-qwik-city"
|
|
port = "http"
|
|
|
|
tags = [
|
|
"qwik-city",
|
|
"ssr",
|
|
"app"
|
|
]
|
|
|
|
# Health check on dedicated health endpoint
|
|
check {
|
|
type = "http"
|
|
path = "/p/salience-editor/health"
|
|
interval = "10s"
|
|
timeout = "2s"
|
|
|
|
check_restart {
|
|
limit = 3
|
|
grace = "10s"
|
|
}
|
|
}
|
|
|
|
# Service meta for nginx template filtering
|
|
meta {
|
|
version = "$RELEASE_PLACEHOLDER"
|
|
}
|
|
}
|
|
|
|
# Allow 30 seconds for graceful shutdown of in-flight requests
|
|
kill_timeout = "30s"
|
|
|
|
# Ensure node is available
|
|
kill_signal = "SIGTERM"
|
|
}
|
|
}
|
|
}
|