diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | manifest.toml | 9 | ||||
| -rw-r--r-- | scripts/_common.sh | 2 | ||||
| -rw-r--r-- | scripts/install | 8 | ||||
| -rw-r--r-- | scripts/restore | 3 | ||||
| -rw-r--r-- | scripts/upgrade | 15 |
6 files changed, 29 insertions, 10 deletions
@@ -12,7 +12,7 @@ Libre and federated social network [](https://joinmastodon.org/) [](https://joinmastodon.org/) -[?style=for-the-badge)](https://ci-apps.yunohost.org/ci/apps/mastodon/) +[?style=for-the-badge)](https://ci-apps.yunohost.org/ci/apps/mastodon/) <div align="center"> <a href="https://apps.yunohost.org/app/mastodon"><img height="100px" src="https://github.com/YunoHost/yunohost-artwork/raw/refs/heads/main/badges/neopossum-badges/badge_more_info_on_the_appstore.svg"/></a> diff --git a/manifest.toml b/manifest.toml index 4e2591d..7f0b634 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ description.fr = "RĂ©seau social libre et fĂ©dĂ©rĂ©" version = "4.4.3~ynh1" -maintainers = ["Tagada"] +maintainers = [] [upstream] license = "AGPL-3.0-or-later" @@ -57,6 +57,13 @@ ram.runtime = "500M" sha256 = "ede116b80a525462f5ea68d046a4cdd787930fc6d2f9327c140756311ee07848" autoupdate.strategy = "latest_github_release" + [resources.sources.redis_migration] + url = "https://raw.githubusercontent.com/mastodon/redis_namespace_migration/47c6bd9757e7a40f7091b5692d78aef992ea8bf2/rename.rb" + sha256 = "3134a5c7e0157ee752f5cb49b942c89480951e94236b03dd1cb3cb1d3afdcdd2" + in_subdir = false + extract = false + rename = "rename.rb" + [resources.system_user] allow_email = true 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 #================================================= |
