Skip to content

Update Mastodon form v2.7.1 to v2.8.0

kedama edited this page Apr 13, 2019 · 5 revisions

ℹ️ Because foresdon.jp is a customized Mastodon server, use v2.7.1 as update base.

goal

  • system update
  • update Mastodon v2.7.1 to v2.8.0

operation

mount working volume

create and mount a volume as a working area. Because already created the volume in my server, just only mount it in my case.

run as root:

# mount /dev/vg001/lvtmp /mnt/tmp

uninstall unnecessary older ruby if exists.

for ensuring empty area if need.

run as mastodon user:

$ rbenv versions
  2.5.3
  2.6.0

$ rbenv uninstall 2.5.3
rbenv: remove /home/mastodon/.rbenv/versions/2.5.3? [yN] y

update the ruby-build

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

install ruby 2.6.1

my $RUBY_CONFIGURE_OPTS is written in the ~/.bachrc.

ℹ️ ${TMPDIR} is used as working area by ruby-build. default is '/tmp'.

$ cd ~
$ echo ${RUBY_CONFIGURE_OPTS}
--with-jemalloc
$ TMPDIR='/mnt/tmp' rbenv install 2.6.1

if you want to watch the installation progress:

$ tail -f /mnt/tmp/ruby-build.*.log

if there is no problem, check installed.

$ rbenv versions
  2.6.0
  2.6.1

stop services

i have changed the systemd service name. this is for don't stop services in production server with misunderstanding another environment servers.

run as root:

# systemctl stop foresdon-web
# systemctl stop foresdon-streaming
# systemctl stop foresdon-sidekiq

backup datas

# cd /mnt/tmp
# sudo -u postgres pg_dumpall > foresdon.jp.190414.dump
# gzip foresdon.jp.190414.dump
# redis-cli lastsave
# redis-cli bgsave
# redis-cli lastsave
# cp /var/lib/redis/dump.rdb ./foresdon.jp.190414.dump.rdb
# gzip foresdon.jp.190414.dump.rdb

get backups to some other remote box with scp. get /home/mastodon/live/.env.production too if need.

ℹ️ redis-cli lastsave returns timestamp when last saving data to file. if timestamp changed after redis-cli bgsave, saving is completed.

get snapshot

run as root:

# systemctl poweroff

get snapshot of the vps volume and restart vps.

system update

run as root:

# apt upgrade
# apt autoremove
# systemctl reboot

update mastodon

current-foresdon is my customized branch. if your repository tracks the tootsuite/mastodon, you must checkout v2.8.0 instead of current-foresdon.

run as mastodon user:

$ cd ~/live
$ git fetch
$ git checkout current-foresdon
$ gem update --system
$ bundle install
$ curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
$ yarn install --pure-lockfile
$ RAILS_ENV=production bundle exec rails assets:precompile
$ RAILS_ENV=production bundle exec rails db:migrate

start services

run as root:

# systemctl start foresdon-sidekiq
# systemctl start foresdon-streaming
# systemctl start foresdon-web