All pages

Data

Permanent disks

One directory of the application that survives deployments, for software that keeps its data in files.

When to use one

An application's own files are replaced by every deployment. If your code can keep its data in Postgres or file storage, do that. A disk is for software that cannot: a SQLite database, a tool like Uptime Kuma, a wiki that writes uploads next to itself.

Adding one

On the project's Data tab, under Permanent disk, give the directory inside the application — for example /data — and choose Add disk. It is attached by the next deployment.

Terminal
arrah disk create my-app --path /data
arrah deploy my-app
arrah disk show my-app

What changes about deployments

Two versions writing the same files is how data gets corrupted, so a disk belongs to one container at a time. With a disk, a deployment stops the running version first and then starts the new one: the application is unavailable for a few seconds instead of switching seamlessly. If the new version does not come up, the old one is started again and keeps serving.

Good to know

  • 1 GB, one disk per project. You are warned at 80%. At the limit the application is stopped and nothing is deleted; start it again and remove files within a few minutes.
  • Only the web application has the disk. Background services, scheduled jobs and the release command do not.
  • Branch environments and pull request previews start without one.
  • A new disk belongs to the user your image runs as, so an application that does not run as root can write to it.
  • The directory cannot be a system one such as /etc, /usr or /tmp.

Backups

A disk in use is backed up once a day, and you can take one yourself before a risky change. The application is frozen for the few seconds the copy takes — not stopped — so that every file in the backup is from the same moment. Restoring stops the application, puts the files back and starts it again; what was there before is saved first. See Backups and restore.

Deleting

Deleting the disk restarts the application without it and then removes every file on it. If that restart fails, the disk is kept. Asked for with a token, it waits for your approval.