From e7f213118d206195f430e5cee0d4c58336410837 Mon Sep 17 00:00:00 2001 From: Tagadda <36127788+Tagadda@users.noreply.github.com> Date: Fri, 29 Aug 2025 21:49:53 +0200 Subject: fix: LD_PRELOAD with a proper value --- scripts/_common.sh | 18 ------------------ scripts/install | 26 +++++++++++++------------- scripts/restore | 2 +- scripts/upgrade | 20 ++++++++++---------- 4 files changed, 24 insertions(+), 42 deletions(-) (limited to 'scripts') diff --git a/scripts/_common.sh b/scripts/_common.sh index 182e391..7ac14ba 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,21 +7,3 @@ memory_needed="2560" ruby_version=3.4.5 nodejs_version=20 - -case $YNH_ARCH in - amd64) - ld_preload="LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so" - ;; - arm64) - ld_preload="LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libjemalloc.so" - ;; - armhf) - ld_preload="LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libjemalloc.so" - ;; - armel) - ld_preload="LD_PRELOAD=/usr/lib/arm-linux-gnueabi/libjemalloc.so" - ;; - i386) - ld_preload="LD_PRELOAD=/usr/lib/i386-linux-gnu/libjemalloc.so" - ;; -esac diff --git a/scripts/install b/scripts/install index 7e400d5..22d297f 100644 --- a/scripts/install +++ b/scripts/install @@ -80,19 +80,19 @@ ynh_script_progression "Building app..." pushd "$install_dir/live" gem update --system gem install bundler --no-document - ynh_hide_warnings ynh_exec_as_app $ld_preload bin/bundle config deployment 'true' - ynh_hide_warnings ynh_exec_as_app $ld_preload bin/bundle config without 'development test' - ynh_hide_warnings ynh_exec_as_app $ld_preload bin/bundle config set force_ruby_platform true --quiet - ynh_hide_warnings ynh_exec_as_app $ld_preload bin/bundle install -j$(getconf _NPROCESSORS_ONLN) + ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config deployment 'true' + ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config without 'development test' + ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config set force_ruby_platform true --quiet + ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle install -j$(getconf _NPROCESSORS_ONLN) env corepack enable - echo Y | ynh_hide_warnings ynh_exec_as_app yarn workspaces focus --production - ynh_hide_warnings ynh_exec_as_app yarn install --immutable + echo Y | ynh_exec_as_app yarn workspaces focus --production + ynh_exec_as_app yarn install --immutable echo "SAFETY_ASSURED=1">> $config # Generate vapid keys - ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production $ld_preload bin/bundle exec rails mastodon:webpush:generate_vapid_key > vapid_key.txt + ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails mastodon:webpush:generate_vapid_key > vapid_key.txt # Generate active record encryption - ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production $ld_preload bin/bundle exec rails db:encryption:init > active_record_encryption.txt + ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:encryption:init > active_record_encryption.txt popd # Re-generate config with vapid keys and active record encryption @@ -112,12 +112,12 @@ ynh_delete_file_checksum "$config" ynh_config_add --template=".env.production.sample" --destination="$config" pushd "$install_dir/live" - ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production $ld_preload bin/bundle exec rails db:migrate --quiet - ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production $ld_preload bin/bundle exec rails db:seed --quiet - ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production $ld_preload bin/bundle exec rails assets:precompile --quiet + ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:migrate --quiet + ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:seed --quiet + ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails assets:precompile --quiet # Create the first admin user - ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production $ld_preload bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=Owner - ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production $ld_preload bin/tootctl accounts approve "$admin" + ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=Owner + ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/tootctl accounts approve "$admin" popd #================================================= diff --git a/scripts/restore b/scripts/restore index 0becd6c..692aa98 100644 --- a/scripts/restore +++ b/scripts/restore @@ -55,7 +55,7 @@ ynh_script_progression "Building app..." pushd "$install_dir/live" gem update --system gem install bundler --no-document - ynh_hide_warnings ynh_exec_as_app $ld_preload bin/bundle install --redownload -j$(getconf _NPROCESSORS_ONLN) + ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle install --redownload -j$(getconf _NPROCESSORS_ONLN) popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 769b47c..633117c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,14 +79,14 @@ ynh_script_progression "Building assets..." pushd "$install_dir/live" gem update --system gem install bundler --no-document - ynh_hide_warnings ynh_exec_as_app $ld_preload bin/bundle config deployment 'true' - ynh_hide_warnings ynh_exec_as_app $ld_preload bin/bundle config without 'development test' - ynh_hide_warnings ynh_exec_as_app $ld_preload bin/bundle config set force_ruby_platform true --quiet - ynh_hide_warnings ynh_exec_as_app $ld_preload bin/bundle install -j$(getconf _NPROCESSORS_ONLN) + ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config deployment 'true' + ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config without 'development test' + ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config set force_ruby_platform true --quiet + ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle install -j$(getconf _NPROCESSORS_ONLN) env corepack enable - echo Y | ynh_hide_warnings ynh_exec_as_app yarn workspaces focus --production - ynh_hide_warnings ynh_exec_as_app yarn install --immutable + echo Y | ynh_exec_as_app yarn workspaces focus --production + ynh_exec_as_app yarn install --immutable popd chown -R "$app:www-data" "$install_dir/live/public" @@ -125,7 +125,7 @@ if ynh_app_upgrading_from_version_before 4.3.2~ynh1; then pushd "$install_dir/live" # Generate active record encryption - ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production $ld_preload bin/bundle exec rails db:encryption:init > active_record_encryption.txt + ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:encryption:init > active_record_encryption.txt active_record_encryption_deterministic_key=$(grep -oP "ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=\K.+" "$install_dir/live/active_record_encryption.txt") ynh_app_setting_set --key=active_record_encryption_deterministic_key --value="$active_record_encryption_deterministic_key" active_record_encryption_key_derivation_salt=$(grep -oP "ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=\K.+" "$install_dir/live/active_record_encryption.txt") @@ -146,11 +146,11 @@ ynh_config_add --template=".env.production.sample" --destination="$config" ynh_script_progression "Applying migrations..." pushd "$install_dir/live" - ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production $ld_preload bin/bundle exec rails db:migrate --quiet - ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production $ld_preload bin/bundle exec rails assets:precompile --quiet + ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:migrate --quiet + ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails assets:precompile --quiet # Apply redis namespace migration (https://github.com/mastodon/redis_namespace_migration) - ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production COREPACK_ENABLE_DOWNLOAD_PROMPT=0 $ld_preload bin/rails runner rename.rb + ynh_exec_as_app RAILS_ENV=production COREPACK_ENABLE_DOWNLOAD_PROMPT=0 LD_PRELOAD=libjemalloc.so bin/rails runner rename.rb redis_namespace="$(ynh_app_setting_get --key=redis_namespace)" if [ $redis_namespace ]; then if [ ynh_app_setting_get --key=es_enabled == "true" ] && [ ynh_app_setting_get --key=es_prefix == "" ]; then -- cgit v1.2.3-70-g09d2 From 0114f2f9b79a03241cffeff6bb18182938dda414 Mon Sep 17 00:00:00 2001 From: Tagadda <36127788+Tagadda@users.noreply.github.com> Date: Fri, 29 Aug 2025 22:09:59 +0200 Subject: hide warnings --- scripts/install | 22 +++++++++++----------- scripts/restore | 2 +- scripts/upgrade | 16 ++++++++-------- 3 files changed, 20 insertions(+), 20 deletions(-) (limited to 'scripts') diff --git a/scripts/install b/scripts/install index 22d297f..ddb0692 100644 --- a/scripts/install +++ b/scripts/install @@ -80,19 +80,19 @@ ynh_script_progression "Building app..." pushd "$install_dir/live" gem update --system gem install bundler --no-document - ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config deployment 'true' - ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config without 'development test' - ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config set force_ruby_platform true --quiet - ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle install -j$(getconf _NPROCESSORS_ONLN) + ynh_hide_warnings ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config deployment 'true' + ynh_hide_warnings ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config without 'development test' + ynh_hide_warnings ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config set force_ruby_platform true --quiet + ynh_hide_warnings ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle install -j$(getconf _NPROCESSORS_ONLN) env corepack enable echo Y | ynh_exec_as_app yarn workspaces focus --production ynh_exec_as_app yarn install --immutable echo "SAFETY_ASSURED=1">> $config # Generate vapid keys - ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails mastodon:webpush:generate_vapid_key > vapid_key.txt + ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails mastodon:webpush:generate_vapid_key > vapid_key.txt # Generate active record encryption - ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:encryption:init > active_record_encryption.txt + ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:encryption:init > active_record_encryption.txt popd # Re-generate config with vapid keys and active record encryption @@ -112,12 +112,12 @@ ynh_delete_file_checksum "$config" ynh_config_add --template=".env.production.sample" --destination="$config" pushd "$install_dir/live" - ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:migrate --quiet - ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:seed --quiet - ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails assets:precompile --quiet + ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:migrate --quiet + ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:seed --quiet + ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails assets:precompile --quiet # Create the first admin user - ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=Owner - ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/tootctl accounts approve "$admin" + ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/tootctl accounts create "$admin" --email="$admin_mail" --confirmed --role=Owner + ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/tootctl accounts approve "$admin" popd #================================================= diff --git a/scripts/restore b/scripts/restore index 692aa98..c6939f6 100644 --- a/scripts/restore +++ b/scripts/restore @@ -55,7 +55,7 @@ ynh_script_progression "Building app..." pushd "$install_dir/live" gem update --system gem install bundler --no-document - ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle install --redownload -j$(getconf _NPROCESSORS_ONLN) + ynh_hide_warnings ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle install --redownload -j$(getconf _NPROCESSORS_ONLN) popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 633117c..8fa7f0f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -79,10 +79,10 @@ ynh_script_progression "Building assets..." pushd "$install_dir/live" gem update --system gem install bundler --no-document - ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config deployment 'true' - ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config without 'development test' - ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config set force_ruby_platform true --quiet - ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle install -j$(getconf _NPROCESSORS_ONLN) + ynh_hide_warnings ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config deployment 'true' + ynh_hide_warnings ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config without 'development test' + ynh_hide_warnings ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle config set force_ruby_platform true --quiet + ynh_hide_warnings ynh_exec_as_app LD_PRELOAD=libjemalloc.so bin/bundle install -j$(getconf _NPROCESSORS_ONLN) env corepack enable echo Y | ynh_exec_as_app yarn workspaces focus --production @@ -125,7 +125,7 @@ if ynh_app_upgrading_from_version_before 4.3.2~ynh1; then pushd "$install_dir/live" # Generate active record encryption - ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:encryption:init > active_record_encryption.txt + ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:encryption:init > active_record_encryption.txt active_record_encryption_deterministic_key=$(grep -oP "ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=\K.+" "$install_dir/live/active_record_encryption.txt") ynh_app_setting_set --key=active_record_encryption_deterministic_key --value="$active_record_encryption_deterministic_key" active_record_encryption_key_derivation_salt=$(grep -oP "ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=\K.+" "$install_dir/live/active_record_encryption.txt") @@ -146,11 +146,11 @@ ynh_config_add --template=".env.production.sample" --destination="$config" ynh_script_progression "Applying migrations..." pushd "$install_dir/live" - ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:migrate --quiet - ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails assets:precompile --quiet + ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails db:migrate --quiet + ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production LD_PRELOAD=libjemalloc.so bin/bundle exec rails assets:precompile --quiet # Apply redis namespace migration (https://github.com/mastodon/redis_namespace_migration) - ynh_exec_as_app RAILS_ENV=production COREPACK_ENABLE_DOWNLOAD_PROMPT=0 LD_PRELOAD=libjemalloc.so bin/rails runner rename.rb + ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production COREPACK_ENABLE_DOWNLOAD_PROMPT=0 LD_PRELOAD=libjemalloc.so bin/rails runner rename.rb redis_namespace="$(ynh_app_setting_get --key=redis_namespace)" if [ $redis_namespace ]; then if [ ynh_app_setting_get --key=es_enabled == "true" ] && [ ynh_app_setting_get --key=es_prefix == "" ]; then -- cgit v1.2.3-70-g09d2