Update nova timetable-sync job (#51)

Co-authored-by: wizzdom <dom@wizzdom.xyz>
This commit is contained in:
nova 2024-08-09 17:53:29 +01:00 committed by GitHub
parent 3f0ae5d23b
commit 5fff486c9c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,41 +1,54 @@
job "nova-timetable" { job "nova-timetable" {
datacenters = ["aperture"] datacenters = ["aperture"]
type = "service" type = "service"
group "nova-timetable" { group "nova-timetable" {
count = 1 count = 1
network { network {
port "http" {
to = 80
}
port "db" { port "db" {
to = 6379 to = 6379
} }
port "frontend" {
to = 3000
}
port "backend" {
to = 4000
}
}
task "frontend" {
driver = "docker"
config {
image = "ghcr.io/novanai/timetable-sync-frontend:latest"
ports = ["frontend"]
} }
service { service {
name = "nova-timetable" name = "nova-timetable-frontend"
port = "http" port = "frontend"
check { check {
type = "http" type = "http"
path = "/healthcheck" path = "/"
interval = "10s" interval = "10s"
timeout = "2s" timeout = "2s"
} }
tags = [ tags = [
"traefik.enable=true", "traefik.enable=true",
"traefik.http.routers.nova-timetable.rule=Host(`timetable.redbrick.dcu.ie`)", "traefik.port=${NOMAD_PORT_frontend}",
"traefik.http.routers.nova-timetable.entrypoints=web,websecure", "traefik.http.routers.nova-timetable-frontend.rule=Host(`timetable.redbrick.dcu.ie`)",
"traefik.http.routers.nova-timetable.tls.certresolver=lets-encrypt", "traefik.http.routers.nova-timetable-frontend.entrypoints=web,websecure",
"traefik.http.routers.nova-timetable-frontend.tls.certresolver=lets-encrypt",
] ]
} }
}
task "python-application" { task "backend" {
driver = "docker" driver = "docker"
env { env {
@ -43,8 +56,28 @@ job "nova-timetable" {
} }
config { config {
image = "novanai/timetable-sync" image = "ghcr.io/novanai/timetable-sync-backend:latest"
ports = ["http"] ports = ["backend"]
}
service {
name = "nova-timetable-backend"
port = "backend"
check {
type = "http"
path = "/api/healthcheck"
interval = "10s"
timeout = "2s"
}
tags = [
"traefik.enable=true",
"traefik.port=${NOMAD_PORT_backend}",
"traefik.http.routers.nova-timetable-backend.rule=Host(`timetable.redbrick.dcu.ie`) && PathPrefix(`/api`)",
"traefik.http.routers.nova-timetable-backend.entrypoints=web,websecure",
"traefik.http.routers.nova-timetable-backend.tls.certresolver=lets-encrypt",
]
} }
} }