0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Google Compute Engineに作ったMastodonアップデートメモ(Ver.1.3.3 > 1.4.1)

Posted at

マストドン東東京インスタンス:https://east.mstdn.tokyoを、Ver.1.3.3から1.4.1へアップデートしました。
※Docker未使用

Ikumiさん:さくらクラウドのMastodnを更新(1.3.2 -> 1.4.1)
fk_2000さん:文具丼のMastodnを更新(1.3.3 -> 1.4.1)
の手順をほぼそのまま参考にさせていただきました。ありがとうございます。

環境:GCE(Google Compute Engine)

Google Compute Engine

マシンタイプ:g1-small(vCPU x 1、メモリ 1.7 GB)
OS:Ubuntu
VERSION:16.04.2

Google Cloud Platform SQL

PostgreSQL 9.6

Google Cloud Storage

マストドンのUpgrade notesを確認:

release notes:https://github.com/tootsuite/mastodon/releases/tag/v1.4.1

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

  • 必要なNode.jsバージョンが4から6に変更になっています
  • 3つのシステムパッケージが追加で必要になりました
  1. pkg-config
  2. libprotobuf-dev
  3. protobuf-compiler
  • bundle install と yarn installを行い依存関係を更新

Docker-only:

-略-

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)

  • CDN_HOSTを設定している場合、プロトコル部分(http:// または https://)を含んだ形で設定しているかを確認
  • STREAMING_API_BASE_URLをデフォルト以外で設定している場合、プロトコル部分を[ws://] または [wss://]に変更
  • RAILS_ENV=production bundle exec rails assets:precompile
    を実行
  • RAILS_ENV=production bundle exec rails db:migrate
    を実行

手順

node.jsのバージョンを確認 

$ node -v
v4.8.3

npmでnをインストール

$ sudo npm cache clean
$ sudo npm install -g n

nでnodeを最新のstableに変更

$ n stable
$ node -v
v8.0.0

nodeのバージョンが8.0.0に上がったことを確認

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

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

CDN_HOSTとSTREAMING_API_BASE_URLを確認

$ su - mastodon
$ cd live
$ cat .env.production
.env.production
 ~
# CDN_HOST=assets.example.com
 ~
# Streaming API integration
# STREAMING_API_BASE_URL=

特に設定はしていないので変更なし

mastodon Ver.1.4.1を取得

現在のバージョンを確認
$ git branch
* (HEAD detached at v1.3.3)
  master

v1.3.3であることを確認

v1.4.1を取得し、変更
$ git fetch
$ git checkout v1.4.1
Previous HEAD position was a0f7453... Bump version to 1.3.3
HEAD is now at 8963f8c... Bump version to 1.4.1
依存関係の更新
$ bundle install
$ yarn install 
DBマイグレーション
$ RAILS_ENV=production bundle exec rails db:migrate
assetsの中をクリアしてmastodon更新
$ RAILS_ENV=production bundle exec rails assets:clobber
$ yarn install --pure-lockfile
$ RAILS_ENV=production bundle exec rails assets:precompile
mastodon再起動
$ sudo systemctl restart mastodon-*.service

備考

$ RAILS_ENV=production bundle exec rails assets:clobber
~略
$ yarn install --pure-lockfile

の実行に1時間以上かかりました。
その間、ディスクreadが高騰(400iops)し、CPU使用率が100%に張り付いていました。
Webからのアクセスにも問題があったようです。
iPhoneのアプリ(Mustor)からはアクセスできていたので、リバースプロキシ(nginx)がうまく動いていなかったのかもしれません・・・?

DBやストレージを外部においていましたが、とくにそのことによる問題はないようでした。

0
1
2

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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?