Skip to content

Update Mastodon from v2.5.2 to v2.6.1

kedama edited this page Nov 25, 2018 · 2 revisions

goal

update Mastodon v2.5.2 to v2.6.1.

need

  • update Ruby v2.5.1 to v2.5.3

additional

  • to use jemalloc

setup jemalloc

on Gentoo:

# emerge jemalloc

on Ubuntu:

# apt install libjemalloc-dev

update ruby v2.5.1 to v2.5.3 with rbenv

switch user to mastodon user.

$ su - <mastodon account>

update ruby-build

~ $ cd .rbenv/plugins/ruby-build/
~/.rbenv/plugins/ruby-build $ git fetch
~/.rbenv/plugins/ruby-build $ git checkout v20181019

output messages:

Note: checking out 'v20181019'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 74e2d7c... Merge pull request #1244 from devinrm/dm-bump-version-to-2018-10-19

install ruby v2.5.3

check available ruby versions if needed:

~ $ rbenv install --list
Available versions:
   :
   :
  2.5.0-rc1
  2.5.0
  2.5.1
  2.5.2
  2.5.3
  2.6.0-dev
  2.6.0-preview1
  2.6.0-preview2
   :

install ruby v2.5.3 with rbenv

~ $ RUBY_CONFIGURE_OPTS=--with-jemalloc TMPDIR=/var/tmp rbenv install 2.5.3
  • RUBY_CONFIGURE_OPTS: set to use jemalloc
  • TMPDIR: set alternative when /tmp is too small (if needed)

output messages when succeeded:

Downloading ruby-2.5.3.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.3.tar.bz2
Installing ruby-2.5.3...
Installed ruby-2.5.3 to /home/mastodon/.rbenv/versions/2.5.3

backup database

switch to root.

~ $ su -

stop mastodon services

# systemctl stop mastodon-web
# systemctl stop mastodon-streaming
# systemctl stop mastodon-sidekiq

backup database

# sudo -u postgres pg_dumpall > /var/tmp/foresdon.jp.181103.dump
# gzip /var/tmp/foresdon.jp.181103.dump

update Mastodon v2.5.2 to v2.6.1

switch user to mastodon user.

~ $ su - <mastodon account>

checkout mastodon v2.6.1

~ $ cd ~/live
~/live $ git fetch
~/live $ git checkout v2.6.1

install bundler

make sure the ruby version points to 2.5.3

~/live $ ruby -v

output message:

ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]

then, install bundler

~/live $ gem install bundler

output message:

Fetching: bundler-1.17.1.gem (100%)
Successfully installed bundler-1.17.1
Parsing documentation for bundler-1.17.1
Installing ri documentation for bundler-1.17.1
Done installing documentation for bundler after 9 seconds
1 gem installed

update yarn

~/live $ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash

update packages that Mastodon depends on.

~/live $ bundle install
~/live $ yarn install

migrate db and precompile assets

~/live $ RAILS_ENV=production bundle exec rails db:migrate
~/live $ RAILS_ENV=production bundle exec rails assets:precompile

start mastodon services

switch user to root.

~ $ su -

then, start.

# systemctl stop mastodon-web
# systemctl stop mastodon-streaming
# systemctl stop mastodon-sidekiq