Migrating From One Rocketchat Instance to Another: File Uploads

I am in the process of migrating everything from our old Rocketchat instance to a brand new fresh Rocketchat Instance. I have already been able to migrate the database over from the old instance to the new instance. However, on the new instance, when I try to download an uploaded file that once existed on the old Rocketchat instance from the new Rocketchat instance, it points to the URL of the old Rocketchat instance. This is not feasible since I plan to take down the old Rocketchat instance eventually. Looking at our old setup, File storage was managed through GridFS. Where are uploaded files stored on the Rocketchat server and how could I get my new Rocketchat instance to point to the new Rocketchat instance URL?

Hi!

If your files are stored with GridFS, the files get stored inside mongodb itself.

so restoring the DB should also restore the files.

Here you can have more information about this configurations and at what collection the files are stored:

1 Like

Thank you so much! If that’s the case, I will probably need to write a script that changes the hostname of the url to the hostname of the new Rocketchat Instance. I will try that out and see how it goes.

by the way, just found out about this issue:

that led me to this nice piece of community code/art/contribution:

if you want to migrate from gridfs to filesystem or amazon s3

be aware: always do backups before migrating stuff around.

The references should be relative so the DB is portable.

External file storage should be relative as well - just make sure the dir is set correctly in Admin.

If they aren’t it is really a bug. You shouldn’t have to script re-referencing every file!

Duda, there is also a Rocket script to do the the same as the gridfsmigrate script in the Rocket repo.

It’s buried and hard to find and I can’t remember where it is. Aaron knows.