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

  group "collabora" {
    count = 1

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

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

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

    task "collabora" {
      driver = "docker"

      env {
          domain    	= "nextcloud\\.lajuntament\\.space"
          username  	= "lajuntament"
          password  	= "eLn1lIm4rc"
          extra_params	= "--o:ssl.enable=false"
      }

      volume_mount {
        volume      = "collabora"
        destination = "/etc/loolwsd"
        read_only   = false
      }

      config {
        image = "collabora/code:latest"
        ports = ["http"]
      }

      resources {
        cpu    = 1500
        memory = 1024
      }

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

    }
  }
}

