Compare commits
6 Commits
main
...
discourse_
Author | SHA1 | Date | |
---|---|---|---|
|
714f6017bb | ||
|
09e533da0a | ||
|
5c3ff4a938 | ||
|
d996fd4102 | ||
|
7aa56bb5f8 | ||
|
b472f9624a |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
env
|
||||
config.env
|
@ -1,27 +0,0 @@
|
||||
# where everything lives,
|
||||
# such as ./latest ./themes and so on
|
||||
location=$HOME
|
||||
|
||||
# to make sure we can use systemctl
|
||||
XDG_RUNTIME_DIR=/run/user/$UID
|
||||
|
||||
# theme in $HOME/themes to copy
|
||||
theme=
|
||||
|
||||
# this is used for setting
|
||||
# a random new password for a demo user
|
||||
#
|
||||
# needed to obtain an admin token
|
||||
kcadmin=
|
||||
kcadminpw=
|
||||
# the admin api port
|
||||
kcport=38081
|
||||
# our user to modify:
|
||||
kcuserid=fbe-123-456-ee0oab
|
||||
newpw=
|
||||
kcrealm=
|
||||
|
||||
app=keycloak # service and dumpfile name
|
||||
db=
|
||||
user=$db
|
||||
dump=$HOME/var/db/$app.dump
|
@ -1,24 +0,0 @@
|
||||
#/bin/bash
|
||||
set -e
|
||||
|
||||
source $HOME/scripts/env
|
||||
|
||||
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 --no-pager status --user $app
|
||||
|
||||
echo "setting new demouser password"
|
||||
echo "waiting a crazy amount of 20s so keycloak has time to open that port..."
|
||||
sleep 20
|
||||
. $HOME/scripts/set-demopw.sh
|
||||
echo "done."
|
@ -1,12 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
. $HOME/scripts/env
|
||||
|
||||
echo "obtaining new admin token"
|
||||
$HOME/latest/bin/kcadm.sh config credentials --server http://localhost:$kcport --user $kcadmin --password $kcadminpw --realm master
|
||||
|
||||
echo "setting password for demo account"
|
||||
$HOME/latest/bin/kcadm.sh set-password --server http://localhost:$kcport --userid $kcuserid -r $kcrealm --new-password $newpw # -x (for stacktrace)
|
||||
|
||||
echo "demo user now has the password of $newpw"
|
@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
. $HOME/scripts/env
|
||||
|
||||
pg_dump -Fc -U $user -d $db > $dump
|
||||
|
||||
echo "state has been made permanent."
|
@ -1,64 +0,0 @@
|
||||
#!/bin/bash
|
||||
# source: https://git.tchncs.de/tchncs/tchncs-scripts/-/blob/main/updates/keycloak.sh
|
||||
|
||||
# Use ./update.sh 1.2.3 to OVERRIDE the release check.
|
||||
|
||||
# Without an argument, THIS SCRIPT WILL AUTODETECT the release
|
||||
# that was tagged as "latest" by the project.
|
||||
set -e
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
release=`curl -L https://api.github.com/repos/keycloak/keycloak/releases/latest -s | jq -r '.tag_name'`
|
||||
echo ">>> Detected v$release being tagged as the latest release."
|
||||
else
|
||||
release=$1
|
||||
fi
|
||||
|
||||
current_release=$(cat latest/version.txt)
|
||||
current_release=${current_release#'Keycloak - Version '}
|
||||
|
||||
if [[ $current_release == "$release" ]]
|
||||
then
|
||||
echo ">>> It appears, are on v$current_release. Nothing to do."
|
||||
exit
|
||||
else
|
||||
read -p "Proceed? With Keycloak ${release}?" -n 1 -r
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
systemctl stop --user keycloak
|
||||
|
||||
echo ">>> calling for rollback.sh"
|
||||
. $HOME/scripts/rollback.sh
|
||||
|
||||
cd $location
|
||||
|
||||
wget "https://github.com/keycloak/keycloak/releases/download/$release/keycloak-$release.zip"
|
||||
unzip keycloak-$release.zip
|
||||
rm keycloak-$release.zip
|
||||
|
||||
[ -L latest ] && rm -v latest
|
||||
ln -sv $location/keycloak-$release $location/latest
|
||||
|
||||
# default config got the same filename!
|
||||
rm -v latest/conf/keycloak.conf
|
||||
|
||||
ln -sv $location/config/* $location/latest/conf/
|
||||
|
||||
bash latest/bin/kc.sh build
|
||||
|
||||
cp -r $HOME/themes/$theme $HOME/latest/themes/
|
||||
|
||||
systemctl restart --user keycloak
|
||||
|
||||
echo ">>> waiting 10s so Keycloak may run migrations..."
|
||||
sleep 10
|
||||
|
||||
echo ">>> calling setstate.sh to make the update permanent"
|
||||
. $HOME/scripts/setstate.sh
|
||||
|
||||
echo "Done."
|
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
|
@ -1,8 +0,0 @@
|
||||
pac=xyz00
|
||||
user=
|
||||
db=${pac}_${user}
|
||||
dbuser=$db
|
||||
dump=$HOME/var/db/nextcloud.dump
|
||||
# optional version control, if default or configured one is too old
|
||||
# do not comment this
|
||||
php=php
|
71
updates/discourse.sh
Normal file
71
updates/discourse.sh
Normal file
@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
release=$(curl -L https://api.github.com/repos/discourse/discourse/tags -s | jq -r '.[0].name')
|
||||
|
||||
echo "Warning, this scipt is not fully tested yet! Proceed with caution!"
|
||||
echo
|
||||
read -p "Trying to update to Discourse ${release} – proceed?" -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
|
||||
|
||||
basedir=$HOME/discourse
|
||||
services="sidekiq discourse"
|
||||
patch=$HOME/latest.patch
|
||||
nodever=$(curl -s https://raw.githubusercontent.com/discourse/discourse_docker/main/image/base/slim.Dockerfile | grep -oP '(?<=nodesource.com/setup_)[0-9]+[0-9]')
|
||||
|
||||
cd $basedir
|
||||
|
||||
# attempting not having to use a patchfile
|
||||
git stash
|
||||
# lets roll with their doctor scripts command
|
||||
git fetch --tags --prune-tags --prune --force origin
|
||||
git checkout latest-release # they seem to update this tag, not sure if we need to checkout
|
||||
#git pull
|
||||
git stash apply
|
||||
|
||||
# failsafe if stash apply causes too much trouble
|
||||
#echo "looking for patchfile at [ $patch ], executing if found..."
|
||||
#[ -e $patch ] && . $patch
|
||||
#echo "command ended with status $?"
|
||||
|
||||
# not clear why this is a samplefile
|
||||
# they seem to do this by hand on the docker repo
|
||||
rubyver=$(< $basedir/.ruby-version.sample)
|
||||
# commenting this because we assume that upstream docker
|
||||
# uses newer ruby because they don't seem to use release
|
||||
#rubyver=$(curl -s https://raw.githubusercontent.com/discourse/discourse_docker/main/image/base/slim.Dockerfile | grep -oP '(?<=RUBY_VERSION=)[0-9]+\.[0-9]+\.[0-9]+')
|
||||
|
||||
[ ! -L $basedir/.ruby-version ] && ln -sv $basedir/.ruby-version.sample $basedir/.ruby-version
|
||||
|
||||
if [[ ! -e ~/.rbenv/versions/$rubyver ]]
|
||||
then
|
||||
git -C $HOME/.rbenv/plugins/ruby-build pull
|
||||
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install
|
||||
fi
|
||||
|
||||
echo "proceeding with bundle and yarn"
|
||||
# upstream does a gem update --system
|
||||
# we assume their Gemfile.lock is on track tho
|
||||
# and try to avoid problems due to too new gems
|
||||
bundle install
|
||||
yarn install --frozen-lockfile
|
||||
|
||||
RAILS_ENV=production bundle exec rails assets:precompile
|
||||
|
||||
read -p "Proceed with migrations? " -n 1 -r
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
|
||||
fi
|
||||
RAILS_ENV=production bundle exec rails db:migrate
|
||||
|
||||
systemctl restart --user $services
|
||||
|
||||
sleep 2
|
||||
|
||||
systemctl status --user $services
|
@ -7,6 +7,8 @@ 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
|
||||
@ -20,9 +22,6 @@ cd $basedir
|
||||
git fetch
|
||||
git checkout $release
|
||||
|
||||
erlang_ver=$(grep "erlang" "$tools" | awk '{print $2}')
|
||||
elixir_ver=$(grep "elixir" "$tools" | awk '{print $2}')
|
||||
|
||||
. "$HOME/.asdf/asdf.sh"
|
||||
. "$HOME/.asdf/completions/asdf.bash"
|
||||
|
||||
@ -48,5 +47,5 @@ systemctl start --user keila
|
||||
|
||||
sleep 2
|
||||
|
||||
systemctl status --user --no-pager keila
|
||||
systemctl status --user keila
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
#
|
||||
# Use ./update.sh 1.2.3 to OVERRIDE the release check.
|
||||
#
|
||||
# Without an argument, THIS SCRIPT WILL AUTODETECT the release
|
||||
# that was tagged as "latest" by the project.
|
||||
#
|
||||
|
||||
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`
|
||||
|
||||
@ -16,40 +16,17 @@ olddir=`readlink $location/latest`
|
||||
# script does not require this to function
|
||||
#themename=mytheme
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
release=`curl -L https://api.github.com/repos/keycloak/keycloak/releases/latest -s | jq -r '.tag_name'`
|
||||
echo ">>> Detected v$release being tagged as the latest release."
|
||||
else
|
||||
release=$1
|
||||
fi
|
||||
|
||||
current_release=$(cat latest/version.txt)
|
||||
current_release=${current_release#'Keycloak - Version '}
|
||||
|
||||
if [[ $current_release == "$release" ]]
|
||||
then
|
||||
echo ">>> It appears, are on v$current_release. Nothing to do."
|
||||
exit
|
||||
else
|
||||
read -p "Proceed? With Keycloak ${release}?" -n 1 -r
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
systemctl stop --user keycloak
|
||||
|
||||
cd $location
|
||||
|
||||
# FIXME: move to rsync or use git tags directly
|
||||
wget "https://github.com/keycloak/keycloak/releases/download/$release/keycloak-$release.zip"
|
||||
unzip keycloak-$release.zip
|
||||
rm keycloak-$release.zip
|
||||
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-$release $location/latest
|
||||
ln -sv $location/keycloak-$1 $location/latest
|
||||
|
||||
# default config got the same filename!
|
||||
rm -v $location/latest/conf/keycloak.conf
|
||||
|
@ -1,27 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
export XDG_RUNTIME_DIR=/run/user/$UID
|
||||
|
||||
release=`curl -L https://api.github.com/repos/knadh/listmonk/releases/latest -s | jq -r '.tag_name'`
|
||||
# listmonks file identifier is lacking the 'v'
|
||||
release=${release//v}
|
||||
installdir=$HOME/bin
|
||||
|
||||
echo ">>> Listmonk is currently running: $($installdir/listmonk --version)"
|
||||
echo "======== 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
|
||||
|
||||
systemctl stop --user listmonk
|
||||
|
||||
curl -sL https://github.com/knadh/listmonk/releases/download/v$release/listmonk_${release}_linux_amd64.tar.gz | tar xvz -C $installdir/
|
||||
$installdir/listmonk --upgrade
|
||||
|
||||
systemctl start --user listmonk
|
||||
|
||||
sleep 2
|
||||
systemctl status --no-pager --user listmonk
|
@ -4,7 +4,7 @@ set -e
|
||||
# +x does not apply
|
||||
# use correct order – eg: sudo -u www-data php=php8.2 ...
|
||||
if [ -z ${php} ]; then
|
||||
php="php8.2"
|
||||
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."
|
||||
|
@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
export XDG_RUNTIME_DIR=/run/user/$UID
|
||||
|
||||
release=`curl -L https://api.github.com/repos/matrix-org/sliding-sync/releases/latest -s | jq -r '.tag_name'`
|
||||
|
||||
echo ">>> stopping to avoid binary being busy"
|
||||
echo
|
||||
systemctl stop --user syncv3
|
||||
|
||||
wget --show-progress -q -O $HOME/bin/syncv3 https://github.com/matrix-org/sliding-sync/releases/download/$release/syncv3_linux_amd64
|
||||
|
||||
echo
|
||||
echo ">>> starting...."
|
||||
systemctl start --user syncv3
|
||||
sleep 2
|
||||
systemctl status --user syncv3
|
@ -1,27 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
export XDG_RUNTIME_DIR=/run/user/$UID
|
||||
|
||||
activate="$HOME/synapse/env/bin/activate"
|
||||
domain=`ls $HOME/doms/`
|
||||
|
||||
if [ ! -f $activate ];
|
||||
then
|
||||
echo ">>> FATAL: Synapse env not detected. Stopping. Please adjust the script."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
source $activate
|
||||
|
||||
pip install --upgrade 'matrix-synapse[postgres]' pip
|
||||
|
||||
systemctl --user restart synapse
|
||||
|
||||
sleep 2
|
||||
echo
|
||||
echo ">>> Synapse has been restarted and"
|
||||
echo ">>> is now reporting this version:"
|
||||
curl -s "https://$domain/_synapse/admin/v1/server_version"|jq
|
||||
echo
|
||||
|
||||
systemctl --user status synapse
|
Loading…
Reference in New Issue
Block a user