# UI code: docdut-sarber-bonmed-monnym
# Exec /bin/get-urbit-code and/or /bin/reset-urbit-code in the container to change

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

  meta {
    uuid = uuidv4()
  }

  group "os" {
    network {
      port "http" {
        to = 80
      }
      port "ames" {
        static = 34343
      }
    }

    task "server" {
      driver = "docker"

      config {
        image = "tloncorp/vere:latest"
        ports = ["http"]
        command = "/bin/start-urbit"
        args = [
          # You can also set a variable loom size (Urbit memory size) using
          # --loom=$LOOM_SIZE. Passing /bin/start-urbit --loom=32 for example, would set up
          # a 4GiB loom (2^32 bytes = 4GiB). The default loom size is 31 (2GiB).
          "--loom=32",
        ]
        volumes = [
          "/data/services/urbit:/urbit",
        ]
      }

      service {
        name = "urbit"
        port = "http"

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

      resources {
        # dependent on --loom setting + some buffer
        memory = 4200
      }
    }
  }
}
