Composite action for deploying Nix flake OCI images to Nomad. Owns the static-site parameterized Nomad job template, all infra defaults (registry, S3, Nomad addr), and an optional smoke test. Site repos only need to provide a flake with an ociImage output and pass domain + 3 secrets (S3_ACCESS_KEY, S3_SECRET_KEY, NIX_SIGNING_KEY). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
50 lines
1,020 B
HCL
50 lines
1,020 B
HCL
job "static-site" {
|
|
namespace = "static-sites"
|
|
type = "service"
|
|
|
|
parameterized {
|
|
meta_required = ["image_tag", "domain"]
|
|
}
|
|
|
|
group "site" {
|
|
count = 1
|
|
|
|
network {
|
|
port "http" { to = 8080 }
|
|
}
|
|
|
|
service {
|
|
name = "static-site-${NOMAD_META_domain}"
|
|
port = "http"
|
|
provider = "nomad"
|
|
|
|
tags = [
|
|
"traefik.enable=true",
|
|
"traefik.http.routers.${NOMAD_META_domain}.rule=Host(`${NOMAD_META_domain}`)",
|
|
"traefik.http.routers.${NOMAD_META_domain}.entrypoints=websecure",
|
|
"traefik.http.routers.${NOMAD_META_domain}.tls.certresolver=letsencrypt",
|
|
]
|
|
|
|
check {
|
|
type = "http"
|
|
path = "/"
|
|
interval = "30s"
|
|
timeout = "5s"
|
|
}
|
|
}
|
|
|
|
task "server" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "registry.toph.so/${NOMAD_META_domain}:${NOMAD_META_image_tag}"
|
|
ports = ["http"]
|
|
}
|
|
|
|
resources {
|
|
cpu = 50
|
|
memory = 64
|
|
}
|
|
}
|
|
}
|
|
}
|