Search code examples
mongodbubuntu-18.04self-hostingrocket.chatsnap

RocketChat upgrade from old version installed without snap/docker


I have self-hosted version of RocketChat 3.0.6 on Ubuntu 18.04.5 LTS, that was installed more than 3 years ago. And want to upgrade to the latest available LTS version.


Have no idea how exactly it was installed, but it's for sure not docker/snap method (what was active option at that time?) because there's no snap/docker on that server. Looks like all RC code is here /opt/Rocket.Chat, some directories with rocketchat are in /var/lib/lxcfs/cgroup but MongoDB and all the data located on different mounted storage here /mnt/vdb/mongodb/. Service from /lib/systemd/system/rocketchat.service looks like this:

[Unit]
Description=The Rocket.Chat server
After=network.target remote-fs.target nss-lookup.target mongod.target mongod.service
[Service]
ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocketchat
Environment=NODE_ENV=production
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat?replicaSet=rs01
Environment=MONGO_OPLOG_URL=mongodb://localhost:27017/local?replicaSet=rs01
Environment=ROOT_URL=https://rocketchat.myexampledomain.com/
Environment=PORT=3456
[Install]
WantedBy=multi-user.target

Versions:

  • OS: Ubuntu 18.04.5 LTS
  • RocketChat: 3.0.6
  • NodeJS: v12.14.0
  • MongoDB: 4.0.28
  • Mongo storage: mmapv1
  • OS release from RocketChat admin: 4.15.0-206-generic

So, my questions are:

  • How to make a correct backup (and restore)?
  • How to upgrade that old version correctly? Official docs contain only snap/docker information.
  • If it would be easier, i can install fresh new version correctly using snap. But then how to correctly migrate data i have from old version?

Notes to mention:

  • Adequate downtime is not important, can shut for a few hours with no problem.
  • On the same server i have other apps running that uses http/https. So i have nginx before one that used in RocketChat with upstream to RC port with proxy pass and LE cert.
  • In the root / there's not enough disk space to contain all the data i have (there's 20G total), so i definitely can't move 40G of data there. But it could be possible to create a backup copy because on mounted drive i have more than twice more space.

Solution

  • My recommendation would be to upgrade manually. It doesn't look to be too difficult.

    The official docs do still contain how to install manually, basically just downloading the project and running npm --install on it, then configuring your service file and some permissions, which in your case both are already done.

    The upgrade guide says to just delete the files in the opt directory and copy in new ones.

    I like to use a separate service to do a full backup of my systems so that I don't need to know how to back up individual applications. In the case of RocketChat there's a MongoDB instance behind it, but there's also potential file storage to consider. Plus you have other applications on the system. Rather than trying to remember how to back all of them up individually, a full system clone with something like Clonezilla might be a better option. That way you can easily restore the drive to the condition it was in before the upgrade. If this is a VM, your hypervisor should offer a button where you can just take a snapshot or backup and use that to recover if needed.