1
mirror of https://github.com/jakejarvis/mastodon-utils.git synced 2025-06-27 17:25:42 -04:00

TIL sourcing bash files more than one layer deep isn't fun

This commit is contained in:
2022-12-20 19:39:39 -05:00
parent 066169ff06
commit 973a9d5507
5 changed files with 277 additions and 273 deletions

View File

@ -1,23 +0,0 @@
#!/bin/bash
# exit when any step fails
set -euo pipefail
# initialize path
. "$(dirname "$(realpath "$0")")"/../init.sh
# apply custom patches
cd "$APP_ROOT"
as_mastodon git apply --reject --allow-binary-replacement "$UTILS_ROOT"/patches/*.patch
if [ -d "$APP_ROOT/app/javascript/flavours/glitch" ]; then
# apply additional glitch-only patches:
as_mastodon git apply --reject --allow-binary-replacement "$UTILS_ROOT"/patches/glitch/*.patch
fi
# compile new assets
echo "Compiling new assets..."
as_mastodon RAILS_ENV=production bundle exec rails assets:precompile
# optional: create blank custom.css (this overrides any CSS set in the admin panel, but if that's not being used, then
# this is an easy way to save a request to the backend)
as_mastodon touch "$APP_ROOT/public/custom.css"

View File

@ -122,6 +122,11 @@ as_mastodon git checkout "$(as_mastodon git describe --abbrev=0 --tags --match "
# clone glitch-soc & checkout latest commit:
# as_mastodon git clone https://github.com/glitch-soc/mastodon.git "$APP_ROOT" && cd "$APP_ROOT"
# apply custom patches:
as_mastodon git apply --reject --allow-binary-replacement "$UTILS_ROOT"/patches/*.patch
# apply additional glitch-only patches:
# as_mastodon git apply --reject --allow-binary-replacement "$UTILS_ROOT"/patches/glitch/*.patch
# install ruby
as_mastodon RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install --skip-existing
as_mastodon rbenv global "$(as_mastodon cat "$APP_ROOT"/.ruby-version)"
@ -203,8 +208,8 @@ STREAMING_CLUSTER_NUM=1
# manually setup db
as_mastodon RAILS_ENV=production bundle exec rails db:setup
# apply custom patches & precompile assets
. "$UTILS_ROOT/scripts/apply_patches.sh"
# precompile assets
as_mastodon RAILS_ENV=production bundle exec rails assets:precompile
# install latest certbot
# https://certbot.eff.org/instructions?ws=nginx&os=pip

View File

@ -30,6 +30,13 @@ else
as_mastodon git checkout "$(as_mastodon git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)"
fi
# apply custom patches
as_mastodon git apply --reject --allow-binary-replacement "$UTILS_ROOT"/patches/*.patch
if [ -d "$APP_ROOT/app/javascript/flavours/glitch" ]; then
# apply additional glitch-only patches:
as_mastodon git apply --reject --allow-binary-replacement "$UTILS_ROOT"/patches/glitch/*.patch
fi
# set new ruby version
as_mastodon RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install --skip-existing
as_mastodon rbenv global "$(as_mastodon cat "$APP_ROOT"/.ruby-version)"
@ -41,8 +48,9 @@ as_mastodon bash -c "\. \"$NVM_DIR/nvm.sh\"; nvm install; nvm use; npm install -
as_mastodon bundle install --jobs "$(getconf _NPROCESSORS_ONLN)"
as_mastodon yarn install --pure-lockfile --network-timeout 100000
# pull & apply latest patches
. "$UTILS_ROOT/scripts/apply_patches.sh"
# compile new assets
echo "Compiling new assets..."
as_mastodon RAILS_ENV=production bundle exec rails assets:precompile
# run migrations:
# https://docs.joinmastodon.org/admin/upgrading/