Compare commits

..

6 Commits

4 changed files with 72 additions and 45 deletions

71
updates/discourse.sh Normal file
View 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

View File

@ -4,7 +4,7 @@ set -e
# +x does not apply # +x does not apply
# use correct order eg: sudo -u www-data php=php8.2 ... # use correct order eg: sudo -u www-data php=php8.2 ...
if [ -z ${php} ]; then if [ -z ${php} ]; then
php="php8.2" php="php8.1"
fi fi
[ -f cron.log ] && rm -v cron.log && echo "logfiles should not be here and upset the updater. consider the data directory." [ -f cron.log ] && rm -v cron.log && echo "logfiles should not be here and upset the updater. consider the data directory."

View File

@ -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

View File

@ -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