I don't know if I understand the options of consul exec
...
I have a consul server and several consul clients: https://play.golang.org/p/s3N3r3lK9e (example of config files)
I would like to create a service to run a program in each client:
"service": {
"name": "runner", "port": 7700,
"check": {
"script": "/usr/local/bin/myApp --run"
}
}
When a new KV is written in Consul, I want to execute an app in server side to run the service called "runner" in a specific node, in other words I want to execute in my application consul exec -service=runner
to run another app (myApp --run) in the node client side. This is possible? This is the meaning of consul exec
?
If you don't understand the question, I can rewrite it.
Usually it's used for common jobs on all nodes. For example, something like this: sudo apt-get update
.
But, remember, it will be running on ALL nodes in cluster. So, if this command produce huge output, it will be the mess.
Secondly, there is no guarantee of execution.
For things like this I recommend to use system like Ansible, Chef, etc.