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

关于之前的Mastodon部署教程的一点更改和补充

今天重新按照自己之前的文章部署了一遍Mastodon,发现到连接数据库这块的时候死活连不上数据库。。。

估计是开发者改了点什么不允许空密码登录了?下面是解决办法:

首先还是按照往常一样安装并初始化postgresql。接着更改postgresql的配置文件:

vi /var/lib/pgsql/10/data/pg_hba.conf

默认的是这样:

改为下面这样,启用MD5加密:

如果你之前已经启动了postgresql,那么这里要重启使配置文件生效:

systemctl restart postgresql-10

接着切到postgres用户下:

su postgres

创建一个数据库用户:

createuser mastodon

再切到psql:

psql

执行:

ALTER USER mastodon WITH ENCRYPTED password '设置一个你的数据库密码' CREATEDB;

完成之后退出:

exit

这样Mastodon数据库无法连接的问题就应该解决了。

另外之前那篇文章安装ruby是使用的rbenv,说实话这玩意有点蛋疼,今天部署的时候我把它换成了rvm,使用起来顺滑一些。下面是rvm的安装方法。

导入GPG密钥

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

直接就可以安装了:

\curl -sSL https://get.rvm.io | bash -s stable

使rvm命令生效:

source /etc/profile.d/rvm.sh

然后我们就可以使用rvm安装ruby了(依赖什么的还是要按照我之前的文章先装好):

rvm install 2.5.1

完成之后设置使用的版本:

rvm use 2.5.1

除此之外,之前我那篇文章是把Mastodon跑在Mastodon这个用户下的,感觉还不如跑在root用户下面,再加上现在用了rvm,所以systemd的配置文件也要做相应更改:

vi /etc/systemd/system/mastodon-web.service
[Unit]
Description=mastodon-web
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/live
Environment="RAILS_ENV=production"
Environment="PORT=3000"
ExecStart=/bin/bash -lc 'bundle exec puma -C config/puma.rb'
ExecReload=/bin/kill -SIGUSR1 $MAINPID
TimeoutSec=15
Restart=always

[Install]
WantedBy=multi-user.target
vi /etc/systemd/system/mastodon-sidekiq.service
[Unit]
Description=mastodon-sidekiq
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/live
Environment="RAILS_ENV=production"
Environment="DB_POOL=5"
ExecStart=/bin/bash -lc 'bundle exec sidekiq -c 5 -q default -q push -q mailers -q pull'
TimeoutSec=15
Restart=always

[Install]
WantedBy=multi-user.target
vi /etc/systemd/system/mastodon-streaming.service
[Unit]
Description=mastodon-streaming
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/live
Environment="NODE_ENV=production"
Environment="PORT=4000"
ExecStart=/usr/bin/npm run start
TimeoutSec=15
Restart=always

[Install]
WantedBy=multi-user.target

最后关于Mastodon发邮件的一点补充,之前的文章是使用的本地发信,所以直接装个sendmail应该就可以成功发信了:

yum -y install sendmail

运行并设置开机启动:

systemctl start sendmail
systemctl enable sendmail

这种垃圾文章不发点图,会有人看?(我又侵犯肖像权了)

赞(3)
未经允许不得转载:荒岛 » 关于之前的Mastodon部署教程的一点更改和补充
分享到: 更多 (0)

评论 19

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

    我又来啦 lala好棒 :wink:

    系时5年前 (2018-10-27) Google Chrome 70.0.3538.77 Google Chrome 70.0.3538.77 Windows 10 x64 Edition Windows 10 x64 Edition回复
  2. #2

    哈哈哈哈,博主把要饭钱从最低0.1改成1元了。

    隔壁老谢5年前 (2018-10-28) Google Chrome 70.0.3538.77 Google Chrome 70.0.3538.77 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • plz~

      LALA5年前 (2018-10-30) Google Chrome 67.0.3396.99 Google Chrome 67.0.3396.99 Windows 10 x64 Edition Windows 10 x64 Edition回复
  3. #3

    这个小姐姐耐看

    瞎折腾5年前 (2018-10-28) Google Chrome 68.0.3440.91 Google Chrome 68.0.3440.91 Android 6.0.1 Android 6.0.1回复
  4. #4

    emmmmm

    搬砖大佬5年前 (2018-10-28) Microsoft Edge 17.17134 Microsoft Edge 17.17134 Windows 10 x64 Edition Windows 10 x64 Edition回复
  5. #5

    男的?这妆画的真好! :lol:

    LoveXu5年前 (2018-10-28) Google Chrome 70.0.3538.64 Google Chrome 70.0.3538.64 Android 8.0.0 Android 8.0.0回复
    • 不不不,你想多了,应该是个妹子,只是怎么说呢,这张图看着有点男人的气息在里面,就很奇怪。。

      LALA5年前 (2018-10-30) Google Chrome 67.0.3396.99 Google Chrome 67.0.3396.99 Windows 10 x64 Edition Windows 10 x64 Edition回复
  6. #6

    发信失败啊啊啊啊头疼

    搬砖大佬5年前 (2018-10-28) Microsoft Edge 17.17134 Microsoft Edge 17.17134 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 搞个mailgun用smtp发吧。

      LALA5年前 (2018-10-30) Google Chrome 67.0.3396.99 Google Chrome 67.0.3396.99 Windows 10 x64 Edition Windows 10 x64 Edition回复
  7. #7

    直接看图,这文章写了啥?

    chperfect5年前 (2018-10-29) Google Chrome 69.0.3497.100 Google Chrome 69.0.3497.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • LALA5年前 (2018-10-30) Google Chrome 67.0.3396.99 Google Chrome 67.0.3396.99 Windows 10 x64 Edition Windows 10 x64 Edition回复
  8. #8

    已撸。

    隔壁老谢5年前 (2018-10-29) Google Chrome 70.0.3538.77 Google Chrome 70.0.3538.77 Windows 10 x64 Edition Windows 10 x64 Edition回复
  9. #9

    为啥这作者总屏蔽我的评论? :???:

    隔壁老谢5年前 (2018-10-29) Google Chrome 70.0.3538.77 Google Chrome 70.0.3538.77 Windows 10 x64 Edition Windows 10 x64 Edition回复
  10. #10

    卧槽,好歹赏你3毛,还屏蔽我评论。 :idea:

    隔壁老谢5年前 (2018-10-29) Google Chrome 70.0.3538.77 Google Chrome 70.0.3538.77 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 没那个时间屏蔽你,Akismet自动进垃圾箱,你自己的锅。

      LALA5年前 (2018-10-30) Google Chrome 67.0.3396.99 Google Chrome 67.0.3396.99 Windows 10 x64 Edition Windows 10 x64 Edition回复
  11. #11

    要是在 root 下走程序的话, nginx 的网站配置是不是也得需要改?

    Ranger.5年前 (2019-07-21) Google Chrome 75.0.3770.142 Google Chrome 75.0.3770.142 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • nginx的网站配置应该是不用改的,就是nginx的运行用户和组可能需要改成root,不过不是很推荐直接用root去跑程序。。

      LALA5年前 (2019-07-22) Google Chrome 75.0.3770.100 Google Chrome 75.0.3770.100 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 好的. 还一个问题, 貌似用 sendmail 发不出去邮件。

        Ranger.5年前 (2019-07-22) Google Chrome 75.0.3770.142 Google Chrome 75.0.3770.142 Windows 10 x64 Edition Windows 10 x64 Edition回复

分享创造快乐

广告合作资源投稿