How to update Directus without losing CMS uploads


I have a Directus install I want to update. The client has been uploading images to the CMS which is in “/uploads/”, when I want to update Directus, I’m assuming I update my local version and redeploy. But my concern is it will override the “/uploads/” folder getting rid of all the user uploaded images.

Is there a method for updating Directus without losing the images?

Hey @Tom,

Thanks for asking this question!

The best way right now is to create a custom deployment hook to move or link to a shared directory. You can see how that might be done on this post - Linking to a shared folder across deployments.

In related news, we’re working on giving first-class treatment for Directus and this issue has come up from some other Directus users, so part of that initiative for us will be a better solution around this. Plus, this will benefit other similar use-cases as well.

1 Like

One more thing!

Since we’re working on giving Directus improved support, we’d love to hear what else may be on your wishlist for managing servers and deployments for Directus apps. :hear_with_hearing_aid:

I think one solution which maybe a onsize fit all. The ability to push back to Git before performing the upgrade. That way you can keep Git up to date too. What are your thoughts on that?

Hi @amiedema,

I’ve had a look at this guide - is there a way of doing this with a web app that already exists? I’m looking to update, but I want to keep the current upload folder because Directus uses that one.

You should be able to do something like the following:

  1. Copy upload folder from current live site
  2. Paste in some directory, such as `/home/cleavr//uploads
  3. Create a custom deployment hook that runs during deployment which creates a symlink in the new release directory that points to the shared uploads directory
1 Like