job "waypoint-server" {
  datacenters = ["dc1"]
  type        = "service"

  group "waypoint" {
    count = 1
    
    volume "waypoint-data" {
      type      = "host"
      read_only = false
      source    = "waypoint-data"
    }

    network {
      port "http" {
        static = 9701
      }
      port "grpc" {
        static = 9702
      }
    }


    task "waypoint" {
      driver = "exec"
      
      
      volume_mount {
        volume      = "waypoint-data"
        destination = "/opt/waypoint"
        read_only   = false
      }

      config {
        command = "/usr/local/bin/waypoint"
        
        args = [
          "server", "run",
          "-accept-tos",
          "-vvv",
          "-db=/opt/waypoint/waypoint.db",
          "-listen-grpc=0.0.0.0:9702",
          "-listen-http=0.0.0.0:9701"
        ]
      }

      resources {
        cpu    = 500
        memory = 512
      }

      env {
        WAYPOINT_LOG_LEVEL = "DEBUG"
      }
    }
  }
}