From aed90cda098f2231ea84dcd8405a0edb3af802d8 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Fri, 18 Aug 2023 14:57:20 +1200 Subject: [PATCH 1/3] Clean up & comment --- update.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/update.sh b/update.sh index 02557ff..a99d3ed 100755 --- a/update.sh +++ b/update.sh @@ -3,6 +3,7 @@ # CONFIGURATION # WEB_ROOT=/var/www/pixelfed WEB_USER=www-data +HORIZON_SERVICE=horizon.service # END CONFIGURATION # set +x @@ -14,8 +15,5 @@ su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && php artisan config:cache" su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && php artisan route:cache" su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && php artisan migrate --force" -# Make sure we restart workers on new code too -sudo systemctl restart horizon.service - -#su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && php artisan horizon:purge" -#su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && php artisan storage:link" +# Make sure we restart Horizon workers too +sudo systemctl restart $HORIZON_SERVICE From 9474ddd79a858861d7361b3025d5483c72761200 Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Fri, 18 Aug 2023 15:08:28 +1200 Subject: [PATCH 2/3] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3e117c9..7a6ca75 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ # pixelfed-upgrade-script -A simple upgrade script to update pixelfed via cron nightly. - +A simple upgrade script to update pixelfed via cron nightly. +Simple set the Configuration values at the top and run this script when you want things updated. From 29f4e7b624686bf3fbe76e8a8bbf0011d6327c8f Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Fri, 18 Aug 2023 16:06:12 +1200 Subject: [PATCH 3/3] Add root check --- update.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/update.sh b/update.sh index a99d3ed..7538318 100755 --- a/update.sh +++ b/update.sh @@ -8,6 +8,13 @@ HORIZON_SERVICE=horizon.service set +x +# We want to su into web user, so lets be root +if [ "$EUID" -ne 0 ] + then echo "Please run as root" + exit +fi + +# Run the stuff su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && git pull" su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && composer install --no-ansi --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader" su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && composer dump-autoload --optimize" @@ -16,4 +23,4 @@ su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && php artisan route:cache" su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && php artisan migrate --force" # Make sure we restart Horizon workers too -sudo systemctl restart $HORIZON_SERVICE +systemctl restart $HORIZON_SERVICE