Add CI/CD for auto-deployment of blog
All checks were successful
Build and Push Docker Image / build (push) Successful in 3m23s
All checks were successful
Build and Push Docker Image / build (push) Successful in 3m23s
This commit is contained in:
54
blog.nomad.hcl
Normal file
54
blog.nomad.hcl
Normal file
@@ -0,0 +1,54 @@
|
||||
# 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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user