# Shared directories

> Keep what a Laravel, Symfony, WordPress or Node app writes — uploads, an SQLite database — between zero-downtime releases. A deploy that would lose it stops first.

URL: https://cipi.sh/docs/shared-directories · Last updated: 2026-12-06 · Section: Deploy

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

| App | Shared without asking | Add with `--shared-dirs` |
| --- | --- | --- |
| [Laravel](https://cipi.sh/docs/create-app) and [Octane](https://cipi.sh/docs/octane) | `storage/` (the `public` disk, logs, sessions, cache), `.env` | A package that writes to `public/` (`public/uploads`, `public/media`) |
| [Symfony](https://cipi.sh/docs/symfony-apps) | `var/log`, `var/sessions`, `.env.local` | Uploads (`public/uploads`, a VichUploader mapping), `var/data` for an SQLite database |
| [WordPress](https://cipi.sh/docs/wordpress-apps) | The uploads folder (`wp-content/uploads`, `web/app/uploads` with Bedrock), `.env`, `wp-config.php` | What a plugin writes outside it: generated files, `wp-content/languages` when you let WordPress fetch translations |
| [Laravel Rust](https://cipi.sh/docs/laravel-rust) and [Laravel Go](https://cipi.sh/docs/laravel-go) | `storage/` — the `public` disk is served from it at `/storage`, no link to make — and `.env` | A disk outside `storage/` |
| [Node](https://cipi.sh/docs/node-apps#deploy-options) | `.env` | What the server writes: `media`, `data` |
| [Custom](https://cipi.sh/docs/custom-apps) | — 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`](https://cipi.sh/docs/yml#file):

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

A Node app declares its own as `node.shared_dirs` ([Node apps](https://cipi.sh/docs/node-apps#deploy-options)). [Previews](https://cipi.sh/docs/preview-environments) get the same folders, empty; [`sudo cipi app clone`](https://cipi.sh/docs/manage-apps#clone) and [`sudo cipi sync`](https://cipi.sh/docs/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:

| App | Where the database goes |
| --- | --- |
| Laravel | `DB_DATABASE=/home/shop/shared/storage/database.sqlite` (`sudo cipi app env shop`) |
| Laravel Rust | `DATABASE_URL=sqlite://storage/app.db?mode=rwc` |
| Laravel Go | `DATABASE_URL=sqlite:storage/app.db` |
| Symfony | `DATABASE_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`](https://cipi.sh/docs/health-checks#app-status) reports the same before you deploy.

## Common problems

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

## Questions

| Question | Answer |
| --- | --- |
| 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. |

---

Index of every page: https://cipi.sh/llms.txt · Everything in one file: https://cipi.sh/llms-full.txt · Source: https://github.com/cipi-sh/cipi (MIT)
