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

  meta {
    uuid = uuidv4()
  }

  group "ui" {
    network {
      port "http" {
        to = 8888
      }
    }

    task "notebook" {
      driver = "docker"

      config {
        image = "quay.io/jupyter/scipy-notebook:latest"
        ports = ["http"]

        volumes = [
          "/data/services/jupyter:/home/jovyan/work",
        ]

        command = "start-notebook.py"
        args = [ "--IdentityProvider.token=''" ]
      }

      resources {
        memory = 1024
      }

      service {
        name = "jupyter"
        port = "http"

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