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