job "homepage" {
  datacenters = ["alo"]

  group "app" {
    network {
      port "http" { to = 3000 }
    }

    task "homepage" {
      driver = "docker"

      config {
        image = "ghcr.io/gethomepage/homepage:latest"
        ports = [ "http" ]
        volumes = [
          "/data/services/homepage:/app/config",
        ]
      }

      env {
        PUID = 1000
        PGID = 1000
        HOMEPAGE_ALLOWED_HOSTS = "homepage.v.paler.net"
      }

      resources {
        cpu = 200
        memory = 256
      }

      service {
        name = "homepage"
        port = "http"

        tags = [
          "traefik.enable=true",
          "traefik.http.routers.homepage.entryPoints=websecure",
          "traefik.http.routers.homepage.middlewares=oidc-auth@file",
        ]

        check {
          type     = "http"
          path     = "/"
          interval = "10s"
          timeout  = "5s"
        }
      }
    }
  }
}
