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

[Question] Graceful shutdown #589

Open
WayneUong opened this issue Apr 24, 2017 · 5 comments
Open

[Question] Graceful shutdown #589

WayneUong opened this issue Apr 24, 2017 · 5 comments

Comments

@WayneUong
Copy link

Is there an option for graceful shutdown during deployment?

@zodern
Copy link
Owner

zodern commented Jun 3, 2017

@WayneUong could you please give more details? Do you want to shutdown the app, or cancel while deploying the app?

@WayneUong
Copy link
Author

@zodern When the app is being deployed, I want to wait till all node processes are done before the old app is shut down and replaced with the new app.

@SimonSimCity
Copy link

SimonSimCity commented Jun 20, 2018

I was wondering about the same and found out the following:

The command mup stop and mup restart both execute the script https://github.com/zodern/meteor-up/blob/master/src/plugins/meteor/assets/meteor-stop.sh which (at the time writing) stop and remove all docker containers by running docker rm -f $APPNAME.

The documentation of docker states that docker rm -f CONTAINER sends the signal SIGKILL to the process running in this container (https://docs.docker.com/v1.11/engine/reference/commandline/rm/).

An article like https://www.ctl.io/developers/blog/post/gracefully-stopping-docker-containers/ explains very detailed how which of the possible versions of shutting down a container work.

My suggestion here is to replace the forcefully removing calls by something like the following:

# Gracefully stopping the meteor application
sudo docker stop -t $TIMEOUT $APPNAME || :

# Continue with forcefully stopping and removing
sudo docker rm -f $APPNAME || :
sudo docker rm -f $APPNAME-frontend || :
sudo docker rm -f $APPNAME-nginx-letsencrypt || :
sudo docker rm -f $APPNAME-nginx-proxy || :

Doing this will give us the possibility to e.g. gracefully shut down the connections to the client systems and make sure the code is finished and doesn't hick up in the middle of a function.

@SimonSimCity
Copy link

SimonSimCity commented Jun 20, 2018

To have a graceful shutdown here would also be nice to support this plugin: https://www.npmjs.com/package/@meteorjs/ddp-graceful-shutdown

It would also help me gracefully shutting down my HTTP server I have on Meteor (http://dillonbuchanan.com/programming/gracefully-shutting-down-a-nodejs-http-server/) and certainly also be necessary to detecting jobs that are stopped (vsivsi/meteor-job-collection@97822bf#diff-04c6e90faac2675aa89e2176d2eec7d8R2034).

@SimonSimCity
Copy link

See pull request #964

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants