跳转主页

最近一次站点维护记录

·1162 字·3 分钟
Pleroma Soapbox
目录

说是维护,其实主要也就干了两件事:一是更换前端;二是升级后端版本到 2.5.2

更换了 Soapbox 的前端

安装

pleroma的安装比较简单,参考文档即可: https://docs.soapbox.pub/frontend/installing/#install-soapbox

  • 下载压缩包curl -L https://gitlab.com/soapbox-pub/soapbox/-/jobs/artifacts/develop/download?job=build-production -o soapbox-fe.zip

  • 解压至pleroma的实例目录下: unzip soapbox-fe.zip -d /var/lib/pleroma

ps. 解压我用文档命令报错1,于是自己改下了。

  • 然后刷新浏览器即可

压缩包不需要可以删除


升级

后续如需 升级Soapbox前端,执行以下命令即可

  • 下载压缩包
curl -L https://gitlab.com/soapbox-pub/soapbox/-/jobs/artifacts/develop/download?job=build-production -o soapbox-fe.zip
  • 移除原有文件
rm -R /var/lib/pleroma/static/packs
rm /var/lib/pleroma/static/index.html
rm -R /var/lib/pleroma/static/sounds
  • 解压
unzip soapbox-fe.zip -o -d /opt/pleroma/instance

或者用这条命令(解压并覆盖现有文件,完成后删除压缩包)

unzip -d /var/lib/pleroma -o soapbox-fe.zip && rm soapbox-fe.zip

移除

如果不想使用了,移除对应文件即可:

rm -R /var/lib/pleroma/static/packs
rm /var/lib/pleroma/static/index.html

*注意在本实例的静态目录下,和官方文档路径不同

自定义页面

参考文档 在这

About pages¶

It is possible to create arbitrary HTML pages under /about/:page on your website.

In your Soapbox installation directory (probably on your server), find the instance folder. For Pleroma, this will be located under /opt/pleroma/instance/static/instance. This directory contains files that are loaded on-demand by the browser, including about pages.

Just create a file like instance/about/hello.html on your server and it will become available under /about/hello on your instance. If you create a file called index.html, it will be treated as the root (available under /about), and you can create subfolders too.

For convenience, Soapbox ships with sample files under instance/about.example. Simply rename that directory to about and start editing!


另外文档中 还有一处 也提到了

Custom files (custom/instance/*)

You can place arbitrary files of any type in the custom/instance/ directory. They will be available on your website at https://example.com/instance/{filename}. Subdirectories are supported, too.

Some use cases:

  • Logos, which can then be referenced from soapbox.json
  • About pages, available at /about on your website.

以上可知:soapbox提供了about页面样例,但文件夹是以“about.example”命名的。如果需要使用,文件夹重命名为“about”

另外文件夹内有一些样例页面,默认是“index.html”,也可以根据自身需求自定义新页面。

丰俭由人。


好了,基本道理清楚了,动手探查一下

文档给的路径没找到,没关系,自行寻找

find / -type d -iname "about.example"

于是查找到路径/var/lib/pleroma/static/instance/about.example

进入对应路径,重命名一下

cd /var/lib/pleroma/static/instance
mv about.example about

进入about文件夹,自由发挥

cd about
ls
nano index.html

好了,遇上写代码的事,我缓缓退下


升级站点

更换完前端,想着既然都开电脑了,不如再升一下版本,之前都干过,熟练工了应该没啥问题。

预料之外,遇上个问题:之前改站点logo时,直接往2.5.1的版本文件里传了图,那图估计没给执行权限(?),结果运行完升级命令老版本其他内容全部删光了(除了那张图片删不了omg)

记录下报错:

rm: remove write-protected regular file '/opt/pleroma/lib/pleroma-2.5.1/priv/static/favicon.png'? 
rm: cannot remove '/opt/pleroma/lib/pleroma-2.5.1/priv/static': Directory not empty

后果就是pleroma cli 全部无法执行……

su pleroma -s $SHELL -lc "./bin/pleroma_ctl update"
-bash: ./bin/pleroma_ctl: No such file or directory

折腾得我焦头烂额的过程就不赘述了,最后找的解决方法:

  • 先删除/opt/pleroma内的文件
rm -r /opt/pleroma/*
  • 重新使用OTP安装pleroma
su pleroma -s $SHELL -lc "
curl 'https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/stable/download?job=$FLAVOUR' -o /tmp/pleroma.zip
unzip /tmp/pleroma.zip -d /tmp/
"

su pleroma -s $SHELL -lc "
mv /tmp/release/* /opt/pleroma
rmdir /tmp/release
rm /tmp/pleroma.zip
"

中途会有确认,直接按A+回车就好

  • 跑升级命令
su pleroma -s $SHELL -lc "./bin/pleroma_ctl update"

su pleroma -s $SHELL -lc "./bin/pleroma_ctl migrate"

最终提示:

[info] Migrations already up
  • 最后重启一下服务器

🎉🎉🎉 解决了 🎉🎉🎉


  1. 报错:instancebusybox: command not found;caution: filename not matched: -o ↩︎



最后更新于: 2023 年 8 月 10 日