From 598896ad5f5cdd5148a5e7f9b48f04d8e404c448 Mon Sep 17 00:00:00 2001 From: vincent Date: Fri, 10 May 2024 08:20:01 +0200 Subject: [PATCH] feat: implement immich job --- nomad-job/immich.nomad.hcl | 190 +++++++++++++++++++++++++++++ nomad-job/volume/immich-cache.hcl | 17 +++ nomad-job/volume/immich-upload.hcl | 17 +++ nomad-job/volume/photo.hcl | 17 +++ 4 files changed, 241 insertions(+) create mode 100644 nomad-job/immich.nomad.hcl create mode 100644 nomad-job/volume/immich-cache.hcl create mode 100644 nomad-job/volume/immich-upload.hcl create mode 100644 nomad-job/volume/photo.hcl diff --git a/nomad-job/immich.nomad.hcl b/nomad-job/immich.nomad.hcl new file mode 100644 index 0000000..fe37598 --- /dev/null +++ b/nomad-job/immich.nomad.hcl @@ -0,0 +1,190 @@ +job "immich" { + datacenters = ["homelab"] + priority = 50 + type = "service" + meta { + forcedeploy = "0" + } + constraint { + attribute = "${attr.cpu.arch}" + value = "amd64" + } + + group "immich" { + network { + mode = "host" + port "http" { + to = 3001 + } + port "redis" { + to = 6379 + } + port "machinelearning" { + to = 3003 + } + port "microservices" { + to = 3002 + } + } + volume "immich-upload" { + type = "csi" + source = "immich-upload" + access_mode = "multi-node-multi-writer" + attachment_mode = "file-system" + } + volume "immich-cache" { + type = "csi" + source = "immich-cache" + access_mode = "multi-node-multi-writer" + attachment_mode = "file-system" + } + volume "photo" { + type = "csi" + source = "photo" + access_mode = "multi-node-multi-writer" + attachment_mode = "file-system" + } + vault { + policies = ["immich"] + } + task "immich-server" { + driver = "docker" + service { + name = "immich" + port = "http" + tags = [ + "homer.enable=true", + "homer.name=immich", + "homer.service=Application", + "homer.logo=https://www.ducamps.eu/tt-rss/images/favicon-72px.png", + "homer.target=_blank", + "homer.url=https://immich.ducamps.eu", + "traefik.enable=true", + "traefik.http.routers.${NOMAD_JOB_NAME}.rule=Host(`${NOMAD_JOB_NAME}.ducamps.eu`)", + "traefik.http.routers.${NOMAD_JOB_NAME}.tls.domains[0].sans=${NOMAD_JOB_NAME}.ducamps.eu", + "traefik.http.routers.${NOMAD_JOB_NAME}.tls.certresolver=myresolver", + "traefik.http.routers.${NOMAD_JOB_NAME}.entrypoints=web,websecure", + ] + } + volume_mount { + volume = "immich-upload" + destination = "/usr/src/app/upload" + } + volume_mount { + volume = "photo" + destination = "/photo" + } + config { + image = "ghcr.service.consul:5000/immich-app/immich-server:release" + command = "start.sh" + args = ["immich"] + ports = ["http"] + volumes = [ + "/etc/localtime:/etc/localtime" + ] + + } + + template { + data = <