add flarum rollback scripts

This commit is contained in:
Milan 2024-05-02 11:33:35 +02:00
parent 1a8b6d60d6
commit b5cebf05a2
4 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,6 @@
pac=
user=forum
db=${pac}_flarum
dbuser=${pac}_${user}
dump=$HOME/var/rollback/flarum.sql
domain=/home/doms/$(ls $HOME/doms) # Hostsharing eG specific

View File

@ -0,0 +1,15 @@
#!/bin/bash
set -e
source $HOME/scripts/config.env
cd $HOME/flarum
php ./flarum nearataMaintenanceMode:toggle true
echo "syncing data..."
rsync -aAX --delete $HOME/var/rollback/flarum/ $HOME/flarum/
echo "feeding the dump..."
mysql -u $dbuser $db < $dump
php ./flarum nearataMaintenanceMode:toggle false

View File

@ -0,0 +1,22 @@
#!/bin/bash
set -e
source $HOME/scripts/config.env
read -p "DANGER everything will be made permanent. Proceed? (Yy)" -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
fi
cd $HOME/flarum
php ./flarum nearataMaintenanceMode:toggle true
echo "creating database dump..."
mysqldump -u$dbuser $db --add-drop-table > $dump
echo "syncing flarum..."
rsync -aAX --delete /home/pacs/$pac/users/$user/flarum/ /home/pacs/$pac/users/$user/var/rollback/flarum/
php ./flarum nearataMaintenanceMode:toggle false

18
rollback/flarum/update.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
set -e
echo "calling for rollback.sh"
. $HOME/scripts/rollback.sh
php ./flarum nearataMaintenanceMode:toggle true
composer update --prefer-dist --no-plugins --no-dev -a --with-all-dependencies
php flarum migrate
php flarum cache:clear
echo "calling setstate.sh to make the update permanent"
echo "the following prompt is an opportunity to check whether the forum is still operational."
. $HOME/scripts/setstate.sh
echo
echo "all scripts done."