LoginSignup
1
0

More than 5 years have passed since last update.

文具丼のMastodnを更新(1.3.3 -> 1.4.1)

Posted at

やったこと

文具丼 - https://co-mastdn.ga のアップデートを行いました。

環境はAWSのubuntu

~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.2 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.2 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

Dockerコンテナでは無い方のmastodonです。

現在、mastodonのバージョンはv1.3.3

$ git branch
* (HEAD detached at v1.3.3)
  master
  production

v1.4.1にあげたい

リリースノートをちゃんと読む

Upgrade notesの「Non-Docker only」を見ると、

Upgrade notes:

Non-Docker only:

This release switches the minimum supported Node.js version from 4 to 6
Three additional system packages are required: pkg-config libprotobuf-dev protobuf-compiler
Dependency updates: bundle install and yarn install

Google翻訳すると、

このリリースでは、サポートされている最小のNode.jsバージョンが4から6に切り替わります
3つの追加システムパッケージが必要です:pkg-config libprotobuf-dev protobuf-compiler
依存関係の更新:bundle install と yarn install

また、「Both Docker and non-Docker」を見ると、

Both Docker and non-Docker:

If you have CDN_HOST set, make sure it contains the protocol part (http:// or https://), if it does not, adjust it before doing the next step
If you set a non-default STREAMING_API_BASE_URL, change the protocol part to ws:// or wss:// respectively
This release includes changes to assets, that means you need to run RAILS_ENV=production bundle exec rails assets:precompile (in Docker: docker-compose run --rm web rails assets:precompile)
Generated assets now live under public/packs instead of public/assets. This is mostly irrelevant but might affect some custom proxying configurations.
This release includes database migrations, that means you need to run RAILS_ENV=production bundle exec rails db:migrate (in Docker: docker-compose run --rm web rails db:migrate)

Google翻訳すると、

CDN_HOSTが設定されている場合は、プロトコル部分(http://またはhttps://)が含まれていることを確認し、そうでない場合は、次の手順を実行する前に調整します
デフォルト以外のSTREAMING_API_BASE_URLを設定した場合は、プロトコル部分をws://またはwss://にそれぞれ変更します
このリリースには、アセットの変更が含まれています。つまり、RAILS_ENV=production bundle exec rails assets:precompileを実行する必要があります。(Docker:docker-compose run --rm web rails assets:precompile)
生成されたアセットは、パブリック/アセットの代わりにパブリック/パックの下にあります。これはほとんど無関係ですが、カスタムプロキシ設定に影響する可能性があります。
このリリースにはデータベース移行が含まれています。つまり、RAILS_ENV=production bundle exec rails db:migrateを実行する必要があります。(Docker:docker-compose run --rm web rails db:migrate)

手順

nodeのバージョン確認

$ node -v
v4.8.2

v4はサポートされなくなるので、せめてv6にはバージョン上げたい

パッケージリストの更新

$ sudo apt-get update -y
$ node -v
v4.8.2

バージョン変わらず

npmをアップデートしてnをインストール

$ npm install -g n
$ npm update -g npm
$ sudo npm install -g n

nでnodeをアップデート

$ n --stable
$ n --latest
$ n latest
$ node -v
v8.0.0

v8に上がった

3つのシステムパッケージを追加

$ sudo apt-get install pkg-config
$ sudo apt-get install libprotobuf-dev
$ sudo apt-get install protobuf-compiler

.env.production 確認

$ cd live
$ vi .env.production
.env.production
#CDN_HOST
#STREAMING_API_BASE_URL

何もセットしていなかったのでスルー

v1.4.1チェックアウト

$ git branch
$ git fetch
$ git checkout v1.4.1

依存関係の更新とmastodonの更新

$ bundle install --path=vendor/bundle
$ RAILS_ENV=production bundle exec rails db:migrate
$ RAILS_ENV=production bundle exec rails assets:clobber
$ yarn install --pure-lockfile
$ RAILS_ENV=production bundle exec rails assets:precompile

サービス再起動

$ sudo systemctl restart mastodon-*.service
$ sudo systemctl restart nginx

バージョンがあがりました。

mastodon_v.png

以上

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0