静看光阴荏苒
不管不顾不问不说也不念

Mastodon实例升级方法

有一台2.5.2版本的实例运行了一段时间了,昨天官方发布了最新版2.6.1,记录一下更新过程。。。

不过话说回来,真的不建议去经常升级这套程序,如果不是当前版本有严重漏洞的话,还是不要折腾的好,万一升炸了,就麻烦了。。

开始之前应该先停止运行Mastodon的所有服务:

systemctl stop mastodon-*

进入到项目目录:

cd live

如果是初次升级,首先应该配置git用户:

git config --global user.email "imlala@example.com"
git config --global user.name "imlala"

然后获取最新版本的代码:

git stash
git fetch --tags
git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)

安装ruby依赖:

bundle install --deployment --without development test

安装node.js依赖:

yarn install --pure-lockfile

更新数据库:

RAILS_ENV=production bundle exec rails db:migrate

重新生成静态文件:

RAILS_ENV=production bundle exec rails assets:precompile

最后重新启动Mastodon的服务:

systemctl start mastodon-web.service
systemctl start mastodon-sidekiq.service
systemctl start mastodon-streaming.service

OK,现在应该成功升级到最新版本了:

除这篇文章记录的步骤以外,在升级前你还应该仔细参考官方的releases页面:https://github.com/tootsuite/mastodon/releases

仔细看看新版本的发布记录,看有没有什么特别需要注意的地方,以防万一。。

还是要吐槽一下这个Mastodon,一定要在大于2GB内存的机器上面部署,1GB能跑但是跑的太吃力了,基本上几天就要用到800多MB内存,然后随便发点什么消息内存不够程序就卡死,因为跑在一台阿里云4.5刀的机器上,要升级到2G内存,价格直接翻了几倍,真是TM坑的一B,各位在部署之前一定要找好机器,因为这东西迁移非常麻烦。

赞(3)
未经允许不得转载:荒岛 » Mastodon实例升级方法
分享到: 更多 (0)

评论 13

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    shafa

    arms5年前 (2018-11-01) Google Chrome 63.0.3239.132 Google Chrome 63.0.3239.132 Windows 7 x64 Edition Windows 7 x64 Edition回复
  2. #2

    这篇文章地址是个4399 :grin:

    ovo5年前 (2018-11-02) Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 Android 6.0.1 Android 6.0.1回复
    • 老哥双开吗,我魂斗罗贼6,233

      LALA5年前 (2018-11-04) Google Chrome 70.0.3538.77 Google Chrome 70.0.3538.77 Windows 10 x64 Edition Windows 10 x64 Edition回复
  3. #3

    lala,你博客用的什么模版,能不能说下名字 :oops:

    阿法5年前 (2018-11-04) Google Chrome 70.0.3538.77 Google Chrome 70.0.3538.77 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 大前端DUX

      LALA5年前 (2018-11-07) Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
  4. #4

    lala主站换服务器了?这边联通打开好快 :grin:

    XEON5年前 (2018-11-06) Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 Android 9 Android 9回复
    • 没有换,心理作用吗?

      LALA5年前 (2018-11-07) Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 不是,的确快了好多 :arrow:

        XEON5年前 (2018-11-08) Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 Android 9 Android 9回复
  5. #5

    7天了,还不更新,消极怠工啊

    YuGer5年前 (2018-11-07) Google Chrome 70.0.3538.77 Google Chrome 70.0.3538.77 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 太忙了,没什么时间最近。。

      LALA5年前 (2018-11-07) Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 我可是一直盯着你呢

        YuGer5年前 (2018-11-08) Google Chrome 70.0.3538.77 Google Chrome 70.0.3538.77 Windows 10 x64 Edition Windows 10 x64 Edition回复

分享创造快乐

广告合作资源投稿