Files
Blog/blog.nomad.hcl
Caleb Braaten f3eb83bcc0
All checks were successful
Build and Push Docker Image / build (push) Successful in 3m23s
Add CI/CD for auto-deployment of blog
2026-04-15 16:37:12 -07:00

55 lines
998 B
HCL

# export to json for ci/cd scripts with the following command
# nomad job run -output blog.nomad.hcl > blog.nomad.json
locals {
HOST = "cbraaten.dev"
}
variable "image_tag" {
type = string
default = "latest"
}
job "blog" {
type = "service"
group "blog" {
count = 1
network {
port "http" {
to = 3000
}
}
service {
name = "blog"
provider = "consul"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.domainredirect.tls=true",
"traefik.http.routers.domainredirect.entrypoints=websecure",
"traefik.http.routers.domainredirect.rule=Host(`${local.HOST}`)",
]
}
task "blog" {
driver = "docker"
config {
image = "git.cbraaten.dev/caleb/blog:${var.image_tag}"
ports = ["http"]
}
}
update {
max_parallel = 1
min_healthy_time = "10s"
healthy_deadline = "3m"
auto_revert = true
}
}
}