Roadmap Reveal 🗺 What's next for Rocket.Chat, Sep 22

Rocket.Chat rocketchatclt Update Loses all File Uploads

Rocket.Chat on premise servers 3.14.0 +
on CentOS 7

The rocketchatctl program loses all file uploads during update.
So after a Rocket.Chat update all attachments, image pastes and documents added to chats are inaccessible, disappear, show as blank boxes or “RETRY” placeholders.

The rocketchatctl update process renames the current Rocket.Chat folder (/opt/Rocket.Chat on CentOS) to /opt/Rocket.Chat.bkup, installs the latest version as /opt/Rocket.Chat then deletes the backup WITHOUT moving or copying the UPLOADS folders.

This seems like an easy fix in the simple bash-based rocketchatctl.

For those who want to save their UPLOADED files (everyone???), make sure you make a directory copy FIRST before updating… (of course you should ALWAYS have a full server/DB backup too!)

cp -R /opt/Rocket.Chat /opt/Rocket.Chat.my.bak

Then after the update, run these two commands to check if your old Rocket.Chat uploads folder is empty - if NOT, then move the contents and change the file permissions:

[ "$(ls -A /opt/Rocket.Chat.my.bak/server/uploads)" ] && mv /opt/Rocket.Chat.my.bak/server/uploads/* /opt/Rocket.Chat/server/uploads/
[ "$(ls -A /opt/Rocket.Chat/server/uploads)" ] && chown -R rocketchat:rocketchat /opt/Rocket.Chat/server/uploads

For reference, the rocketchatctl bash script is located at: /usr/local/bin/rocketchatctl
The UPDATE function starts at line 916

If you want to fix rocketchatctl, just add the following two lines at LINE 924, right after
" install_rocketchat" line.

[ "$(ls -A $ROCKETCHAT_DIR_UPDATE)" ] && mv "$ROCKETCHAT_DIR_UPDATE"/server/uploads/* "$ROCKETCHAT_DIR"/server/uploads/
[ "$(ls -A $ROCKETCHAT_DIR/server/uploads)" ] && chown -R rocketchat:rocketchat "$ROCKETCHAT_DIR"/server/uploads


I presume from this that you changed from the default “GridFS” to “file system” and then put your uploads in the same directory as Rocket.Chat?

I’m not sure that there is an easy way to check where the uploads are stored.

It would be much easier to move the directory outside the Rocket install directory.

eg /opt/filestore

I will speak to the people who maintain the script to see if there is a solution.

We have several medium, Rocket chat installations running for a few years and ALL have this constant, continued problem of LOST upload files.

Yes, we do change the “DEFAULT” from GridFS → as specifically recommended by Rocket.Chat developers…Rocket.Chat Storage

The reason we spend (considerable) extra time to install, configure and maintain Rocket.Chat instead of using Slack is because these entities strictly forbid any cloud storage of internal data/conversations. As such, storing on Amazon S3 or Google Cloud is totally not possible. A huge number of Rocket.Chat installers are using it specifically for this same reason.

For maximum compatibility and reduced upgrade/migration/restore hassles we try to keep as many settings as possible at default - the default “file system” storage location is:

/opt/Rocket.Chat/server/uploads

It would be nice if Rocket.Chat might consider one of the following significant and relatively easy improvements:

  1. change the documentation to strongly suggest moving the default UPLOADs location
  2. alter the upgrade script to simply copy the default UPLOADs content folder (seems like a no-brainer)
  3. include information/warning in the update script - your filesystem UPLOADS folder will be lost

Good points and we have taken them on board.

Someone will be looking at this in due course.