aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/_common.sh22
-rw-r--r--scripts/install16
-rw-r--r--scripts/upgrade14
3 files changed, 37 insertions, 15 deletions
diff --git a/scripts/_common.sh b/scripts/_common.sh
index c861376..168251c 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -13,6 +13,28 @@ RUBY_VERSION="2.7.2"
NODEJS_VERSION="12"
+# Workaround for Mastodon on Bullseye
+# See https://github.com/mastodon/mastodon/issues/15751#issuecomment-873594463
+if [ "$(lsb_release --codename --short)" = "bullseye" ]; then
+ case $YNH_ARCH in
+ amd64)
+ arch="x86_64"
+ ;;
+ arm64)
+ arch="aarch64"
+ ;;
+ armel|armhf)
+ arch="arm"
+ ;;
+ i386)
+ arch="i386"
+ ;;
+ esac
+ ld_preload="LD_PRELOAD=/usr/lib/$arch-linux-gnu/libjemalloc.so"
+else
+ ld_preload=""
+fi
+
#=================================================
# PERSONAL HELPERS
#=================================================
diff --git a/scripts/install b/scripts/install
index 3100891..696d59e 100644
--- a/scripts/install
+++ b/scripts/install
@@ -204,17 +204,17 @@ ynh_add_systemd_config --service="$app-streaming" --template="mastodon-streaming
ynh_script_progression --message="Installing Mastodon..."
pushd "$final_path/live"
- ynh_exec_as $app $ynh_ruby_load_path bin/bundle config deployment 'true'
- ynh_exec_as $app $ynh_ruby_load_path bin/bundle config without 'development test'
- ynh_exec_as $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
+ ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle config deployment 'true'
+ ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle config without 'development test'
+ ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
ynh_use_nodejs
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install --pure-lockfile
echo "SAFETY_ASSURED=1">> $config
- ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:setup --quiet
- ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile --quiet
- ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt
- ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=admin > /dev/null
- ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl accounts modify "$admin" --approve
+ ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rails db:setup --quiet
+ ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rails assets:precompile --quiet
+ ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rake mastodon:webpush:generate_vapid_key > key.txt
+ ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=admin > /dev/null
+ ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/tootctl accounts modify "$admin" --approve
popd
vapid_private_key=$(grep -oP "VAPID_PRIVATE_KEY=\K.+" "$final_path/live/key.txt")
diff --git a/scripts/upgrade b/scripts/upgrade
index ea95ffa..1c24a62 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -270,15 +270,15 @@ ynh_add_systemd_config --service="$app-streaming" --template="mastodon-streaming
ynh_script_progression --message="Upgrading Mastodon..."
pushd "$final_path/live"
- ynh_exec_as $app $ynh_ruby_load_path bin/bundle config deployment 'true'
- ynh_exec_as $app $ynh_ruby_load_path bin/bundle config without 'development test'
- ynh_exec_as $app $ynh_ruby_load_path bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
+ ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle config deployment 'true'
+ ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle config without 'development test'
+ ynh_exec_as $app $ynh_ruby_load_path $ld_preload bin/bundle install -j$(getconf _NPROCESSORS_ONLN)
ynh_use_nodejs
ynh_exec_as $app $ynh_node_load_PATH yarn install --pure-lockfile
- ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:clean
- ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails assets:precompile
- ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/bundle exec rails db:migrate
- ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path bin/tootctl cache clear
+ ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rails assets:clean
+ ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rails assets:precompile
+ ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/bundle exec rails db:migrate
+ ynh_exec_warn_less ynh_exec_as $app RAILS_ENV=production $ynh_ruby_load_path $ld_preload bin/tootctl cache clear
popd
#=================================================