Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run code that is in the allocation directory #51

Closed
ElNinjaNerdT opened this issue May 23, 2024 · 2 comments
Closed

Run code that is in the allocation directory #51

ElNinjaNerdT opened this issue May 23, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@ElNinjaNerdT
Copy link

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?

@sevensolutions
Copy link
Owner

sevensolutions commented May 23, 2024

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
      }
    }
  }
}

@sevensolutions sevensolutions added documentation Improvements or additions to documentation question Further information is requested labels May 23, 2024
@ElNinjaNerdT
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants