job "registry" {
  region      = "global"
  datacenters = ["samfelag"]
  type        = "service"

  group "registry" {
    count = 1

    restart {
      attempts = 5
      delay    = "1m"
    }

    network {
      port "http" {
        to     = 5000
      }
    }

    task "registry" {
      driver = "docker"

      env {
	      REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY = "/data"
      }

      config {
        image = "registry:2"
        ports = ["http"]
	    volumes = ["/mnt/vatnajokull/nomad_volumes/registry:/data"]
      }

      resources {
        cpu    = 100
        memory = 256
      }

      service {
        name = "registry"
        port = "http"

        check {
          type     = "tcp"
          port     = "http"
          interval = "30s"
          timeout  = "2s"
        }
      }
    }
  }
}

