Articles

SQLite data or uploads lost after a redeploy on Railway, Render or Heroku

A redeploy on Railway, Render or Heroku starts from a fresh filesystem, so a SQLite file or uploads on local disk are gone for good. What each platform keeps, and how to keep the data next time.

Updated

A SQLite database or uploaded files disappear after a redeploy when the app wrote them to its container's own filesystem: Railway, Render and Heroku start every new deploy from a fresh copy of it. Only data on a Railway volume or a Render persistent disk survives, and Heroku has no disk to attach. Once the old container is gone, the data is gone too; a Railway employee confirmed there is no snapshot or recovery window. To stop it happening again, mount a volume or disk at the exact path the app writes to, or move the data off the instance: records into a managed database, files into object storage.

What each platform does to local files

PlatformOn a redeployWhat survivesGetting it back
RailwayAll storage is ephemeral unless it is on a Railway volume, and a new deploy wipes it. A deploy Railway starts itself, such as its move to Railway Metal, wipes it the same wayFiles under a volume's mount pathNone: a Railway employee confirmed there is no snapshot or recovery window once a container is removed
RenderWithout a persistent disk, every change to the service's local files is lost on each redeploy or restartFiles under a persistent disk's mount path, on a paid serviceThe docs describe none for the ephemeral filesystem. A persistent disk has automatic daily snapshots, kept for seven days
HerokuEach dyno's files are deleted when it restarts: on every deploy, config var or add-on change, and at least once a day unless a Fir app opts out. Each dyno also has its own copyNothing written on the dyno. Heroku points to Heroku Postgres and S3Heroku deletes the changes at restart. Its SQLite page says an app using SQLite would lose its whole database at least once a day

The data usually sits somewhere you didn't think of as storage: a SQLite file such as Django's default db.sqlite3, n8n's /home/node/.n8n/database.sqlite, an uploads folder such as public/uploads or media/, or a ./data directory. Search the code for the usual names before the next deploy:

bash
grep -rniE "sqlite|upload|\./data" --exclude-dir=node_modules --exclude-dir=.git .

Keep it on the same platform

Railway. Attach a volume and mount it where the app writes. Railway puts the app in /app, so an app that writes to ./data needs the volume at /app/data. A service can have only one volume, can't run replicas with it, and has a short downtime on every redeploy, because Railway won't mount one volume into two deployments at once. Volumes are not mounted during the build or the pre-deploy command.

Render. Upgrade to a paid instance type and add a persistent disk at the app's data path: on a native runtime, under /opt/render/project/src, for example /opt/render/project/src/storage; with Docker, under the Dockerfile's WORKDIR. Only files under the mount path persist. A service with a disk runs one instance, loses zero-downtime deploys (Render stops the old instance before starting the new one) and can't reach the disk from its build command, pre-deploy command or one-off jobs.

Heroku. There is no disk to mount. Move records to Heroku Postgres and files to S3, as Heroku's own SQLite and S3 pages advise.

A volume or disk keeps the data, but ties the app to a single instance on both Railway and Render. A managed database and object storage keep the data and let the app run more than one instance, on any of these platforms.

Move the data off the instance

If the SQLite file or the uploads were already lost in a redeploy, there is nothing left on the old container to move. Start from your last backup or export.

On Gregale

Gregale has no persistent disk either. Files an app writes locally are lost on every redeploy, and also whenever an idle app parks, so local files go missing sooner on Gregale than on an always-on service. The fix is the one above: move the data off the instance.

bash
gregale add postgres --app my-api
gregale add bucket uploads --app my-api

Managed PostgreSQL starts on the Hobby plan, and add postgres binds the database to the app as DATABASE_URL. Object storage is on every plan.

What Gregale adds is catching the mistake before the data matters:

  • At deploy. A deploy built on a datastore image such as postgres, redis or mysql is refused with HTTP 422 and stateless_only_violation, before anything is created.
  • At runtime. The first write to a database-shaped directory such as /data records a stateless.advisory audit row with severity high. It doesn't block the write, and the file is still lost at the next park or redeploy. List the rows with:
bash
gregale audit list --kind-prefix stateless --app my-api

Neither check sees everything. A Dockerfile that only creates an empty /data directory deploys without a warning; the audit row appears only once the app writes there. Both checks were run on Gregale's production platform on 2026-12-04, and the test results are on What breaks when your app scales to zero, with the full list of what the checks look for.

Railway and Render don't check for this mistake: their docs describe mounting a volume or disk, and no warning when an app writes outside one.

To move an app here, see Migrate from Railway, Migrate from Render or Migrate from Heroku.

Sources, checked on December 5, 2026: Railway volumes, Railway volumes reference, Railway Metal, Railway employee answer on recovery, Render persistent disks, Heroku dynos, Heroku dyno restarts, SQLite on Heroku, Heroku: using S3 for file uploads.

Pricing

Managed PostgreSQL is generally available on Hobby and above; object storage is on every plan. See Gregale pricing, Managed PostgreSQL and Object storage.

Questions

Why did my SQLite database reset after a redeploy on Railway?

The file was on the container’s own filesystem, which Railway treats as ephemeral and wipes on every new deploy. Mount a Railway volume at the path the app writes to, for example /app/data for ./data, or move the records to a managed PostgreSQL database.

Why does my SQLite database on Heroku reset every day?

Heroku restarts every dyno at least once a day, and on every deploy, config var change and add-on change, and deletes the dyno’s local file changes when it does. There is no disk to attach, so Heroku’s own advice is Heroku Postgres for records and S3 for files.

Can I recover files lost in a redeploy?

Not from the old container. A Railway employee confirmed there is no snapshot or recovery window once a container is removed, and Heroku deletes local changes when a dyno restarts. A Render persistent disk has daily snapshots, but only of files under the disk’s mount path.

Does a Render persistent disk stop the data loss?

For files under its mount path, yes, on a paid service. The service then runs a single instance, loses zero-downtime deploys, and can’t reach the disk from its build command, pre-deploy command or one-off jobs.

Does Gregale keep local files across a redeploy?

No. Gregale has no persistent disk, and local files are lost on every redeploy and whenever an idle app parks. It refuses datastore images at deploy with stateless_only_violation, and records a stateless.advisory audit row when an app writes to a directory such as /data. Keep records in managed PostgreSQL, on Hobby and above, and files in object storage.