From 3511ad653b873e32e3cf187845f5a0bf9e8e3d57 Mon Sep 17 00:00:00 2001 From: wizzdom Date: Sun, 31 Mar 2024 17:22:28 +0100 Subject: [PATCH] add admin api job (#35) --- jobs/services/api.hcl | 82 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 jobs/services/api.hcl diff --git a/jobs/services/api.hcl b/jobs/services/api.hcl new file mode 100644 index 0000000..1015b48 --- /dev/null +++ b/jobs/services/api.hcl @@ -0,0 +1,82 @@ +job "api" { + datacenters = ["aperture"] + + type = "service" + + group "api" { + count = 1 + + network { + port "http" { + to = 80 + } + } + + service { + name = "api" + port = "http" + + check { + type = "http" + path = "/" + interval = "10s" + timeout = "2s" + } + + tags = [ + "traefik.enable=true", + "traefik.http.routers.api.rule=Host(`api.redbrick.dcu.ie`)", + "traefik.http.routers.api.entrypoints=web,websecure", + "traefik.http.routers.api.tls.certresolver=lets-encrypt", + ] + } + + task "api" { + driver = "docker" + + config { + image = "ghcr.io/redbrick/api:latest" + ports = ["http"] + volumes = [ + "/oldstorage:/storage", + "/oldstorage/home:/home", + "local/ldap.secret:/etc/ldap.secret", + ] + auth { + username = "${DOCKER_USER}" + password = "${DOCKER_PASS}" + } + } + template { + destination = "local/.env" + env = true + change_mode = "restart" + data = <