-
Notifications
You must be signed in to change notification settings - Fork 33
Add docs about Backup & Restore of offline mode #617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -157,25 +157,36 @@ When using `<HOST_BACKUP_DIR>` instead of a volume, use `chmod` to set the permi | |||||||||||||
| ::: | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| If you need to delibrately run PDP with static offline data (e.g. in a CI environment), first generate the 2 backup files (configuration & policy store) by running your PDP in an online environment. Then you can run the PDP again in the offline environment - just make sure to use the same configuration and have those backup files in the directory/volume you mount onto `/app/backup`. | ||||||||||||||
| If you need to deliberately run PDP with static offline data (e.g. in a CI environment), first generate the 2 backup files (configuration & policy store) by running your PDP in an online environment. Then you can run the PDP again in the offline environment - just make sure to use the same configuration and have those backup files in the directory/volume you mount onto `/app/backup`. | ||||||||||||||
|
|
||||||||||||||
| ### How it works | ||||||||||||||
| PDP always starts in online mode, trying to fetch its configuration from Permit's cloud. | ||||||||||||||
| By default, PDP starts in online mode, trying to fetch its configuration from Permit's cloud. | ||||||||||||||
| In case of `PDP_CONFIG_FETCH_MAX_RETRIES` failed fetching attempts, and if `PDP_ENABLE_OFFLINE_MODE` is set to true - the PDP will switch to offline mode and load its configuration from the backup file (if it exists). | ||||||||||||||
| Once PDP is up and running (whether loaded from cloud or from local backup) - it won't try to fetch or load its configuration again from cloud until it's restarted. | ||||||||||||||
|
|
||||||||||||||
| If `PDP_OFFLINE_MODE_RESTORE_ONLY` is set to true and valid backup files are available, the PDP will start from the local backup and will not connect to Permit Cloud for configuration or policy updates. This effectively pins the PDP to the restored local snapshot until it is restarted without that flag. | ||||||||||||||
|
|
||||||||||||||
| For backing up the policy store's state (both policy rules/code & data), PDP internally uses [OPAL's offline mode](https://docs.opal.ac/getting-started/running-opal/run-opal-client/opa-runner-parameters/#policy-store-backup) | ||||||||||||||
| (no need to explicitly enable OPAL's offline mode, PDP would do it automatically). | ||||||||||||||
| OPAL uses policy and data from a backup file (if exists) to initialy load the policy store, but it never gives up on syncing with cloud - so once Permit cloud is reachable again, the most updated policy data could be fetched. | ||||||||||||||
| In the standard offline-mode flow, OPAL uses policy and data from a backup file (if it exists) to initially load the policy store, but it never gives up on syncing with cloud - so once Permit cloud is reachable again, the most updated policy data could be fetched. | ||||||||||||||
|
|
||||||||||||||
| Policy store's backup is done periodically (See "Advanced Configuration" below for customizing the interval), and also on a graceful shutdown of the PDP. This backup file is written to the same directory as the PDP configuration backup. | ||||||||||||||
|
|
||||||||||||||
| ### Backup and Restore Resiliency | ||||||||||||||
|
|
||||||||||||||
| For stronger resilience, it is recommended to back up the volume or host directory mounted to the path configured by `PDP_OFFLINE_MODE_BACKUP_DIR` (default: `/app/backup`) frequently. This gives you an additional recovery point if the local backup files become corrupted or if policy data is deleted accidentally, allowing you to restore the PDP locally while the corresponding state is being restored in the Permit control plane. | ||||||||||||||
|
||||||||||||||
| For stronger resilience, it is recommended to back up the volume or host directory mounted to the path configured by `PDP_OFFLINE_MODE_BACKUP_DIR` (default: `/app/backup`) frequently. This gives you an additional recovery point if the local backup files become corrupted or if policy data is deleted accidentally, allowing you to restore the PDP locally while the corresponding state is being restored in the Permit control plane. | |
| For stronger resilience, it is recommended to back up the volume or host directory that you mounted into the container at the path configured by `PDP_OFFLINE_MODE_BACKUP_DIR` (default: `/app/backup`) frequently. This gives you an additional recovery point if the local backup files become corrupted or if policy data is deleted accidentally, allowing you to restore the PDP locally while the corresponding state is being restored in the Permit control plane. |
Copilot
AI
Mar 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PDP_OFFLINE_MODE_BACKUP_DIR is described as a directory path of the configuration backup file, but this variable appears to represent the backup directory used for multiple backup files (and is a directory, not a file path). Please reword to reflect that it sets the backup directory for PDP offline-mode files.
| * `PDP_OFFLINE_MODE_BACKUP_DIR` Sets the directory path of the PDP's configuration backup file (default "/app/backup") | |
| * `PDP_OFFLINE_MODE_BACKUP_DIR` Sets the directory used to store PDP offline-mode backup files (default "/app/backup") |
Copilot
AI
Mar 24, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bullet formatting is inconsistent with the surrounding items: this entry adds a dash after the env var name and uses (default: false) while adjacent bullets omit the dash and use (default "..."). Please align formatting with the rest of this list for consistency.
| * `PDP_OFFLINE_MODE_RESTORE_ONLY` - If set to true and valid backup files exist, forces the PDP to use the local backup as the active snapshot and skip synchronization with Permit Cloud. Useful for point-in-time restores and controlled recovery scenarios. (default: false) | |
| * `PDP_CONFIG_FETCH_MAX_RETRIES` - Would determine after how many retries (to fetch cloud configuration) the PDP should switch to offline mode (default: 6) | |
| * `OPAL_STORE_BACKUP_INTERVAL` - Determines how often would the policy store backup be saved. (default: 1m) | |
| * `PDP_OFFLINE_MODE_RESTORE_ONLY` If set to true and valid backup files exist, forces the PDP to use the local backup as the active snapshot and skip synchronization with Permit Cloud. Useful for point-in-time restores and controlled recovery scenarios. (default "false") | |
| * `PDP_CONFIG_FETCH_MAX_RETRIES` Determines after how many retries (to fetch cloud configuration) the PDP should switch to offline mode (default "6") | |
| * `OPAL_STORE_BACKUP_INTERVAL` Determines how often the policy store backup is saved. (default "1m") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc uses inconsistent naming/capitalization for the same service ("Permit's cloud", "Permit Cloud", and "Permit cloud") within this section. Please standardize the term (and casing) to match the rest of the docs and keep it consistent within this page.