Skip to content

Added graceful timeout in seconds #964

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/plugins/meteor/assets/meteor-stop.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/bin/bash

APPNAME=<%= appName %>
TIMEOUT=<%= gracefulTimeout %>

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

sudo docker rm -f $APPNAME || :
sudo docker rm -f $APPNAME-frontend || :
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/meteor/assets/templates/start.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

APPNAME=<%= appName %>
TIMEOUT=<%= gracefulTimeout %>
CLIENTSIZE=<%= nginxClientUploadLimit %>
APP_PATH=/opt/$APPNAME
BUNDLE_PATH=$APP_PATH/current
Expand Down Expand Up @@ -28,6 +29,7 @@ echo "Volume" $VOLUME
>&2 echo "Removing docker containers. Errors about nonexistent endpoints and containers are normal.";

# Remove previous version of the app, if exists
sudo docker stop -t $TIMEOUT $APPNAME
sudo docker rm -f $APPNAME

# Remove container network if still exists
Expand Down
6 changes: 4 additions & 2 deletions src/plugins/meteor/command-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@ export function stop(api) {
list.executeScript('Stop Meteor', {
script: api.resolvePath(__dirname, 'assets/meteor-stop.sh'),
vars: {
appName: config.name
appName: config.name,
gracefulTimeout: config.gracefulTimeout || 10,
}
});

Expand All @@ -366,7 +367,8 @@ export function restart(api) {
list.executeScript('Stop Meteor', {
script: api.resolvePath(__dirname, 'assets/meteor-stop.sh'),
vars: {
appName: config.name
appName: config.name,
gracefulTimeout: config.gracefulTimeout || 10,
}
});

Expand Down
1 change: 1 addition & 0 deletions src/plugins/meteor/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function addStartAppTask(list, api) {
script: api.resolvePath(__dirname, 'assets/meteor-start.sh'),
vars: {
appName: appConfig.name,
gracefulTimeout: appConfig.gracefulTimeout || 10,
removeImage: isDeploy && !prepareBundleSupported(appConfig.docker)
}
});
Expand Down