From 5fff486c9c1e5ac39ab51336c6cf9ed83a3d8a0e Mon Sep 17 00:00:00 2001 From: nova <110734810+novanai@users.noreply.github.com> Date: Fri, 9 Aug 2024 17:53:29 +0100 Subject: [PATCH] Update nova timetable-sync job (#51) Co-authored-by: wizzdom --- jobs/user-projects/general/nova-timetable.hcl | 85 +++++++++++++------ 1 file changed, 59 insertions(+), 26 deletions(-) diff --git a/jobs/user-projects/general/nova-timetable.hcl b/jobs/user-projects/general/nova-timetable.hcl index cd6b914..f33f2b7 100644 --- a/jobs/user-projects/general/nova-timetable.hcl +++ b/jobs/user-projects/general/nova-timetable.hcl @@ -1,41 +1,54 @@ job "nova-timetable" { datacenters = ["aperture"] - - type = "service" + type = "service" group "nova-timetable" { count = 1 network { - port "http" { - to = 80 - } - port "db" { to = 6379 } - } - service { - name = "nova-timetable" - port = "http" - - check { - type = "http" - path = "/healthcheck" - interval = "10s" - timeout = "2s" + port "frontend" { + to = 3000 } - tags = [ - "traefik.enable=true", - "traefik.http.routers.nova-timetable.rule=Host(`timetable.redbrick.dcu.ie`)", - "traefik.http.routers.nova-timetable.entrypoints=web,websecure", - "traefik.http.routers.nova-timetable.tls.certresolver=lets-encrypt", - ] + port "backend" { + to = 4000 + } } - task "python-application" { + task "frontend" { + driver = "docker" + + config { + image = "ghcr.io/novanai/timetable-sync-frontend:latest" + ports = ["frontend"] + } + + service { + name = "nova-timetable-frontend" + port = "frontend" + + check { + type = "http" + path = "/" + interval = "10s" + timeout = "2s" + } + + tags = [ + "traefik.enable=true", + "traefik.port=${NOMAD_PORT_frontend}", + "traefik.http.routers.nova-timetable-frontend.rule=Host(`timetable.redbrick.dcu.ie`)", + "traefik.http.routers.nova-timetable-frontend.entrypoints=web,websecure", + "traefik.http.routers.nova-timetable-frontend.tls.certresolver=lets-encrypt", + ] + } + } + + task "backend" { driver = "docker" env { @@ -43,8 +56,28 @@ job "nova-timetable" { } config { - image = "novanai/timetable-sync" - ports = ["http"] + image = "ghcr.io/novanai/timetable-sync-backend:latest" + 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", + ] } } @@ -57,4 +90,4 @@ job "nova-timetable" { } } } -} \ No newline at end of file +}