forked from jkenlooper/puzzle-massive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efb1d49
commit 5fe7c6c
Showing
15 changed files
with
133 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,63 @@ | ||
#!/usr/bin/env bash | ||
# not setting the -e or the option -o pipefail here. That way if a service fails | ||
# to stop the others will continue to stop. | ||
set -u | ||
|
||
COMMAND=$1 | ||
|
||
SKIP_BACKUP=0 | ||
if [ -n "${2-}" ]; then | ||
SKIP_BACKUP=$2 | ||
fi | ||
|
||
# Simple convenience script to control the apps. | ||
|
||
# Switch out nginx puzzle-massive.conf to puzzle-massive--down.conf to | ||
# show the down page. | ||
if test "${COMMAND}" == 'start'; then | ||
rm -f /etc/nginx/sites-enabled/puzzle-massive--down.conf; | ||
ln -sf /etc/nginx/sites-available/puzzle-massive.conf /etc/nginx/sites-enabled/puzzle-massive.conf; | ||
# Start the puzzle-massive-api first since other services depend on it. | ||
systemctl start puzzle-massive-api; | ||
systemctl start puzzle-massive-stream; | ||
systemctl start puzzle-massive-publish; | ||
systemctl start puzzle-massive-scheduler; | ||
systemctl start puzzle-massive-chill; | ||
systemctl start puzzle-massive-janitor; | ||
systemctl start puzzle-massive-artist; | ||
systemctl start puzzle-massive-backup-db.timer; | ||
systemctl reload nginx; | ||
|
||
elif test "${COMMAND}" == 'stop'; then | ||
rm -f /etc/nginx/sites-enabled/puzzle-massive.conf; | ||
ln -sf /etc/nginx/sites-available/puzzle-massive--down.conf /etc/nginx/sites-enabled/puzzle-massive--down.conf; | ||
# Stop the stream first before other apps. | ||
systemctl stop puzzle-massive-artist; | ||
systemctl stop puzzle-massive-chill; | ||
systemctl stop puzzle-massive-publish; | ||
systemctl stop puzzle-massive-scheduler; | ||
systemctl stop puzzle-massive-backup-db.timer; | ||
systemctl stop puzzle-massive-janitor; | ||
echo "Waiting for the puzzle-massive-stream connections..."; | ||
systemctl stop puzzle-massive-stream; | ||
systemctl stop puzzle-massive-chill; | ||
fi | ||
if test "${COMMAND}" == 'stop'; then | ||
# Now that the app isn't accepting any outside requests; transfer piece data | ||
# to SQL database from redis database. | ||
su dev -c "./bin/python api/api/jobs/convertPiecesToDB.py"; | ||
fi | ||
if [ "$SKIP_BACKUP" != "-f" ]; then | ||
su dev -c "bin/backup.sh -d /home/dev -c" | ||
fi | ||
# Stop the puzzle-massive-api last since other services depend on it. | ||
systemctl stop puzzle-massive-api; | ||
systemctl reload nginx; | ||
|
||
# Skipping the puzzle-massive-cache-purge.service since it is activated by path | ||
# Skipping divulger since it is not needed at the moment. | ||
# puzzle-massive-divulger \ | ||
for app in puzzle-massive-chill \ | ||
puzzle-massive-api \ | ||
puzzle-massive-publish \ | ||
puzzle-massive-stream \ | ||
puzzle-massive-artist \ | ||
puzzle-massive-scheduler \ | ||
puzzle-massive-backup-db.timer \ | ||
puzzle-massive-janitor; | ||
do | ||
echo ""; | ||
echo "systemctl $COMMAND $app;"; | ||
echo "----------------------------------------"; | ||
systemctl "$COMMAND" "$app" | cat; | ||
done; | ||
else | ||
for app in puzzle-massive-chill \ | ||
puzzle-massive-api \ | ||
puzzle-massive-publish \ | ||
puzzle-massive-stream \ | ||
puzzle-massive-artist \ | ||
puzzle-massive-scheduler \ | ||
puzzle-massive-backup-db.timer \ | ||
puzzle-massive-janitor; | ||
do | ||
echo ""; | ||
echo "systemctl $COMMAND $app;"; | ||
echo "----------------------------------------"; | ||
systemctl "$COMMAND" "$app" | cat; | ||
done; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.