add uri-meetups job (#92)
This commit is contained in:
parent
ad4cfbbaf6
commit
8819180c25
2 changed files with 83 additions and 0 deletions
36
jobs/user-projects/general/urri-meetups-update.hcl
Normal file
36
jobs/user-projects/general/urri-meetups-update.hcl
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
job "urri-meetups-update" {
|
||||||
|
datacenters = ["aperture"]
|
||||||
|
type = "batch"
|
||||||
|
|
||||||
|
periodic {
|
||||||
|
crons = ["0 */6 * * * *"]
|
||||||
|
prohibit_overlap = true
|
||||||
|
}
|
||||||
|
|
||||||
|
group "urri-meetups-update" {
|
||||||
|
|
||||||
|
task "urri-meetups-update" {
|
||||||
|
driver = "raw_exec"
|
||||||
|
|
||||||
|
config {
|
||||||
|
command = "/bin/bash"
|
||||||
|
args = ["local/script.sh"]
|
||||||
|
}
|
||||||
|
|
||||||
|
template {
|
||||||
|
data = <<EOH
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# stop the urri-meetups job
|
||||||
|
nomad job stop urri-meetups
|
||||||
|
sleep 1
|
||||||
|
# revert the urri-meetups job to the previous version
|
||||||
|
# this will trigger a new deployment, which will pull the latest image
|
||||||
|
nomad job revert urri-meetups $(($(nomad job inspect urri-meetups | jq '.Job.Version')-1))
|
||||||
|
EOH
|
||||||
|
destination = "local/script.sh"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
47
jobs/user-projects/general/urri-meetups.hcl
Normal file
47
jobs/user-projects/general/urri-meetups.hcl
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
job "urri-meetups" {
|
||||||
|
datacenters = ["aperture"]
|
||||||
|
type = "service"
|
||||||
|
|
||||||
|
group "urri-meetups" {
|
||||||
|
count = 1
|
||||||
|
|
||||||
|
network {
|
||||||
|
port "http" {
|
||||||
|
to = 8000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
service {
|
||||||
|
port = "http"
|
||||||
|
|
||||||
|
check {
|
||||||
|
type = "http"
|
||||||
|
path = "/"
|
||||||
|
interval = "10s"
|
||||||
|
timeout = "2s"
|
||||||
|
}
|
||||||
|
|
||||||
|
tags = [
|
||||||
|
"traefik.enable=true",
|
||||||
|
"traefik.http.routers.urri-meetups.rule=Host(`urri-meetups.rb.dcu.ie`)",
|
||||||
|
"traefik.http.routers.urri-meetups.entrypoints=web,websecure",
|
||||||
|
"traefik.http.routers.urri-meetups.tls.certresolver=lets-encrypt",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
task "web" {
|
||||||
|
driver = "docker"
|
||||||
|
|
||||||
|
config {
|
||||||
|
image = "ghcr.io/haefae222/pizza_app:latest"
|
||||||
|
ports = ["http"]
|
||||||
|
force_pull = true
|
||||||
|
}
|
||||||
|
|
||||||
|
resources {
|
||||||
|
cpu = 1000
|
||||||
|
memory = 800
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue