You've already forked mastodon-utils
mirror of
https://github.com/jakejarvis/mastodon-utils.git
synced 2025-06-27 16:15:43 -04:00
initial commit 🦣
This commit is contained in:
9
scripts/tootctl_shim.sh
Normal file
9
scripts/tootctl_shim.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
MASTODON_ROOT=/home/mastodon
|
||||
|
||||
tootctl() {
|
||||
( cd "$MASTODON_ROOT/live" && sudo -u mastodon RAILS_ENV=production "$MASTODON_ROOT/.rbenv/shims/ruby" "$MASTODON_ROOT/live/bin/tootctl" "$@" )
|
||||
}
|
51
scripts/upgrade_glitch.sh
Normal file
51
scripts/upgrade_glitch.sh
Normal file
@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
# exit when any step fails
|
||||
set -euo pipefail
|
||||
|
||||
# default paths
|
||||
MASTODON_ROOT=/home/mastodon
|
||||
RBENV_ROOT="$MASTODON_ROOT/.rbenv"
|
||||
|
||||
# check for existing installation
|
||||
if [ ! -d "$MASTODON_ROOT/live" ]
|
||||
then
|
||||
echo "$MASTODON_ROOT/live doesn't exist, are you sure Mastodon is installed?"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
# pull latest mastodon source
|
||||
cd "$MASTODON_ROOT/live"
|
||||
sudo -u mastodon git fetch --all
|
||||
sudo -u mastodon git checkout glitch-soc/main
|
||||
sudo -u mastodon git pull glitch-soc main
|
||||
|
||||
# update dependencies
|
||||
echo "Updating deps..."
|
||||
sudo -u mastodon "$RBENV_ROOT/shims/bundle" install --jobs "$(getconf _NPROCESSORS_ONLN)"
|
||||
sudo -u mastodon yarn install --pure-lockfile --network-timeout 100000
|
||||
|
||||
# run migrations:
|
||||
# https://docs.joinmastodon.org/admin/upgrading/
|
||||
echo "Running pre-deploy database migrations..."
|
||||
sudo -u mastodon SKIP_POST_DEPLOYMENT_MIGRATIONS=true RAILS_ENV=production "$RBENV_ROOT/shims/bundle" exec rails db:migrate
|
||||
echo "Compiling new assets..."
|
||||
sudo -u mastodon RAILS_ENV=production "$RBENV_ROOT/shims/bundle" exec rails assets:precompile
|
||||
|
||||
# restart mastodon
|
||||
echo "Restarting services (round 1/2)..."
|
||||
sudo systemctl reload mastodon-web
|
||||
sudo systemctl restart mastodon-sidekiq mastodon-streaming
|
||||
|
||||
# clear caches & run post-deployment db migration
|
||||
echo "Clearing cache..."
|
||||
sudo -u mastodon RAILS_ENV=production "$RBENV_ROOT/shims/ruby" "$MASTODON_ROOT/live/bin/tootctl" cache clear
|
||||
echo "Running post-deploy database migrations..."
|
||||
sudo -u mastodon RAILS_ENV=production "$RBENV_ROOT/shims/bundle" exec rails db:migrate
|
||||
|
||||
# restart mastodon again
|
||||
echo "Restarting services (round 2/2)..."
|
||||
sudo systemctl reload mastodon-web
|
||||
sudo systemctl restart mastodon-sidekiq mastodon-streaming
|
||||
|
||||
echo "🎉 done!"
|
7
scripts/version.sh
Normal file
7
scripts/version.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
. $(dirname "$0")/tootctl_shim.sh
|
||||
|
||||
tootctl version
|
14
scripts/weekly_cleanup.sh
Normal file
14
scripts/weekly_cleanup.sh
Normal file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
# cronjob ran once per week at 3 AM on Sunday; see https://crontab.guru/#0_3_*_*_0
|
||||
# syntax for crontab -e:
|
||||
# 0 3 * * 0 root /home/mastodon/scripts/weekly_cleanup.sh >> /home/mastodon/logs/cron.log 2>&1
|
||||
|
||||
set -e
|
||||
|
||||
. $(dirname "$0")/toot_shim.sh
|
||||
|
||||
tootctl media remove --days 7
|
||||
tootctl preview_cards remove --days 90
|
||||
|
||||
curl -X GET 'https://betteruptime.com/api/v1/heartbeat/EZYUHRmbatzh4tBfTvzX22go'
|
Reference in New Issue
Block a user