Skip to content
ricochet

Persistent Storage

Ricochet isolates each deployment from the one before it. To keep files across deployments, or to let your app’s workers use the same files, save them in the ./persistent directory.

Ricochet puts ./persistent at the root of your bundle in every deployment, and keeps what you save there until you delete the app or task. Treat ./persistent like any other folder:

# save a model, then read it back after a restart or redeploy
saveRDS(model, "persistent/model.rds")
model <- readRDS("persistent/model.rds")

On your own machine, persistent/ exists only once you create it. Create it at the start of your code so the same code runs locally and on ricochet:

dir.create("persistent", showWarnings = FALSE)

Ricochet starts your code in the root of your bundle, where persistent/ lives. Shiny, Quarto and R Markdown switch to the folder of your entrypoint before they run your code. If your entrypoint is app/app.R or reports/index.qmd, save to ../persistent/ instead, with one ../ for each folder level.

To start with data, put a persistent/ folder in your bundle. When you deploy, ricochet copies its files into persistent/ and keeps any file already there with the same name.

If you only use a local persistent/ folder for testing, leave it out of the bundle in _ricochet.toml:

[content]
exclude = ["persistent/**"]

Open your app or task and select Files:

  • Deployment lists the files in one deployment. It opens on your newest successful deployment, and Bundle switches to another one.
  • Persistent lists the files in ./persistent.

You need the Contributor role to see these files and the Editor role to download them.

Deployment leaves out persistent/ and package environments such as renv/ and .venv/. It lists .env, .env.* and .Renviron files as hidden, and you can’t download them, because they may contain secrets.

Ricochet installs each version of an R, Julia or Python package once, then reuses it for every app and task that needs it. So you wait less on later deployments.