Skip to content

Update Mastodon from v2.8.0 to v2.8.1

kedama edited this page May 4, 2019 · 3 revisions

goal

  • update Mastodon v2.8.0 to v2.8.1

environment

# cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

operation

update Mastodon partially

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

run as mastodon user:

$ cd ~/live
$ git fetch
$ git pull
$ bundle install
$ yarn install --pure-lockfile
$ RAILS_ENV=production bundle exec rails assets:precompile

edit the .env.production

add new environment variable GITHUB_REPOSITORY into .env.production if needed.

GITHUB_REPOSITORY=kedamaDQ/mastodon

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

backing up datas

mount working volume if needed. run as root:

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

backing up postgres and redis. run as root:

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

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

run the remained steps of updating Mastodon

run as mastodon user:

$ cd ~/live
$ 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

cleaning cache

run as mastodon user:

$ cd ~/live
$ RAILS_ENV=production bin/tootctl cache clear