-
Notifications
You must be signed in to change notification settings - Fork 62
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
support exec for nomad alloc exec
and change_mode = script
#193
Comments
Hi @Procsiab! Just for clarity the error message you're getting here is saying that the task driver doesn't have the capability to execute scripts inside tasks. That means you can't use It looks like it's possible in podman (ref https://docs.podman.io/en/latest/markdown/podman-exec.1.html) but just not implemented yet. I'm going to update the title of this issue and mark it as a feature request. |
nomad alloc exec
and change_mode = script
Thanks for you clear explaination @tgross! I did not figure out that the |
@Procsiab the driver does support Example:
I did never try to use it within the template stanza, though. @tgross is there anything special when using it in this context? I can remember that there was some oddity when running scripted health checks, which might be related. |
I can confirm @towe75 's observation on manual execution of commands inside containers with the |
Hello there, it has been some time since latest update; however I am updating the issue with good news: I am not able to reproduce anymore my issue using a My Nomad job uses:
An extract from my job file: template {
data = <<EOH
{{ lookup('file', 'applications/caddy/Caddyfile.tpl') }}
EOH
destination = "local/Caddyfile"
change_mode = "script"
change_script {
command = "/usr/bin/caddy"
args = ["reload", "--config", "/local/Caddyfile", "--adapter", "caddyfile"]
timeout = "5s"
fail_on_error = true
}
}
The Nomad allocation logs on the reload event:
I can also confirm that the same allocation stays alive and reloads without stopping the undelrlying container. |
Hello, I am facing an error in trying to run a Job with a Template using the "new"
change_mode = "script"
. My main goal would be to trigger an Nginx reload whenever its templated configuration file changes.First of all, here it is the reference documentation for this template feature; in addition, below there is the snippet of that templated task from my Nomad Job file:
When I run the job with the task templated in such a way, it starts without errors; however, if I try to restart its Allocation, then the template re-render is triggered and the following error occurs until I stop the Job and then run it again:
Then after the second restart attempt:
My environment is the following:
If you need more information I am willing to help you in testing this use case: at the moment I am using the
change_mode = "restart"
orsignal
where I can pass that to the container, but this is not always Ideal since restarting a Task may lead to service unavailability.The text was updated successfully, but these errors were encountered: