diff options
| author | yalh76 <yalh@yahoo.com> | 2020-05-19 01:20:45 +0200 |
|---|---|---|
| committer | yalh76 <yalh@yahoo.com> | 2020-05-19 01:20:45 +0200 |
| commit | 736d7908b4f31095e7a7b92fc632b0f6fad05e83 (patch) | |
| tree | 45d83101fca09da035e1ea32a6fb95e85254ebcf /scripts/upgrade | |
| parent | 36ff48ac1d930f235217d5758f6bd33bac039cc5 (diff) | |
| download | mastodon_ynh-736d7908b4f31095e7a7b92fc632b0f6fad05e83.tar.gz mastodon_ynh-736d7908b4f31095e7a7b92fc632b0f6fad05e83.tar.bz2 mastodon_ynh-736d7908b4f31095e7a7b92fc632b0f6fad05e83.zip | |
RUBY_VERSION factorisation
Diffstat (limited to 'scripts/upgrade')
| -rw-r--r-- | scripts/upgrade | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/scripts/upgrade b/scripts/upgrade index 98d0403..f34010b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -249,9 +249,11 @@ ynh_add_swap --size=$swap_needed #================================================= ynh_script_progression --message="Installing Ruby..." --weight=424 -ynh_install_ruby --ruby_version=2.6.5 -/opt/rbenv/versions/2.6.5/bin/gem update --system -/opt/rbenv/versions/2.6.5/bin/gem install bundler:1.17.3 --no-document +ynh_install_ruby --ruby_version=$RUBY_VERSION +pushd "$final_path/live" + gem update --system + gem install bundler:1.17.3 --no-document +popd #================================================= # MODIFY A CONFIG FILE @@ -287,12 +289,12 @@ chown -R "$app": "$final_path" pushd "$final_path/live" ynh_use_nodejs - sudo -u "$app" env PATH=$PATH /opt/rbenv/versions/2.6.5/bin/bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without development test - sudo -u "$app" env PATH=$PATH yarn install --pure-lockfile - sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.5/bin/bundle exec rails assets:clean - sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.5/bin/bundle exec rails assets:precompile - sudo -u "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/2.6.5/bin/bundle exec rails db:migrate - sudo -u "$app" env PATH=$PATH RAILS_ENV=production bin/tootctl cache clear + bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without development test + yarn install --pure-lockfile + RAILS_ENV=production bundle exec rails assets:clean + RAILS_ENV=production bundle exec rails assets:precompile + RAILS_ENV=production bundle exec rails db:migrate + RAILS_ENV=production bin/tootctl cache clear popd # Recalculate and store the checksum of the file for the next upgrade. @@ -305,7 +307,8 @@ ynh_script_progression --message="Setuping a cron job for removing cache..." --w ynh_replace_string --match_string="__FINAL_PATH__" --replace_string="$final_path" --target_file="../conf/cron" ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/cron" -sudo cp -f ../conf/cron /etc/cron.d/$app +ynh_replace_string --match_string="__RBENVROOT__" --replace_string="$RBENV_ROOT" --target_file="../conf/cron" +cp -f ../conf/cron /etc/cron.d/$app #================================================= # SETUP SYSTEMD @@ -314,6 +317,8 @@ ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 # Create a dedicated systemd config ynh_replace_string --match_string="__PORT_WEB__" --replace_string="$port_web" --target_file="../conf/mastodon-web.service" +ynh_replace_string --match_string="__RBENVROOT__" --replace_string="$RBENV_ROOT" --target_file="../conf/mastodon-web.service" +ynh_replace_string --match_string="__RBENVROOT__" --replace_string="$RBENV_ROOT" --target_file="../conf/mastodon-sidekiq.service" ynh_replace_string --match_string="__PORT_STREAM__" --replace_string="$port_stream" --target_file="../conf/mastodon-streaming.service" ynh_replace_string --match_string="__NODEJS_PATH__" --replace_string="$nodejs_path" --target_file="../conf/mastodon-streaming.service" ynh_add_systemd_config --service="$app-web" --template="mastodon-web.service" |
