aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/_common.sh2
-rw-r--r--scripts/install8
-rw-r--r--scripts/restore3
-rw-r--r--scripts/upgrade15
4 files changed, 20 insertions, 8 deletions
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 3421432..182e391 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -5,7 +5,7 @@
#=================================================
memory_needed="2560"
-ruby_version=3.3.5
+ruby_version=3.4.5
nodejs_version=20
case $YNH_ARCH in
diff --git a/scripts/install b/scripts/install
index b9d9219..7e400d5 100644
--- a/scripts/install
+++ b/scripts/install
@@ -22,6 +22,8 @@ ynh_nodejs_install
ynh_script_progression "Setting up source files..."
ynh_setup_source --dest_dir="$install_dir/live"
+# Download redis migration script
+ynh_setup_source --source_id=redis_migration --dest_dir="$install_dir/live"
chmod -R 775 "$install_dir"
chmod o-rwx "$install_dir"
@@ -76,7 +78,6 @@ ynh_config_add --template=".env.production.sample" --destination="$config"
ynh_script_progression "Building app..."
pushd "$install_dir/live"
- # Building ruby packages
gem update --system
gem install bundler --no-document
ynh_hide_warnings ynh_exec_as_app $ld_preload bin/bundle config deployment 'true'
@@ -112,10 +113,11 @@ 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
# 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 > /dev/null
- ynh_hide_warnings ynh_exec_as_app RAILS_ENV=production $ld_preload bin/tootctl accounts approve "$admin" > /dev/null
+ 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"
popd
#=================================================
diff --git a/scripts/restore b/scripts/restore
index 9dc84ba..51139ed 100644
--- a/scripts/restore
+++ b/scripts/restore
@@ -53,10 +53,9 @@ ynh_nodejs_install
ynh_script_progression "Building app..."
pushd "$install_dir/live"
-
gem update --system
gem install bundler --no-document
- ynh_exec_as_app $ld_preload bin/bundle install --redownload -j$(getconf _NPROCESSORS_ONLN)
+ ynh_hide_warnings ynh_exec_as_app $ld_preload bin/bundle install --redownload -j$(getconf _NPROCESSORS_ONLN)
popd
#=================================================
diff --git a/scripts/upgrade b/scripts/upgrade
index d44d200..aef5d67 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -87,6 +87,8 @@ ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from manifest.toml
ynh_setup_source --dest_dir="$install_dir/live" --full_replace --keep="public/system .env.production"
+# Download redis migration script
+ynh_setup_source --source_id=redis_migration --dest_dir="$install_dir/live"
chmod -R 775 "$install_dir"
chmod o-rwx "$install_dir"
@@ -98,7 +100,6 @@ chown -R $app:www-data "$install_dir"
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'
@@ -168,9 +169,19 @@ 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
+
+ # Apply redis namespace migration (https://github.com/mastodon/redis_namespace_migration)
+ ynh_hide_warings ynh_exec_as_app RAILS_ENV=production COREPACK_ENABLE_DOWNLOAD_PROMPT=0 $ld_preload bin/rails runner rename.rb
+ redis_namespace="$(ynh_app_setting_get --app=$app --key=redis_namespace)"
+ if [ $redis_namespace ]; then
+ if [ ynh_app_setting_get --app=$app --key=es_enabled == "true" ] && [ ynh_app_setting_get --app=$app --key=es_prefix == "" ]; then
+ ynh_app_setting_set --app=$app --key=es_prefix --value=$redis_namespace
+ else
+ ynh_app_setting_delete --app=$app --key=redis_namespace
+ fi
+ fi
popd
#=================================================