whoogle-search/misc/heroku-regen.sh

30 lines
858 B
Bash
Raw Normal View History

2021-03-17 19:44:30 +03:00
#!/bin/bash
# Assumes this is being executed from a session that has already logged
# into Heroku with "heroku login -i" beforehand.
#
# You can set this up to run every night when you aren't using the
# instance with a cronjob. For example:
# 0 3 * * * /home/pi/whoogle-search/config/heroku-regen.sh <app_name>
HEROKU_CLI_SITE="https://devcenter.heroku.com/articles/heroku-cli"
2021-03-17 19:44:30 +03:00
if ! [[ -x "$(command -v heroku)" ]]; then
echo "Must have heroku cli installed: $HEROKU_CLI_SITE"
exit 1
fi
cd "$(builtin cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)/../"
2021-03-17 19:44:30 +03:00
if [[ $# -ne 1 ]]; then
echo -e "Must provide the name of the Whoogle instance to regenerate"
exit 1
fi
APP_NAME="$1"
2021-03-17 19:44:30 +03:00
heroku apps:destroy "$APP_NAME" --confirm "$APP_NAME"
heroku apps:create "$APP_NAME"
heroku container:login
heroku container:push web
heroku container:release web