aboutsummaryrefslogtreecommitdiff
path: root/scripts/upgrade
diff options
context:
space:
mode:
authornemsia <nemsia@nemsia.org>2018-05-25 10:10:29 +0200
committerGitHub <noreply@github.com>2018-05-25 10:10:29 +0200
commitc214d4961c86bd4c4ff059b2c640cccfb3517a19 (patch)
tree5b5e5bd7d150048e29279c67f0174b1f8af19e75 /scripts/upgrade
parentb4fdc7ea3ea53916baf80974783569c942cac360 (diff)
downloadmastodon_ynh-c214d4961c86bd4c4ff059b2c640cccfb3517a19.tar.gz
mastodon_ynh-c214d4961c86bd4c4ff059b2c640cccfb3517a19.tar.bz2
mastodon_ynh-c214d4961c86bd4c4ff059b2c640cccfb3517a19.zip
Upgrade 2.4.0 (#21)
* Upgrade 2.4 (#79) * Upgrade rb to 2.5.1 * Update upgrade * Fix 2.3.3 * Add trace on assets:precompile * Yarn install and precompile Update 2.4 need root to yarn install and precompile, Temporary bad fix. * Update upgrade * Fix migrate * Update README.md * Update manifest.json * Upgrade yarn to 1.7.0
Diffstat (limited to 'scripts/upgrade')
-rw-r--r--scripts/upgrade36
1 files changed, 21 insertions, 15 deletions
diff --git a/scripts/upgrade b/scripts/upgrade
index 50904f1..1ea88ca 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -65,37 +65,43 @@ if [[ $node_version =~ ^v4.*$ ]]; then
fi
# add additional package for upgrade
-ynh_package_install pkg-config libprotobuf-dev protobuf-compiler libicu-dev libidn11-dev postgresql-server-dev-9.4
+ynh_package_install yarn pkg-config libprotobuf-dev protobuf-compiler libicu-dev libidn11-dev postgresql-server-dev-9.4
-# Install ruby 2.5.0 for release 2.0
+# Install ruby 2.5.1 for release 2.4.0
sudo su - $app <<RCOMMANDS
cd $final_path/.rbenv && git pull && cd -
cd $final_path/.rbenv/plugins/ruby-build && git pull && cd -
-$final_path/.rbenv/bin/rbenv install 2.5.0 || true
-$final_path/.rbenv/versions/2.5.0/bin/ruby -v
+$final_path/.rbenv/bin/rbenv install 2.5.1 || true
+$final_path/.rbenv/versions/2.5.1/bin/ruby -v
RCOMMANDS
-# Create symlink for ruby 2.5.0
+# Create symlink for ruby 2.5.1
sudo rm /usr/bin/ruby || true
-sudo ln -s $final_path/.rbenv/versions/2.5.0/bin/ruby /usr/bin/ruby || true
+sudo ln -s $final_path/.rbenv/versions/2.5.1/bin/ruby /usr/bin/ruby || true
# Install Mastodon
sudo su - $app <<MCOMMANDS
pushd ~/live
-$final_path/.rbenv/versions/2.5.0/bin/gem install bundler
-bin/bundle install --deployment --without development test
-yarn install --pure-lockfile
+$final_path/.rbenv/versions/2.5.1/bin/gem install bundler
+$final_path/.rbenv/versions/2.5.1/bin/bundle install --deployment --without development test
+#yarn install --pure-lockfile
MCOMMANDS
+pushd $final_path/live
+yarn install --pure-lockfile
+popd
+
# Apply Mastodon upgrade
-sudo su - $app <<COMMANDS
+pushd $final_path/live
+RAILS_ENV=production $final_path/.rbenv/versions/2.5.1/bin/bundle exec rails assets:clean
+RAILS_ENV=production $final_path/.rbenv/versions/2.5.1/bin/bundle exec rails assets:precompile --trace
+
+sudo su - $app <<UCOMMANDS
pushd ~/live
-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 $final_path/.rbenv/versions/2.5.1/bin/bundle exec rails db:migrate
# Upgrade to 2.2.0
-RAILS_ENV=production bundle exec rails mastodon:maintenance:remove_regeneration_markers
-COMMANDS
+RAILS_ENV=production $final_path/.rbenv/versions/2.5.1/bin/bundle exec rails mastodon:maintenance:remove_regeneration_markers
+UCOMMANDS
# Restart Mastodon
sudo systemctl start mastodon-*.service