请注意,本文编写于 1835 天前,最后修改于 1354 天前,其中某些信息可能已经过时。
由于太久没关注Mastodon了,今天一看都到了2.8.0版本了,而我的版本还停留在2.6.5。于是在升级之余便打算来顺路写一下这次关于Mastodon实例更新的过程的文章。
前言
关于 Mastodon
的话,之前也有写过文章,如果你想了解或者想自己搭建一个 Mastodon实例
的话,不妨看下以下文章,或许会给你提供一定的帮助。
更新过程
话不多说,现在就让我们来看下整个更新的流程吧。
在更新开始前,应使用 root
用户来停止使用 Mastodon
的所有服务。
systemctl stop mastodon-*
紧接着切换到 Mastodon
用户并进入 Mastodon
目录
su mastodon
cd ~/live
由于我之前是使用Mastodon用户进行的安装,所以才切换到Mastodon用户,此处切换到你安装时所使用的用户即可。
如果是初次升级,首先应该配置git用户:
git config --global user.name "你的github用户名"
git config --global user.email "你的邮箱"
然后获取最新版本的代码:
git stash
git fetch --tags
git checkout $(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)
安装ruby依赖:
bundle install
小插曲
bash: bundle: command not found
这里出了些小问题,提示我没有找到该命令。看了下官方文档发现原来这次的 2.8.0
版本需要的Ruby升级到了2.6.1。而我之前安装时使用的Ruby时 2.5.3
的,版本貌似跟不上了。
那我们就先升级Ruby到2.6.1版本
rvm list known
rvm install 2.6.1
完成之后设置使用的版本:
rvm use 2.6.1
提示:
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
输入:
/bin/bash --login
更新rubygems:
gem update --system
安装ruby依赖:
bundle install
安装node.js依赖:
yarn install
该安装过程可能较慢,请耐心等待。
更新数据库:
RAILS_ENV=production bundle exec rails db:migrate
重新生成静态文件:
RAILS_ENV=production bundle exec rails assets:precompile
最后切换回 root
用户,重新启动 Mastodon
的服务即可:
su root
systemctl start mastodon-web.service
systemctl start mastodon-sidekiq.service
systemctl start mastodon-streaming.service
好了,本次升级过程到此结束。最后提醒一下,每次升级前记得先看官方文档介绍,看有没有什么特别需要注意的地方,以防万一。
版权属于:Rintarou°
本文链接:https://www.rin404.com/archives/mastodon-update.html
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。