Skip to content

Instantly share code, notes, and snippets.

@anon5r
Created May 29, 2017 01:45
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save anon5r/bd96ee4127d6b66ad4150287f5a4ed99 to your computer and use it in GitHub Desktop.
Save anon5r/bd96ee4127d6b66ad4150287f5a4ed99 to your computer and use it in GitHub Desktop.
マストドンのシンプルなアップデート手順。主にさくらのクラウドのスタートアップスクリプトを利用してインストールした場合を想定しています。
#!/bin/sh
# 無難な対応としては、最初にmastodonを一度停止した方が良いので停止する。
# systemctl stop mastodon-{web,sidekiq,stream}
# mastodonユーザー出ない場合は下記のコマンドでmastodonユーザーになる
# 一般ユーザーからの場合
# sudo su - mastodon
#
# rootユーザーからの場合
# su - mastodon
# Mastodonのインストールパスに移動
cd /home/mastodon/live
# git で最新の状態を取得してくる
git fetch origin
# 通常のリリース版のアップデートでは、タグで管理されたバージョンのものに更新することでstable版となる。
#
# 正しく取得できた場合、下記の様に表示される
# remote: Counting objects: 288, done.
# remote: Total 288 (delta 191), reused 191 (delta 191), pack-reused 97
# Receiving objects: 100% (288/288), 64.24 KiB | 104.00 KiB/s, done.
# Resolving deltas: 100% (204/204), completed with 91 local objects.
# From https://github.com/tootsuite/mastodon
# * [new branch] 1.3-stable -> origin/1.3-stable
# * [new branch] feature-ldap -> origin/feature-ldap
# * [new branch] feature-multicolumn -> origin/feature-multicolumn
# * [new branch] feature-trademark -> origin/feature-trademark
# c52090db..8963f8c3 master -> origin/master
# * [new branch] skylight -> origin/skylight
# * [new tag] v1.4.1 -> v1.4.1
# * [new tag] v1.4rc1 -> v1.4rc1
# * [new tag] v1.4rc2 -> v1.4rc2
# * [new tag] v1.4rc3 -> v1.4rc3
# * [new tag] v1.4rc4 -> v1.4rc4
# * [new tag] v1.4rc5 -> v1.4rc5
# * [new tag] v1.4rc6 -> v1.4rc6
#
# 新しいリリース版が出ているにもかかわらず上記コマンドでも当該バージョンのタグが取得されない( * [new tag] が表示されない)場合は
# 下記のコマンドで取得してみる
# git fetch --tags origin
# または、既に取得済みである可能性もあるので、その場合は
# git tag -l
# で現在取得済みのタグ一覧を表示し、当該バージョンのリリースタグがあるか確認する
# 取得したら目的のタグに切り換える。ここでは v1.4.1 にアップデートする。
git checkout v1.4.1
# チェックアウトしたら、アップデート作業を行っていく。
# bundler を使用して gem やらの更新
bundle install
# フロントエンド関連のライブラリも yarn で更新
yarn install
# DBの構成変更がある場合は db:migrate を実行する(何も無い場合も実行しても何も起こらない)
RAILS_ENV=production bundle exec rake db:migrate
# フロントエンドのCSSやJSの更新とパッケージング(これがチョット長い)
RAILS_ENV=production bundle exec rake assets:precompile
# ここまで終わったらあとは mastodon-web, mastodon-sidekiq, mastodon-stream を起動する
# 一般ユーザーの場合 sudo systemctl start mastodon-{web,sidekiq,stream}
# root の場合 systemctl start mastodon-{web,sidekiq,stream}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment