initial commit
This commit is contained in:
commit
1a8b6d60d6
5
rollback/nextcloud/config.env
Normal file
5
rollback/nextcloud/config.env
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
pac=xyz00
|
||||||
|
user=
|
||||||
|
db=${pac}_${user}
|
||||||
|
dbuser=$db
|
||||||
|
dump=$HOME/var/db/nextcloud.dump
|
20
rollback/nextcloud/rollback.sh
Normal file
20
rollback/nextcloud/rollback.sh
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
if [ -z ${php} ]; then
|
||||||
|
php="php8.2"
|
||||||
|
fi
|
||||||
|
source $HOME/scripts/config.env
|
||||||
|
|
||||||
|
cd $HOME/nextcloud
|
||||||
|
$php occ maintenance:mode --on
|
||||||
|
|
||||||
|
echo "syncing data..."
|
||||||
|
rsync -aAX --delete /home/storage/$pac/users/$user/data_clean/ /home/storage/$pac/users/$user/data/
|
||||||
|
echo "syncing nextcloud..."
|
||||||
|
rsync -aAX --delete /home/pacs/$pac/users/$user/nextcloud_clean/ /home/pacs/$pac/users/$user/nextcloud/
|
||||||
|
echo "feeding the dump..."
|
||||||
|
pg_restore -c -h localhost -U $dbuser -d $db < $dump
|
||||||
|
|
||||||
|
$php occ maintenance:mode --off
|
||||||
|
echo
|
||||||
|
echo done.
|
23
rollback/nextcloud/setstate.sh
Normal file
23
rollback/nextcloud/setstate.sh
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
source $HOME/scripts/config.env
|
||||||
|
|
||||||
|
read -p "DANGER – everything including config.php will be made permanent. Proceed? (Yy)" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # https://stackoverflow.com/questions/1885525/how-do-i-prompt-a-user-for-confirmation-in-bash-script
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $HOME/nextcloud
|
||||||
|
|
||||||
|
$php occ maintenance:mode --on
|
||||||
|
|
||||||
|
echo "creating database dump..."
|
||||||
|
pg_dump -Fc -U $dbuser -d $db > $HOME/var/db/nextcloud.dump
|
||||||
|
|
||||||
|
echo "syncing data..."
|
||||||
|
rsync -aAX --delete /home/storage/$pac/users/$user/data/ /home/storage/$pac/users/$user/data_clean/
|
||||||
|
echo "syncing nextcloud..."
|
||||||
|
rsync -aAX --delete /home/pacs/$pac/users/$user/nextcloud/ /home/pacs/$pac/users/$user/nextcloud_clean/
|
||||||
|
|
||||||
|
$php occ maintenance:mode --off
|
40
rollback/nextcloud/update.sh
Normal file
40
rollback/nextcloud/update.sh
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# +x does not apply
|
||||||
|
# use correct order – eg: sudo -u www-data php=php8.2 ...
|
||||||
|
if [ -z ${php} ]; then
|
||||||
|
php="php8.2"
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -p "DANGER – Updating will also rollback this Nextcloud. Proceed? (Yy)" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # https://stackoverflow.com/questions/1885525/how-do-i-prompt-a-user-for-confirmation-in-bash-script
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "calling for rollback.sh"
|
||||||
|
. $HOME/scripts/rollback.sh
|
||||||
|
|
||||||
|
echo "proceeding with the update"
|
||||||
|
|
||||||
|
$php occ maintenance:mode --on
|
||||||
|
|
||||||
|
$php updater/updater.phar -v --no-backup --no-interaction
|
||||||
|
|
||||||
|
$php occ db:add-missing-primary-keys --no-interaction
|
||||||
|
$php occ db:add-missing-columns --no-interaction
|
||||||
|
$php occ db:add-missing-indices --no-interaction
|
||||||
|
$php occ db:convert-filecache-bigint --no-interaction
|
||||||
|
|
||||||
|
$php occ app:update --all -n --no-ansi
|
||||||
|
|
||||||
|
echo "calling setstate.sh to make the update permanent"
|
||||||
|
. $HOME/scripts/setstate.sh
|
||||||
|
|
||||||
|
# since it appears to be unreliable at times
|
||||||
|
$php occ maintenance:mode --off
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "all scripts done."
|
17
rollback/readme.md
Normal file
17
rollback/readme.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
Das Ziel ist eine Anwendung regelmäßig auf einen alten Stand zu bringen. Aktuell ist das noch recht simpel, proof-of-concept mäßig und kann sicher noch besser gelöst werden.
|
||||||
|
|
||||||
|
### restore.sh
|
||||||
|
|
||||||
|
Einfaches Einspielen einer Datenbank.
|
||||||
|
|
||||||
|
### restore-with-files.sh
|
||||||
|
|
||||||
|
Einspielen der Datenbank und Wiederherstellen der Dateien
|
||||||
|
|
||||||
|
### Cron
|
||||||
|
|
||||||
|
Ein Cron-Eintrag kann wiefolgt aussehen:
|
||||||
|
|
||||||
|
```
|
||||||
|
@daily $HOME/scripts/restore.sh > $HOME/var/log/restore.log 2>&1
|
||||||
|
```
|
24
rollback/restore.sh
Normal file
24
rollback/restore.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
app=keycloak # service and (optional) dumpfile name
|
||||||
|
db=db123_user
|
||||||
|
user=$db
|
||||||
|
dump=$HOME/var/db/$app.dump
|
||||||
|
|
||||||
|
# ensure systemctl --user works
|
||||||
|
export XDG_RUNTIME_DIR=/run/user/$UID
|
||||||
|
|
||||||
|
echo "stopping $app..."
|
||||||
|
systemctl stop --user $app
|
||||||
|
|
||||||
|
echo "restoring database..."
|
||||||
|
# -c drops all objects that are to be restored
|
||||||
|
pg_restore -c -h localhost -U $user -d $db < $dump
|
||||||
|
|
||||||
|
systemctl start --user $app
|
||||||
|
|
||||||
|
echo "started $app..."
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
systemctl status --user $app
|
6
rollback/synapse/config.env
Normal file
6
rollback/synapse/config.env
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
pac=
|
||||||
|
user=matrix
|
||||||
|
db=${pac}_${user}
|
||||||
|
dbuser=$db
|
||||||
|
dump=$HOME/var/rollback/synapse.dump
|
||||||
|
domain=/home/doms/$(ls $HOME/doms) # Hostsharing eG specific
|
17
rollback/synapse/rollback.sh
Normal file
17
rollback/synapse/rollback.sh
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
source $HOME/scripts/config.env
|
||||||
|
|
||||||
|
monit stop synapse
|
||||||
|
|
||||||
|
echo "syncing data..."
|
||||||
|
rsync -aAX --delete $HOME/var/rollback/media_store_clean/ $HOME/synapse/media_store/
|
||||||
|
|
||||||
|
echo "feeding the dump..."
|
||||||
|
pg_restore -c -h localhost -U $dbuser -d $db < $dump
|
||||||
|
|
||||||
|
monit start synapse
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
curl https://$(ls $HOME/doms)/_synapse/admin/v1/server_version|jq .
|
15
rollback/synapse/setstate.sh
Normal file
15
rollback/synapse/setstate.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
source $HOME/scripts/config.env
|
||||||
|
|
||||||
|
read -p "DANGER – uploads & database will be made permanent. Proceed? (Yy)" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # https://stackoverflow.com/questions/1885525/how-do-i-prompt-a-user-for-confirmation-in-bash-script
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "syncing data..."
|
||||||
|
rsync -aAX --delete $HOME/synapse/media_store/ $HOME/var/rollback/media_store_clean/
|
||||||
|
|
||||||
|
echo "creating the dump..."
|
||||||
|
pg_dump -Fc -U $dbuser -d $db > $dump
|
28
rollback/synapse/update.sh
Normal file
28
rollback/synapse/update.sh
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
read -p "DANGER – Updating will also rollback this Synapse. Proceed? (Yy)" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # https://stackoverflow.com/questions/1885525/how-do-i-prompt-a-user-for-confirmation-in-bash-script
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ">>> calling for rollback.sh"
|
||||||
|
. $HOME/scripts/rollback.sh
|
||||||
|
|
||||||
|
# rollback stops and starts on its own
|
||||||
|
monit stop synapse
|
||||||
|
|
||||||
|
echo ">>> proceeding with the update"
|
||||||
|
|
||||||
|
source ~/synapse/env/bin/activate
|
||||||
|
pip install --upgrade matrix-synapse[postgres] pip
|
||||||
|
|
||||||
|
echo ">>> calling setstate.sh to make the update permanent"
|
||||||
|
. $HOME/scripts/setstate.sh
|
||||||
|
|
||||||
|
monit start synapse
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
curl https://$(ls $HOME/doms)/_synapse/admin/v1/server_version|jq .
|
6
rollback/taiga/config.env
Normal file
6
rollback/taiga/config.env
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
pac=
|
||||||
|
user=projects
|
||||||
|
db=${pac}_${user}
|
||||||
|
dbuser=$db
|
||||||
|
dump=$HOME/var/rollback/taiga.dump
|
||||||
|
domain=/home/doms/$(ls $HOME/doms) # Hostsharing eG specific
|
11
rollback/taiga/restart.sh
Normal file
11
rollback/taiga/restart.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
source $HOME/scripts/config.env
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo ">>> Attempting to restart the application at $domain..."
|
||||||
|
echo ">>> If it is not detected try to properly load the environment"
|
||||||
|
echo ">>> Example: su - $pac-$user"
|
||||||
|
echo
|
||||||
|
passenger-config restart-app $domain
|
12
rollback/taiga/rollback.sh
Normal file
12
rollback/taiga/rollback.sh
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
source $HOME/scripts/config.env
|
||||||
|
|
||||||
|
echo "syncing data..."
|
||||||
|
rsync -aAX --delete $HOME/var/rollback/media_clean/user/ $HOME/data/media/user/
|
||||||
|
|
||||||
|
echo "feeding the dump..."
|
||||||
|
pg_restore -c -h localhost -U $dbuser -d $db < $dump
|
||||||
|
|
||||||
|
. $HOME/scripts/restart.sh
|
15
rollback/taiga/setstate.sh
Normal file
15
rollback/taiga/setstate.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
source $HOME/scripts/config.env
|
||||||
|
|
||||||
|
read -p "DANGER – uploads & database will be made permanent. Proceed? (Yy)" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # https://stackoverflow.com/questions/1885525/how-do-i-prompt-a-user-for-confirmation-in-bash-script
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "syncing data..."
|
||||||
|
rsync -aAX --delete $HOME/data/media/user/ $HOME/var/rollback/media_clean/user/
|
||||||
|
|
||||||
|
echo "creating the dump..."
|
||||||
|
pg_dump -Fc -U $dbuser -d $db > $dump
|
47
rollback/taiga/update.sh
Normal file
47
rollback/taiga/update.sh
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# WIP
|
||||||
|
set -e
|
||||||
|
|
||||||
|
taiga_back="$HOME/taiga-back"
|
||||||
|
taiga_front="$HOME/taiga-front-dist"
|
||||||
|
|
||||||
|
read -p "DANGER – Updating will also rollback this Taiga. Proceed? (Yy)" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # https://stackoverflow.com/questions/1885525/how-do-i-prompt-a-user-for-confirmation-in-bash-script
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ">>> calling for rollback.sh"
|
||||||
|
. $HOME/scripts/rollback.sh
|
||||||
|
|
||||||
|
echo ">>> proceeding with the update"
|
||||||
|
cd $taiga_back
|
||||||
|
git pull
|
||||||
|
|
||||||
|
release=`git tag --sort=taggerdate | grep -E '[0-9]' | tail -1`
|
||||||
|
#current_release=`git describe --abbrev=0 --tags`
|
||||||
|
export DJANGO_SETTINGS_MODULE=settings.config
|
||||||
|
|
||||||
|
function pipupdate {
|
||||||
|
source .venv/bin/activate
|
||||||
|
pip install --upgrade pip wheel
|
||||||
|
pip install -r requirements.txt
|
||||||
|
}
|
||||||
|
function backupdate {
|
||||||
|
pipupdate
|
||||||
|
pip install git+https://github.com/kaleidos-ventures/taiga-contrib-protected.git@$release#egg=taiga-contrib-protected
|
||||||
|
python manage.py migrate --noinput
|
||||||
|
python manage.py compilemessages
|
||||||
|
python manage.py collectstatic --noinput
|
||||||
|
}
|
||||||
|
|
||||||
|
backupdate
|
||||||
|
|
||||||
|
cd $taiga_front
|
||||||
|
git pull
|
||||||
|
|
||||||
|
echo ">>> calling setstate.sh to make the update permanent"
|
||||||
|
. $HOME/scripts/setstate.sh
|
||||||
|
|
||||||
|
. $HOME/scripts/restart.sh
|
6
rollback/wordpress/config.env
Normal file
6
rollback/wordpress/config.env
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
pac=
|
||||||
|
user=blog
|
||||||
|
db=${pac}_${user}
|
||||||
|
dbuser=$db
|
||||||
|
dump=$HOME/var/rollback/wordpress.sql
|
||||||
|
domain=/home/doms/$(ls $HOME/doms) # Hostsharing eG specific
|
10
rollback/wordpress/rollback.sh
Normal file
10
rollback/wordpress/rollback.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
source $HOME/scripts/config.env
|
||||||
|
|
||||||
|
echo "syncing data..."
|
||||||
|
rsync -aAX --delete $HOME/var/rollback/wp-content/ $HOME/wordpress/wp-content/
|
||||||
|
|
||||||
|
echo "feeding the dump..."
|
||||||
|
mysql -u $dbuser $db < $dump
|
10
rollback/wordpress/setstate.sh
Normal file
10
rollback/wordpress/setstate.sh
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
source $HOME/scripts/config.env
|
||||||
|
|
||||||
|
echo "syncing data..."
|
||||||
|
rsync -aAX --delete $HOME/wordpress/wp-content/ $HOME/var/rollback/wp-content/
|
||||||
|
|
||||||
|
echo "creating a new dump"
|
||||||
|
mysqldump -u$dbuser $db --add-drop-table > $HOME/var/rollback/wordpress.sql
|
75
updates/dokuwiki.sh
Normal file
75
updates/dokuwiki.sh
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "WARNING: not well tested, please check the script first"
|
||||||
|
echo "WARNING: make sure to adjust required configs and plugins WITHIN THE SCRIPT before running initially!"
|
||||||
|
echo "FIXME: rsync might be more elegant midterm..."
|
||||||
|
echo "waiting 5s."
|
||||||
|
echo
|
||||||
|
sleep 5
|
||||||
|
|
||||||
|
mkdir -p $HOME/tmp
|
||||||
|
cd $HOME/tmp
|
||||||
|
|
||||||
|
# we prepare the update here in order to
|
||||||
|
# properly locate the target directory below
|
||||||
|
wget -q "https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz"
|
||||||
|
echo "Download completed."
|
||||||
|
tar xzf dokuwiki-stable.tgz
|
||||||
|
echo "Extracting completed."
|
||||||
|
rm -v *tgz*
|
||||||
|
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
releasedir=`ls $HOME/tmp/`
|
||||||
|
domain=`ls $HOME/doms/`
|
||||||
|
|
||||||
|
# define files we need to keep
|
||||||
|
plugins="backlinks,hostsharing,testing"
|
||||||
|
configs="acl.auth.php,plugins.local.php,local.php,users.auth.php"
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
read -p "Our domain appears to be: [ $domain ]. Is this correct? (yY)" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
target="$HOME/doms/$domain/htdocs-ssl"
|
||||||
|
oldversion=`cat $target/VERSION`
|
||||||
|
olddir=`readlink $target`
|
||||||
|
|
||||||
|
echo "The link target will be [ $target ]."
|
||||||
|
echo "The old directory was [ $olddir ]"
|
||||||
|
read -p "Our release dir appears to be: [ $releasedir ] and we are coming from [ $oldversion ]. Is this correct? (yY)" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Moving [ $releasedir ] home..."
|
||||||
|
mv -v $HOME/tmp/$releasedir $HOME/
|
||||||
|
|
||||||
|
cd $HOME
|
||||||
|
echo "Replacing the link in [ $target ]"
|
||||||
|
|
||||||
|
rm -v $target
|
||||||
|
ln -sv $HOME/$releasedir $target
|
||||||
|
cp -v $olddir/conf/{$configs} $target/conf/
|
||||||
|
|
||||||
|
echo "[ ! ] only known plugins will be copied over."
|
||||||
|
echo "[ ! ] please compare and configure the script accordingly"
|
||||||
|
|
||||||
|
cp -rp $olddir/lib/plugins/{$plugins} $target/lib/plugins/
|
||||||
|
echo "Copied [ $plugins ] to target."
|
||||||
|
|
||||||
|
echo "Copying .htaccess"
|
||||||
|
cp -vp $olddir/.htaccess $target/
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "All done!"
|
||||||
|
echo "Check the changelog: https://www.dokuwiki.org/changes"
|
||||||
|
echo "Check extensions for updates."
|
33
updates/element.sh
Normal file
33
updates/element.sh
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# we could also do a "jq -r '.assets[0].browser_download_url'"
|
||||||
|
# but we rather reuse that tag later because the download_url
|
||||||
|
# tends to be static anyways
|
||||||
|
release=`curl -L https://api.github.com/repos/element-hq/element-web/releases/latest -s | jq -r '.tag_name'`
|
||||||
|
|
||||||
|
basedir="$HOME"
|
||||||
|
deploydir="$basedir/element"
|
||||||
|
tmpdir=/tmp/$USER
|
||||||
|
|
||||||
|
mkdir -p $tmpdir
|
||||||
|
cd $tmpdir
|
||||||
|
|
||||||
|
echo ">>> downloading and extracting Element $release"
|
||||||
|
wget -q --show-progress https://github.com/element-hq/element-web/releases/download/$release/element-$release.tar.gz
|
||||||
|
tar -zxf element-$release.tar.gz
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo ">>> syncing $tmpdir/element-$release to $deploydir/"
|
||||||
|
rsync -aAX --delete --exclude="config.json" $tmpdir/element-$release/ $deploydir/
|
||||||
|
|
||||||
|
#echo ">>> (re)linking config (just in case)"
|
||||||
|
#ln -sv $basedir/config.json $basedir/element/
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo ">>> cleaning up..."
|
||||||
|
rm -r $tmpdir/element-$release
|
||||||
|
rm $tmpdir/element*.tar.gz
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo ">>> done."
|
25
updates/fluffychat.sh
Normal file
25
updates/fluffychat.sh
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
# ! wip !
|
||||||
|
# if failing: $HOME/tools/flutter/bin/flutter upgrade
|
||||||
|
|
||||||
|
basedir=$HOME/fluffychat
|
||||||
|
flutter=$HOME/tools/flutter/bin/flutter
|
||||||
|
release=`curl -L https://api.github.com/repos/krille-chan/fluffychat/releases/latest -s | jq -r '.tag_name'`
|
||||||
|
current=v`cat $basedir/build/web/version.json|jq .version|tr -d '"'`
|
||||||
|
|
||||||
|
echo ">>> latest Fluffychat appears to be $release, we are on $current."
|
||||||
|
|
||||||
|
if [[ ! $release == $current ]]
|
||||||
|
then
|
||||||
|
echo ">>> checking out Fluffychat $release"
|
||||||
|
cd $HOME/fluffychat
|
||||||
|
git fetch
|
||||||
|
git checkout $release
|
||||||
|
$flutter build web --release
|
||||||
|
echo ">>> done."
|
||||||
|
echo ">>> Fluffychat is now at $release."
|
||||||
|
else
|
||||||
|
echo ">>> nothing to do:"
|
||||||
|
cat $basedir/build/web/version.json|jq
|
||||||
|
fi
|
51
updates/keila.sh
Normal file
51
updates/keila.sh
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
set -e
|
||||||
|
|
||||||
|
export XDG_RUNTIME_DIR=/run/user/$UID
|
||||||
|
export MIX_ENV=prod
|
||||||
|
|
||||||
|
basedir=$HOME/var/keila
|
||||||
|
release=`curl -Ls https://api.github.com/repos/pentacent/keila/releases/latest | jq -r '.tag_name'`
|
||||||
|
oldrelease=`$HOME/bin/keila version | cut -d " " -f2-`
|
||||||
|
tools=$basedir/.tool-versions
|
||||||
|
erlang_ver=$(grep "erlang" "$tools" | awk '{print $2}')
|
||||||
|
elixir_ver=$(grep "elixir" "$tools" | awk '{print $2}')
|
||||||
|
|
||||||
|
echo "=== Old Keila is at [ $oldrelease ], latest release is [ $release ] ==="
|
||||||
|
read -p "=> Reply yY to proceed..." -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $basedir
|
||||||
|
git fetch
|
||||||
|
git checkout $release
|
||||||
|
|
||||||
|
. "$HOME/.asdf/asdf.sh"
|
||||||
|
. "$HOME/.asdf/completions/asdf.bash"
|
||||||
|
|
||||||
|
asdf install erlang $erlang_ver
|
||||||
|
asdf install elixir $elixir_ver
|
||||||
|
|
||||||
|
systemctl stop --user keila
|
||||||
|
|
||||||
|
cd $basedir
|
||||||
|
|
||||||
|
mix local.hex --force
|
||||||
|
mix local.rebar --force
|
||||||
|
mix deps.get
|
||||||
|
mix deps.compile
|
||||||
|
|
||||||
|
npm ci --prefix ./assets
|
||||||
|
|
||||||
|
mix deps.clean mime --build
|
||||||
|
mix assets.deploy
|
||||||
|
mix release
|
||||||
|
|
||||||
|
systemctl start --user keila
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
systemctl status --user keila
|
||||||
|
|
54
updates/keycloak.sh
Normal file
54
updates/keycloak.sh
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "ERROR: Can't continue. Version querying not implemented, because we might not use the latest major release."
|
||||||
|
echo "Usage: bash ./update.sh 9.9.9"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
export XDG_RUNTIME_DIR=/run/user/$UID
|
||||||
|
|
||||||
|
location=$HOME
|
||||||
|
olddir=`readlink $location/latest`
|
||||||
|
|
||||||
|
# becomes $location/latest/themes/themename
|
||||||
|
# script does not require this to function
|
||||||
|
#themename=mytheme
|
||||||
|
|
||||||
|
systemctl stop --user keycloak
|
||||||
|
|
||||||
|
cd $location
|
||||||
|
|
||||||
|
# FIXME: move to rsync or use git tags directly
|
||||||
|
wget "https://github.com/keycloak/keycloak/releases/download/$1/keycloak-$1.zip"
|
||||||
|
unzip keycloak-$1.zip
|
||||||
|
rm keycloak-$1.zip
|
||||||
|
|
||||||
|
[ -L $location/latest ] && rm -v $location/latest
|
||||||
|
ln -sv $location/keycloak-$1 $location/latest
|
||||||
|
|
||||||
|
# default config got the same filename!
|
||||||
|
rm -v $location/latest/conf/keycloak.conf
|
||||||
|
ln -sv $location/config/* $location/latest/conf/
|
||||||
|
|
||||||
|
if [ -z ${themename+x} ];
|
||||||
|
# FIXME: had trouble with symlinking but might have been a coincidence
|
||||||
|
then
|
||||||
|
echo "Theme directory is not configured for this script."
|
||||||
|
echo "Uncomment its variable of needed."
|
||||||
|
echo "Checking directories in ./themes of old install:"
|
||||||
|
find $olddir/themes -maxdepth 1 -mindepth 1 -type d
|
||||||
|
echo
|
||||||
|
echo "Proceeding..."
|
||||||
|
else
|
||||||
|
cp -rp $location/theme $location/latest/themes/$themename;
|
||||||
|
fi
|
||||||
|
|
||||||
|
bash $location/latest/bin/kc.sh build
|
||||||
|
|
||||||
|
systemctl start --user keycloak
|
||||||
|
|
||||||
|
sleep 2
|
||||||
|
|
||||||
|
systemctl status --user keycloak
|
24
updates/nextcloud.sh
Normal file
24
updates/nextcloud.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# +x does not apply
|
||||||
|
# use correct order – eg: sudo -u www-data php=php8.2 ...
|
||||||
|
if [ -z ${php} ]; then
|
||||||
|
php="php8.1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -f cron.log ] && rm -v cron.log && echo "logfiles should not be here and upset the updater. consider the data directory."
|
||||||
|
|
||||||
|
$php occ maintenance:mode --on
|
||||||
|
|
||||||
|
$php updater/updater.phar -v --no-backup --no-interaction
|
||||||
|
|
||||||
|
$php occ db:add-missing-primary-keys --no-interaction
|
||||||
|
$php occ db:add-missing-columns --no-interaction
|
||||||
|
$php occ db:add-missing-indices --no-interaction
|
||||||
|
$php occ db:convert-filecache-bigint --no-interaction
|
||||||
|
|
||||||
|
$php occ app:update --all -n --no-ansi
|
||||||
|
|
||||||
|
# since it appears to be unreliable at times
|
||||||
|
$php occ maintenance:mode --off
|
23
updates/synapse-admin.sh
Normal file
23
updates/synapse-admin.sh
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
release=`curl -Ls https://api.github.com/repos/Awesome-Technologies/synapse-admin/releases/latest | jq -r '.tag_name'`
|
||||||
|
|
||||||
|
# warning: unarchives all the files without the usual parent dir!
|
||||||
|
workdir=/tmp/$USER-synapseadmin
|
||||||
|
target= #$HOME/synapse-admin
|
||||||
|
|
||||||
|
if [ -z ${target+x} ];
|
||||||
|
then
|
||||||
|
echo "target appears to be unset"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p $workdir
|
||||||
|
cd $workdir
|
||||||
|
|
||||||
|
wget https://github.com/Awesome-Technologies/synapse-admin/releases/download/$release/synapse-admin-$release.tar.gz
|
||||||
|
tar -xf synapse-admin-$release.tar.gz
|
||||||
|
rsync -aAX --delete $workdir/synapse-admin-$release/ $target/
|
||||||
|
|
||||||
|
rm -r synapse-admin-$release*
|
40
updates/taiga.sh
Normal file
40
updates/taiga.sh
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# WIP
|
||||||
|
set -e
|
||||||
|
|
||||||
|
taiga_back="$HOME/taiga-back"
|
||||||
|
taiga_front="$HOME/taiga-front-dist"
|
||||||
|
domain=/home/doms/$(ls $HOME/doms)
|
||||||
|
|
||||||
|
cd $taiga_back
|
||||||
|
git fetch
|
||||||
|
|
||||||
|
release=`git tag --sort=taggerdate | grep -E '[0-9]' | tail -1`
|
||||||
|
#current_release=`git describe --abbrev=0 --tags`
|
||||||
|
export DJANGO_SETTINGS_MODULE=settings.config
|
||||||
|
|
||||||
|
function pipupdate {
|
||||||
|
source .venv/bin/activate
|
||||||
|
pip install --upgrade pip wheel
|
||||||
|
pip install -r requirements.txt
|
||||||
|
}
|
||||||
|
|
||||||
|
function backupdate {
|
||||||
|
pipupdate
|
||||||
|
pip install git+https://github.com/kaleidos-ventures/taiga-contrib-protected.git@$release#egg=taiga-contrib-protected
|
||||||
|
python manage.py migrate --noinput
|
||||||
|
python manage.py compilemessages
|
||||||
|
python manage.py collectstatic --noinput
|
||||||
|
}
|
||||||
|
|
||||||
|
backupdate
|
||||||
|
|
||||||
|
cd $taiga_front
|
||||||
|
git pull
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo ">>> Attempting to restart the application at $domain..."
|
||||||
|
echo ">>> If it is not detected try to properly load the environment"
|
||||||
|
echo ">>> Example: su - xyz00-anwendung"
|
||||||
|
echo
|
||||||
|
passenger-config restart-app $domain
|
74
updates/znuny.sh
Normal file
74
updates/znuny.sh
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "WARNING: please announce a maintenance! (waiting 3s)"
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "ERROR: Can't continue. Version querying not implemented as we might not use the latest major release."
|
||||||
|
echo "Usage: bash ./update.sh 9.9.9"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "This script will stop the Znuny daemon, but Cron can start it again."
|
||||||
|
read -p "Is the Cronjob for [ otrs.Daemon.pl ] commented? (yY)" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
echo "Please make sure Cron does not start our daemon."
|
||||||
|
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # https://stackoverflow.com/questions/1885525/how-do-i-prompt-a-user-for-confirmation-in-bash-script
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $HOME/znuny
|
||||||
|
|
||||||
|
echo "not stopping Cron.sh, it might (FIXME) not apply"
|
||||||
|
#bin/Cron.sh stop
|
||||||
|
|
||||||
|
$HOME/znuny/bin/otrs.Daemon.pl stop
|
||||||
|
|
||||||
|
mkdir -p $HOME/tmp
|
||||||
|
cd $HOME/tmp
|
||||||
|
|
||||||
|
wget https://download.znuny.org/releases/znuny-$1.tar.gz
|
||||||
|
tar -xf znuny-$1.tar.gz
|
||||||
|
|
||||||
|
rm -v *tar.gz
|
||||||
|
mv -v znuny-$1 $HOME/
|
||||||
|
|
||||||
|
echo "NOT running otrs.SetPermissions.pl because we are not usually elevated (not checking)"
|
||||||
|
|
||||||
|
cd $HOME
|
||||||
|
cp -av $HOME/znuny/Kernel/Config.pm $HOME/znuny-$1/Kernel/
|
||||||
|
|
||||||
|
if [ -n "$(ls -A $HOME/znuny/var/article 2>/dev/null)" ]; then
|
||||||
|
cp -rpv $HOME/znuny/var/article/* $HOME/znuny-$1/var/article/
|
||||||
|
else
|
||||||
|
echo "nothing found in var/article"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for f in $(find -L $HOME/znuny -maxdepth 1 -type f -name .\* -not -name \*.dist); do cp -av "$f" $HOME/znuny-$1/; done
|
||||||
|
for f in $(find -L $HOME/znuny/var/cron -maxdepth 1 -type f -name .\* -not -name \*.dist); do cp -av "$f" $HOME/znuny-$1/var/cron/; done
|
||||||
|
|
||||||
|
rm -v $HOME/znuny
|
||||||
|
ln -sv $HOME/znuny-$1 $HOME/znuny
|
||||||
|
|
||||||
|
$HOME/znuny/bin/otrs.Console.pl Maint::Database::Check
|
||||||
|
$HOME/znuny/bin/otrs.CheckModules.pl --all
|
||||||
|
|
||||||
|
migrationscript=`ls $HOME/znuny-$1/scripts/MigrateToZnuny* | xargs -n 1 basename`
|
||||||
|
|
||||||
|
read -p "Our migrationscript appears to be: [ $migrationscript ]. Is this correct? (yY)" -n 1 -r
|
||||||
|
echo
|
||||||
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||||
|
then
|
||||||
|
echo "Skipping [ Admin::Package::UpgradeAll ] and [ $migrationscript ]..."
|
||||||
|
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # https://stackoverflow.com/questions/1885525/how-do-i-prompt-a-user-for-confirmation-in-bash-script
|
||||||
|
fi
|
||||||
|
|
||||||
|
$HOME/znuny/scripts/MigrateToZnuny6_5.pl
|
||||||
|
$HOME/znuny/bin/otrs.Console.pl Admin::Package::UpgradeAll
|
||||||
|
|
||||||
|
echo Script ended without errors!
|
||||||
|
echo "https://doc.znuny.org/znuny_lts/releases/installupdate/"
|
||||||
|
echo "https://wiki.hostsharing.net/index.php?title=Znuny_installieren#Updates"
|
Loading…
Reference in New Issue
Block a user