Mongodb 聊天服务器关闭并忘记设置

Mongodb 聊天服务器关闭并忘记设置,mongodb,rocket.chat,Mongodb,Rocket.chat,我们在Ubuntu服务器上安装了Rocket.Chat服务器的一个实例。一切都很好。但每天晚上,Rocket.Chat服务器都会工作,忘记url和MongoDB设置。然后我需要再做一次: export ROOT\u URL=http://your-host-name.com-as-accessed-from-internet/ 导出MONGO\u URL=mongodb://localhost:27017/rocketchat node main.js 然后服务器运行。但是每天晚上我们都有同

我们在Ubuntu服务器上安装了Rocket.Chat服务器的一个实例。一切都很好。但每天晚上,Rocket.Chat服务器都会工作,忘记url和MongoDB设置。然后我需要再做一次:

  • export ROOT\u URL=http://your-host-name.com-as-accessed-from-internet/
  • 导出MONGO\u URL=mongodb://localhost:27017/rocketchat
  • node main.js
然后服务器运行。但是每天晚上我们都有同样的问题


有人知道这个问题并有解决方案吗?

添加答案,这样问题就结束了

Disclaimer: I work for Rocket.Chat. 
为什么服务器最终会工作?日志中有什么信息吗


此外,由于您正在shell会话中设置这些变量,它们将在下一个会话中清除。如果您想让它们持久化,您必须在/etc/profile中添加。。。您也可以通过“支持”频道上的demo.rocket.chat联系我们,或在github.com/RocketChat/rocket.chat/issues上提交问题。

要解决此问题,您应该创建RocketChat服务并将其作为系统启动过程/服务启用

您可以查看有关如何创建rocketchat服务的视频教程

ADD ROCKET CHAT SERVICE

gedit  /usr/lib/systemd/system/rocketchat.service

# Add following lines in this service file

[Unit]
  Description=The rocket chat server
  After=network.target remote-fs.target nss-lookup.target nginx.target mongod.target
  [Service]
  ExecStart=/bin/node /opt/rocketchat/main.js
  StandardOutput=syslog
  StandardError=syslog
  SyslogIdentifier=ping
  User=root
  Environment=MONGO_URL=mongodb://localhost:27017/rocketchat ROOT_URL=http://192.168.0.138 PORT=3000
  [Install]
  WantedBy=multi-user.target

systemctl enable rocketchat.service
systemctl start rocketchat.service