Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Plugin management utility - plugin stop #367

Merged
merged 4 commits into from
Jan 19, 2017

Conversation

chungers
Copy link
Contributor

@chungers chungers commented Jan 18, 2017

This PR tries to address a common complaint about running Infrakit: starting and stopping of plugins. Plugin servers now write a <name>.pid file in the same plugin discovery directory. For non-containerized cases, the pid is used by a new command line verb infrakit plugin stop to send SIGTERM to the plugin processes for force clean shutdown. On shutting down the PID file is removed cleanly as is with the socket file.

  • CLI / mains now write a PID file (see pkg/cli/serverutil.go) and cleanup on shutdown.
  • Change discovery to be less noisy when seeing a non-socket file (which can be a pid file).
  • Added a new verb stop under infrakit plugin. This simply reads the pid files and send SIGTERM to the process: in essence it does kill -TERM $(cat /plugins/plugin.pid).
  • Incorporated this command in the e2e script - scripts/e2e-test.sh.

This is useful for stopping the plugins when the starter infrakit plugin start exits (no --wait option) and the plugins become orphaned (adopted by init). Another applicable scenario is when the config json (e.g. scripts/e2e-test-plugins.json) used by the start utility has specified the plugins be running in a separate process group -- which also will leave the plugins running after the starter exits.

Workflow:

$ ~/projects/src/github.com/docker/infrakit/build/infrakit plugin start --os --config-url file://$PWD/scripts/e2e-test-plugins.json group-default
Starting up group-default
# .... lots of logs
$ ~/projects/src/github.com/docker/infrakit/build/infrakit plugin ls
NAME                	LISTEN
group-stateless     	/Users/me/.infrakit/plugins/group-stateless
~/projects/src/github.com/docker/infrakit$ build/infrakit plugin stop group-stateless
# ... logs

David Chung added 3 commits January 18, 2017 12:34
Signed-off-by: David Chung <david.chung@docker.com>
Signed-off-by: David Chung <david.chung@docker.com>
Signed-off-by: David Chung <david.chung@docker.com>
@codecov-io
Copy link

codecov-io commented Jan 18, 2017

Current coverage is 65.14% (diff: 25.00%)

Merging #367 into master will decrease coverage by 0.60%

@@             master       #367   diff @@
==========================================
  Files            47         47          
  Lines          2275       2284     +9   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits           1496       1488     -8   
- Misses          617        630    +13   
- Partials        162        166     +4   

Powered by Codecov. Last update f432fa4...2dfe170

Signed-off-by: David Chung <david.chung@docker.com>
@chungers chungers merged commit 21dc4cd into docker-archive:master Jan 19, 2017
@chungers chungers modified the milestone: v0.3 Jan 31, 2017
chungers pushed a commit to chungers/infrakit that referenced this pull request Sep 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants