Skip to content

Update Mastodon from v2.8.2 to v2.9.0

kedama edited this page Jun 15, 2019 · 2 revisions

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

goal

  • system update
  • update Mastodon v2.8.2 to v2.9.0

operation

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.190615.dump
# gzip foresdon.jp.190615.dump
# redis-cli lastsave
# redis-cli bgsave
# redis-cli lastsave
# cp /var/lib/redis/dump.rdb ./foresdon.jp.190615.dump.rdb
# gzip foresdon.jp.190615.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 update
# apt upgrade
# systemctl reboot
# apt autoremove
# systemctl reboot

update node

if needed. mastodon needs node v8.12 or later. update node because my environment is using v8.11 .

ℹ️ my environment is controlling node version with nvm.

run as mastodon user:

$ node -v
v8.11.2
$ nvm install lts/carbon
$ node -v
v8.16.0

update yarn

if needed.

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

update mastodon

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

run as mastodon user:

$ cd ~/live
$ git fetch
$ git checkout current-foresdon
$ bundle install
$ 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

clear cache

run as mastodon user:

$ RAILS_ENV=production bin/tootctl cache clear