https://github.com/sevensource/magnolia-module-simple-backup
Magnolia CMS module adding backup and restore functionality
https://github.com/sevensource/magnolia-module-simple-backup
backup magnolia magnolia-cms restore
Last synced: about 1 year ago
JSON representation
Magnolia CMS module adding backup and restore functionality
- Host: GitHub
- URL: https://github.com/sevensource/magnolia-module-simple-backup
- Owner: sevensource
- License: gpl-3.0
- Created: 2020-02-01T20:23:44.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-18T19:12:13.000Z (about 6 years ago)
- Last Synced: 2024-04-16T10:59:09.267Z (about 2 years ago)
- Topics: backup, magnolia, magnolia-cms, restore
- Language: Java
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Magnolia module SimpleBackup
[](https://github.com/sevensource/magnolia-module-simple-backup/tags)
[](http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.sevensource.magnolia%22%20AND%20a%3A%22magnolia-module-simple-backup%22)
[](https://github.com/sevensource/magnolia-module-simple-backup/blob/master/LICENSE)
## [Magnolia CMS](http://www.magnolia-cms.com) module adding backup and restore functionality
### Demo
See [simple-backup-demo-module](simple-backup-demo-module) and [simple-backup-demo-scripts](simple-backup-demo-scripts) for a fully functional demo.
### Installation
The module is available on [Maven central](https://search.maven.org/artifact/org.sevensource.magnolia/magnolia-module-simple-backup) - add it to your war file:
```xml
org.sevensource.magnolia
magnolia-module-simple-backup
${magnolia-module-simple-backup.version}
```
### Configuration
- Module configuration is done in Magnolias config workspace in `/modules/simplebackup/config`
- add a backup job definition beneith `/modules/simplebackup/config/configurations`:
```yml
example:
backupPath: "/var/mgnl-backup" # base path where backups are stored
enabled: true # will only be executed if set to true
name: example # name of the job
workspaces: # a list of workspaces to backup
website:
workspace: website # name of the workspace
path: / # root path within the workspace to backup
split: true # if true, a new file will be written for every subfolder
config:
workspace: config
path: /
split: false
```
### Execution
Backup and Restore is triggered via [Magnolia Commands](https://documentation.magnolia-cms.com/display/DOCS/Commands)
Available commands:
| Catalog | Command | Parameters | Description |
| ------------- | ------------- | ------------- | ------------- |
| simplebackup | backup | configuration => _name of configured backup job_ | Triggers the execution of a backup job with the name specified in _configuration_ |
| simplebackup | restore | path => _path to the directory that contains the backup files_ | Triggers the execution of a restore |
| simplebackup | garbage-collection | _none_ | Triggers the execution of a JackRabbit Repository Garbage Collection |
#### Executing backups from Java/Groovy
```groovy
map = new java.util.HashMap()
map.put("configuration", "example") // name of the backup job created above
map.put("backup-subdirectory", "nightly") // optional parameter, if omitted a timestamp will be used
cm = info.magnolia.commands.CommandsManager.getInstance()
cm.executeCommand('simplebackup','backup',map)
```
#### Executing restores from Java/Groovy
```groovy
map = new java.util.HashMap()
map.put("path", "/var/magnolia-backups/author/2020-01-25T120000") // path to the directory in which the backup files are stored
cm = info.magnolia.commands.CommandsManager.getInstance()
cm.executeCommand('simplebackup','restore',map)
```
#### Executing garbage collections from Java/Groovy
```groovy
cm = info.magnolia.commands.CommandsManager.getInstance()
cm.executeCommand('simplebackup','garbage-collection', null)
```
#### via Magnolia's scheduler
Using [Magnolia Scheduler Module](https://documentation.magnolia-cms.com/display/DOCS/Scheduler+module), regular
backups can be executed - see [Commands-Scheduling](https://documentation.magnolia-cms.com/display/DOCS/Commands#Commands-Scheduling)
for details.
#### via REST services
Using [Magnolia Rest Module](https://documentation.magnolia-cms.com/display/DOCS/REST+module) backups can be initiated
via the REST API:
- enable the backup command in
`/modules/rest-services/rest-endpoints/commands/enabledCommands`:
_config.modules.rest-services.rest-endpoints.commands.enabledCommands.backup.yaml_
```yml
backup:
catalogName: simplebackup
commandName: backup
access:
roles:
rest: rest-editor
```