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

  meta {
    uuid = uuidv4()
  }

  group "os" {
    network {
      port "http" {
        to = 80
      }
    }

    task "server" {
      driver = "docker"

      config {
        image = "gitea.v.paler.net/ppetru/farmos:latest"
        ports = ["http"]
        volumes = [
          "/data/services/farmos/sites:/opt/drupal/web/sites",
          "/data/services/farmos/keys:/opt/drupal/keys",
        ]
      }

      service {
        name = "farmos"
        port = "http"
        check {
          type = "http"
          port = "http"
          path = "/health"
          interval = "30s"
          timeout = "2s"
        }

        tags = [
          "traefik.enable=true",
          "traefik.http.routers.farmos.entryPoints=websecure",
          "traefik.http.routers.farmos.rule=Host(`farm.alo.land`)",
        ]
      }

      resources {
        cpu = 2000
        memory = 1024
      }
    }
  }
}
