From 5fe61223c346c300ceb0aee3123aa65e07a530d3 Mon Sep 17 00:00:00 2001 From: vincent Date: Fri, 12 Apr 2024 08:59:20 +0200 Subject: [PATCH] feat: create authelia job --- nomad-job/authelia.nomad.hcl | 161 +++++++++++++++++++++++++++ nomad-job/openldap/tree.ldif | 15 +++ nomad-job/traefik-ingress.nomad | 6 + nomad-job/traefik-local.nomad | 13 ++- nomad-job/volume/authelia-config.hcl | 17 +++ terraform/dns/variable.tf | 1 + terraform/vault/nomad.tf | 1 + 7 files changed, 213 insertions(+), 1 deletion(-) create mode 100644 nomad-job/authelia.nomad.hcl create mode 100644 nomad-job/volume/authelia-config.hcl diff --git a/nomad-job/authelia.nomad.hcl b/nomad-job/authelia.nomad.hcl new file mode 100644 index 0000000..870a0cd --- /dev/null +++ b/nomad-job/authelia.nomad.hcl @@ -0,0 +1,161 @@ + +job "authelia" { + datacenters = ["homelab"] + priority = 80 + type = "service" + meta { + forcedeploy = "0" + } + constraint { + attribute = "${attr.cpu.arch}" + value = "amd64" + } + + group "authelia" { + network { + mode = "host" + port "authelia" { + to = 9091 + } + } + volume "authelia-config" { + type = "csi" + source = "authelia-config" + access_mode = "multi-node-multi-writer" + attachment_mode = "file-system" + } + vault { + policies = ["authelia"] + + } + task "authelia" { + driver = "docker" + service { + name = "authelia" + port = "authelia" + tags = [ + "traefik.enable=true", + "traefik.http.routers.${NOMAD_JOB_NAME}.rule=Host(`auth.ducamps.eu`)", + "traefik.http.routers.${NOMAD_JOB_NAME}.tls.domains[0].sans=auth.ducamps.eu", + "traefik.http.routers.${NOMAD_JOB_NAME}.tls.certresolver=myresolver", + "traefik.http.routers.${NOMAD_JOB_NAME}.entrypoints=web,websecure", + + + ] + } + config { + image = "authelia/authelia" + ports = ["authelia"] + args = [ + "--config", + "/local/configuration.yml", + ] + + + } + volume_mount { + volume = "authelia-config" + destination = "/config" + } + env { + AUTHELIA_SESSION_SECRET = uuidv4() + AUTHELIA_IDENTITY_VALIDATION_RESET_PASSWORD_JWT_SECRET = uuidv4() + } + + template { + data = <