diff --git a/content/docs/deployment/rsync/contents.lr b/content/docs/deployment/rsync/contents.lr index c47997a0..e7060874 100644 --- a/content/docs/deployment/rsync/contents.lr +++ b/content/docs/deployment/rsync/contents.lr @@ -37,3 +37,34 @@ private key without newlines or whitespace. To find out which type your key is look at the first line of the key marker. For instance `BEGIN EC PRIVATE KEY` indicates an `EC` key. If no key type is defined `RSA` is assumed. + +## Deletion Support + +To keep two directories truly in sync when deploying with `rsync`, +it's necessary to explicitly tell `rsync` to remove files or directories +on target that don't exist on source anymore. This can be done using the +`?delete` URL parameter: + +```ini +[servers.production] +target = rsync://server/path/to/folder?delete +``` + +If the parameter is provided Lektor will issue a `rsync --delete-delay`, +which performs deletions after all other transfers ended, and only in case +there were no failures. + +!!!! Note that the `?delete` option will remove **any file or directory** +on target that does not exist on source. This means that if you have files +in the target tree that are not managed by lektor, they will get removed. + +## Exclusion Support + +You can exclude items from being synced by using one or more `exclude` +parameters. This is also useful in combination with `delete` to prevent +removal of files in the target tree that are not managed by lektor: + +```ini +[servers.production] +target = rsync://server/path/to/folder?delete&exclude=target_item_1&exclude=target_item_2 +```