initial release of update script

This commit is contained in:
nicedevil007 2022-06-18 23:10:00 +02:00 committed by GitHub
parent f68df8a372
commit 0176036622
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 53 additions and 0 deletions

53
misc/tandoor-update.sh Normal file
View File

@ -0,0 +1,53 @@
#!/bin/bash
TANDOORRELEASE=$(curl -s https://api.github.com/repos/TandoorRecipes/recipes/releases/latest \
| grep "tag_name" \
| awk '{print substr($2, 2, length($2)-3) }') \
RD=`echo "\033[01;31m"`
BL=`echo "\033[36m"`
CM='\xE2\x9C\x94\033'
GN=`echo "\033[1;92m"`
CL=`echo "\033[m"`
function update_info {
echo -e "${RD}
_______ _ _____ _
|__ __| | | | __ \ (_)
| | __ _ _ __ __| | ___ ___ _ __ | |__) | ___ ___ _ _ __ ___ ___
| | / _ || _ \ / _ | / _ \ / _ \ | '__| | _ / / _ \ / __|| || '_ \ / _ \/ __|
| || (_| || | | || (_| || (_) || (_) || | | | \ \| __/| (__ | || |_) || __/\__ \
|_| \__,_||_| |_| \__,_| \___/ \___/ |_| |_| \_\\___| \___||_|| .__/ \___||___/
| |
Update |_|
${CL}"
}
update_info
while true; do
read -p "This will Update Tandoor to $TANDOORRELEASE. Proceed(y/n)?" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
sleep 2
echo -e "${GN} Stopping Tandoor... ${CL}"
sudo systemctl restart gunicorn_recipes
sleep 1
echo -e "${GN} Updating to ${TANDOORRELEASE}... ${CL}"
cd /var/www/recipes
git pull
export $(cat /var/www/recipes/.env |grep "^[^#]" | xargs)
bin/python3 manage.py migrate
bin/python3 manage.py collectstatic --no-input
bin/python3 manage.py collectstatic_js_reverse
cd vue
yarn install
yarn build
sleep 1
echo -e "${GN} Starting Tandoor... ${CL}"
sudo systemctl restart gunicorn_recipes
sleep 1
echo -e "${GN} Finished Update ${CL}"