habitat-sh / habitat

Modern applications with built-in automation
https://www.habitat.sh
Apache License 2.0
2.61k stars 316 forks source link

Feature Request: synchronous flag for `hab svc <start/stop>` #2680

Open smartb-pair opened 7 years ago

smartb-pair commented 7 years ago

Inspiration for this feature comes from a flag used by svcadm on Illumos and Solaris distros, -s, which tells the service state change to be synchronous:

If the -s option is specified, svcadm disables each service instance and then waits for each service instance to enter the disabled state. svcadm will return early if it determines that the service cannot reach this state without administrator intervention.

Such a flag for hab svc <start/stop> would be extremely useful for things like Test Kitchen integration tests, orchestration with tools like Chef, Ansible, etc, and operator intervention.

chrisortman commented 7 years ago

I think this could also be useful when doing package development inside the studio. I <3 the the supervisor is already running and I can startup a background (database) process to bind to, but would be nice to do hab start see what I did wrong and ctrl+c to be done vs hab start && sup-log .. hab svc unload

smartb-pair commented 7 years ago

We keep finding more and more reasons we need synchronous start/stop/restart in orchestration and scripting tools - it's even proving difficult to judge when a service is up or down using hab svc status <svcname>.

eeyun commented 7 years ago

Yeah this is an excellent idea :) we're most definitely going to want a first class cli experience for this kind of thing.

smartb-pair commented 7 years ago

Upon further thought, we think it actually makes more sense for 'synchronous' mode to be the default, and async to be a flag.

smartb-pair commented 7 years ago

...aaaand just ran into this again today. Just confirms again that having hab svc start return immediately (when a package may be installing/starting in the background) makes programming with hab quite difficult/annoying :)

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.

bixu commented 4 years ago

This would still be a big win for CI flows.

themightychris commented 4 years ago

I'm constantly copy-pasting code from my health check hooks into sleep loops in CI flows, we need an easy command that leverages supervisor plumbing for start-service-and-wait-for-health

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We value your input and contribution. Please leave a comment if this issue still affects you.