Compare commits

...

3 commits
0.0.1 ... main

Author SHA1 Message Date
29f4e7b624
Add root check 2023-08-18 16:06:12 +12:00
9474ddd79a
Update README.md 2023-08-18 15:08:28 +12:00
aed90cda09
Clean up & comment 2023-08-18 14:57:20 +12:00
2 changed files with 12 additions and 7 deletions

View file

@ -1,4 +1,4 @@
# pixelfed-upgrade-script
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.

View file

@ -3,10 +3,18 @@
# CONFIGURATION #
WEB_ROOT=/var/www/pixelfed
WEB_USER=www-data
HORIZON_SERVICE=horizon.service
# END CONFIGURATION #
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"
@ -14,8 +22,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
systemctl restart $HORIZON_SERVICE