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

  group "folkugat" {
    count = 1

    restart {
      attempts = 5
      delay    = "15s"
    }

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

    # Volumes

    volume "folkugat" {
      type      = "host"
      read_only = false
      source    = "folkugat"
    }

    # FOLKUGAT WEB
    task "folkugat" {
      driver = "docker"

      env {
          JWT_SECRET = "12345"
          ADMIN_PASSWORD = "banshee"
          URL_SCHEME = "https"
          DB_DIR = "/folkugat/db"
      }

      config {
        image = "marc.sastre.cat/folkugat-web:latest"
        ports = ["http"]
      }

      volume_mount {
        volume      = "folkugat"
        destination = "/folkugat/db"
        read_only   = false
      }

      resources {
        cpu    = 100
        memory = 512
      }

      service {
        name = "folkugat"
        port = "http"
      }
    }
  }
}

