Exclude patterns
Published
Updated
🛡️
Protect files from being overwritten.
Exclude patterns keep files and folders out of a fortrabbit deployment. What sits under an excluded path in the storage stays untouched, which protects user uploads from the replace strategy.
Exclude patterns work with both deployment strategies. An excluded file or folder is not copied from the deploy package, and what exists under that path in the storage stays as it is. With the replace strategy, which deletes everything else, this is what keeps user uploads, logs and sessions across deployments. With both strategies, it keeps build leftovers like node_modules out of the storage.
When the repository contains a deploy file, this setting is managed there and cannot be edited in the dashboard.
The software template sets defaults. Patterns follow rsync syntax: * matches any characters, a leading / anchors the pattern at the Git source directory.
Examples
## WordPress
/wp-content
## Laravel
/storage
## Kirby CMS (if using git + rsync)
/content
/media
## Wildcard syntax
*/files
## Exclude files from the final build
/node_modules
One setting, two use cases
- Exclude from deployment: Prevent files from being copied to the environment. Works with both strategies.
- Useful for files that are only needed during the build.
node_modulesis the common case, and the software templates set it.
- Preserve on environment: Prevent files from being deleted by the replace strategy.
- Essential for runtime data created by the application.
- Example: User uploads, content files, and logs.
Replace patterns
With the merge strategy, replace patterns do the reverse: they name folders that are swapped completely while everything else is kept.