File upload directory being deleted on re-deployments

I have an Express API being served from a webservice. Customers are able to upload files to a directory through my front end. The file upload path is one level up from the git repository directory…or so I think.

I have specified the file upload directory as /opt/render/project/uploads in my code. This works fine.

My git repository runs all my code directly from the root of my repo (I don’t have a subdirectory in the repo), so I assume that Render will also be running all my code at the RENDER_SRC_ROOT which appears to be /opt/render/project/src. On each new deploy it seems that the entire RENDER_PROJECT_ROOT including the director above (/opt/render) get’s completely overwritten.

I don’t want my uploads directory deleted on each new deploy as it doesn’t live in the RENDER_SRC_ROOT. The Render docs, don’t mention anything about this, but is there location in the directory that doesn’t get completely wiped on each new deploy?

Hi,

Render instances have an ephemeral filesystem, meaning any file written to the instance after it has booted will be lost when it next restarts (e.g. spun down if on free instance type, next deploy, manual restart, etc.).

If you want to use file uploads on your service, you’ll need to have a persistent store, e.g. a Render Disk (which is chargeable and requires a paid instance type) or an external service like AWS S3.

Alan

Hi Alan! Thanks for replying! For some reason I wasn’t notified of your reply. I understand, will look into my options!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.