Quickstart cipi.yml Web panel API MCP Ecosystem Guides Docs GitHub Telegram channel
  1. Home
  2. Docs
  3. Deploy
  4. Shared directories

Shared directories

What survives a deploy: uploads, SQLite files and other folders kept between releases.

DeployUpdated

Every deploy is a new checkout of the repository in releases/<n>. What the app writes while it runs — uploads, generated files, an SQLite database — would stay behind in the old release. What must outlive a release lives in ~/shared and is linked into every new one: the .env, and the folders each type shares already. Anything else the app writes, you name once.

bash
sudo cipi app edit shop --shared-dirs=public/uploads
sudo cipi deploy shop

What each type shares already#

AppShared without askingAdd with --shared-dirs
Laravel and Octanestorage/ (the public disk, logs, sessions, cache), .envA package that writes to public/ (public/uploads, public/media)
Symfonyvar/log, var/sessions, .env.localUploads (public/uploads, a VichUploader mapping), var/data for an SQLite database
WordPressThe uploads folder (wp-content/uploads, web/app/uploads with Bedrock), .env, wp-config.phpWhat a plugin writes outside it: generated files, wp-content/languages when you let WordPress fetch translations
Laravel Rust and Laravel Gostorage/ — the public disk is served from it at /storage, no link to make — and .envA disk outside storage/
Node.envWhat the server writes: media, data
Custom— its folder is the app, not a release—

Set the list#

bash
sudo cipi app create --symfony --user=api --domain=api.example.com --shared-dirs=public/uploads,var/data
sudo cipi app edit api --shared-dirs=public/uploads,var/data   # the whole list
sudo cipi app edit api --shared-dirs=none                      # only what the type shares
sudo cipi app show api                                         # Shared dirs
  • The list is the whole list. It takes effect on the next deploy.
  • The first deploy after a folder is added copies it from the release that is serving into shared/, so what the app wrote there until then is kept. The copy is whole or not at all.
  • A folder taken off the list keeps its files in ~/shared/<dir>; new releases no longer link it.
  • Refused, with the reason: a path outside the repository or with ..; .git, .env, .ssh, vendor, node_modules; the code itself or what each release builds (public, app, src, config, public/build — a folder inside them is fine); a folder that overlaps what the type shares, or another one of the list; more than 10.

The same list in cipi.yml:

yaml
deploy:
  shared_dirs:
    - public/uploads
    - var/data

A Node app declares its own as node.shared_dirs (Node apps). Previews get the same folders, empty; sudo cipi app clone and sudo cipi sync carry them with their files.

SQLite: kept, or the deploy stops#

An SQLite database inside the release is the one thing a deploy would lose without a word: the next checkout starts without it. A deploy that would do that stops before anything is built or migrated, and says where to keep the file:

AppWhere the database goes
LaravelDB_DATABASE=/home/shop/shared/storage/database.sqlite (sudo cipi app env shop)
Laravel RustDATABASE_URL=sqlite://storage/app.db?mode=rwc
Laravel GoDATABASE_URL=sqlite:storage/app.db
SymfonyDATABASE_URL="sqlite:///%kernel.project_dir%/var/data/app.db" and --shared-dirs=var/data
Any other folder--shared-dirs=<that folder>

The check reads DB_CONNECTION and DB_DATABASE (Laravel's default, empty, is database/database.sqlite: inside the release) and DATABASE_URL. When the release that is serving has the file, copy it to the new place first, as the app, then deploy again. A database file that comes with the repository is the repository's: the deploy goes on and says so. An in-memory database has nothing to keep.

sudo cipi app status reports the same before you deploy.

Common problems#

ProblemFix
Uploads gone after a deployThe app writes them outside what its type shares: --shared-dirs=<that folder>, then deploy
Shared directory 'public' is code or a build of each releaseShare the folder inside it: public/uploads
overlaps storage, which every laravel app shares alreadyIt is shared already: nothing to do
The deploy stops on The SQLite database of this app … is inside the releaseMove the file as the table above says, then deploy again

Questions#

QuestionAnswer
Does it change anything on apps that exist?No: nothing is shared that was not, until you set a list.
Is a shared folder backed up?Yes: backups take shared/ with the rest of the app.
Where are the files on disk?/home/<app>/shared/<dir>; each release has a link to it.