#!/bin/bash
# Un-deploy a mup-deployed Meteor app.
# Does not touch MongoDB databases.
# These commands must be run directly on the server with the
# mup-deployed Meteor app.
set -o nounset
app=$1
if [[ -z "$app" ]] # $app is an empty string.
then
echo $0 error: Must pass in mup app name.
exit 1
fi
if ! [[ -d /opt/$app && -f /etc/init/${app}.conf ]]
then
echo $0 error: Cannot find deployed app named $app
exit 1
fi
set -o xtrace
# Stop running app.
sudo stop $app
# Create place to trash un-deployed app. This is just in case you
# change your mind.
trash=/tmp/${app}-trash
sudo mkdir $trash
# Remove logs.
sudo mv /var/log/upstart/${app}.log* $trash
# Remove start/stop script.
sudo mv /etc/init/${app}.conf $trash
# Delete deployed app.
sudo mv /opt/${app} $trash
All this should eventually be sent upstream, this is just a proof-of-concept.
5 Likes
Thanks. I’m working on mup2 with the docker support. We can have something to that. And you can do the same. But only deleting the /opt/
is enough.
1 Like
This was of much help,
You can improve this bash code like
#!/bin/bash
# Un-deploy a mup-deployed Meteor app.
# Does not touch MongoDB databases.
# These commands must be run directly on the server with the
# mup-deployed Meteor app.
set -o nounset
if [[ -z "$1" ]] # $1 is an empty string.
then
echo $0 error: Must pass in mup app name.
exit 1
fi
# now set the app variable
app=$1
if ! [[ -d /opt/$app && -f /etc/init/${app}.conf ]]
then
echo $0 error: Cannot find deployed app named $app
exit 1
fi
set -o xtrace
# Stop running app.
sudo stop $app
# Create place to trash un-deployed app. This is just in case you
# change your mind.
trash=/tmp/${app}-trash
sudo mkdir $trash
# Remove logs.
sudo mv /var/log/upstart/${app}.log* $trash
# Remove start/stop script.
sudo mv /etc/init/${app}.conf $trash
# Delete deployed app.
sudo mv /opt/${app} $trash
isn’t there a way of putting it in some sort of maintenance mode?