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

  group "webhooks" {
    count = 1

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

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

    task "webhooks" {
      driver = "docker"

      env {
          CONFIG_FILE = "/app/data/config.json"
      }

      config {
        image = "marc.sastre.cat/webhooks:latest"
        ports = ["http"]
	    volumes = ["/mnt/vatnajokull/nomad_volumes/webhooks:/app/data"]
      }

      resources {
        cpu    = 100
        memory = 128
      }

      service {
        name = "webhooks"
        port = "http"

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

