sevensolutions/nomad-iis

Run code that is in the allocation directory

Closed this issue · 2 comments

Hi,

I'm trying to understand how this driver works.

I have created a job using the sample_job.hcl example from the repo. This runs and creates an application inside IIS. As the application path is set to the wwwroot directory, it shows the default IIS "start page."

However, I would like it to run my code, which is in the allocation directory.

How can I achieve this?

Sorry for the confusion, the example is not very practical.

You can for example use nomads artifact block to download your own app from an artifacts repo, S3 etc.

https://developer.hashicorp.com/nomad/docs/job-specification/artifact

Something like that should do it:

job "iis-test" {
  datacenters = ["dc1"]
  type = "service"

  group "iis-test" {
    count = 1

    # You may want to set this to true
    # prevent_reschedule_on_lost = true
    
    network {
      port "httplabel" {}
    }

    task "iis-test" {
      driver = "iis"

      artifact {
        source = "https://github.com/sevensolutions/nomad-iis/raw/main/examples/static-sample-app.zip"
        destination = "local/app"
      }

      config {
        application {
          path = "local/app"
        }
        
        binding {
          type = "http"
          port = "httplabel"
        }
      }
      
      env {
        my_key = "my-value"
      }

      resources {
        cpu    = 100
        memory = 20
      }
    }
  }
}

Thanks, this example is much better. However it's still not working due to permission issues as described in #43