mirror of
https://github.com/YunoHost-Apps/mastodon_ynh.git
synced 2024-09-03 19:46:02 +02:00
[enh] Workaround for bullseye
see https://github.com/mastodon/mastodon/issues/15751#issuecomment-873594463
This commit is contained in:
parent
7be9bed8cf
commit
03cd9df2b6
6 changed files with 44 additions and 20 deletions
10
conf/cron
10
conf/cron
|
@ -1,5 +1,5 @@
|
|||
@daily cd __FINAL_PATH__/live && sudo -u __APP__ __YNH_RUBY_LOAD_PATH__ RAILS_ENV=production bin/tootctl media remove
|
||||
@monthly cd __FINAL_PATH__/live && sudo -u __APP__ __YNH_RUBY_LOAD_PATH__ RAILS_ENV=production bin/tootctl media remove-orphans
|
||||
@monthly cd __FINAL_PATH__/live && sudo -u __APP__ __YNH_RUBY_LOAD_PATH__ RAILS_ENV=production bin/tootctl accounts cull
|
||||
@monthly cd __FINAL_PATH__/live && sudo -u __APP__ __YNH_RUBY_LOAD_PATH__ RAILS_ENV=production bin/tootctl statuses remove
|
||||
@monthly cd __FINAL_PATH__/live && sudo -u __APP__ __YNH_RUBY_LOAD_PATH__ RAILS_ENV=production bin/tootctl preview_cards remove
|
||||
@daily cd __FINAL_PATH__/live && sudo -u __APP__ __YNH_RUBY_LOAD_PATH__ __LD_PRELOAD__ RAILS_ENV=production bin/tootctl media remove
|
||||
@monthly cd __FINAL_PATH__/live && sudo -u __APP__ __YNH_RUBY_LOAD_PATH__ __LD_PRELOAD__ RAILS_ENV=production bin/tootctl media remove-orphans
|
||||
@monthly cd __FINAL_PATH__/live && sudo -u __APP__ __YNH_RUBY_LOAD_PATH__ __LD_PRELOAD__ RAILS_ENV=production bin/tootctl accounts cull
|
||||
@monthly cd __FINAL_PATH__/live && sudo -u __APP__ __YNH_RUBY_LOAD_PATH__ __LD_PRELOAD__ RAILS_ENV=production bin/tootctl statuses remove
|
||||
@monthly cd __FINAL_PATH__/live && sudo -u __APP__ __YNH_RUBY_LOAD_PATH__ __LD_PRELOAD__ RAILS_ENV=production bin/tootctl preview_cards remove
|
||||
|
|
|
@ -9,6 +9,7 @@ WorkingDirectory=__FINALPATH__/live
|
|||
Environment="RAILS_ENV=production"
|
||||
Environment="DB_POOL=25"
|
||||
Environment="MALLOC_ARENA_MAX=2"
|
||||
Environment="__LD_PRELOAD__"
|
||||
ExecStart=__RBENV_ROOT__/versions/__APP__/bin/bundle exec sidekiq -c 25
|
||||
TimeoutSec=15
|
||||
Restart=always
|
||||
|
|
|
@ -8,6 +8,7 @@ User=__APP__
|
|||
WorkingDirectory=__FINALPATH__/live
|
||||
Environment="RAILS_ENV=production"
|
||||
Environment="PORT=__PORT_WEB__"
|
||||
Environment="__LD_PRELOAD__"
|
||||
ExecStart=__RBENV_ROOT__/versions/__APP__/bin/bundle exec puma -C config/puma.rb
|
||||
ExecReload=/bin/kill -SIGUSR1 $MAINPID
|
||||
TimeoutSec=15
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue