Backup Extended module
Edition |
Incubator (services) |
||
Issues |
|||
Git |
|||
Latest |
1.0.1
|
The Backup Extended module uses Tasks to manage backups. Both immediate and scheduled backup are possible. It provides an app for managing backups. Group configuration for scheduled backups. Allows for multiple target configurations in a light module. Backup from any database type to any other database type directly.
This module is at the INCUBATOR level.
|
Installing with Maven
Maven is the easiest way to install the module. Add the following to your bundle:
<dependency>
<groupId>info.magnolia.backup</groupId>
<artifactId>magnolia-module-backup-extended</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>info.magnolia.backup</groupId>
<artifactId>magnolia-module-backup-extended-ui</artifactId>
<version>1.0.1</version>
</dependency>
Usage
The module has two options for creating backups. Backup now and Schedule backup. Ultimately they end up calling the same action as all backups end up as scheduled backups. The difference with Backup now is an addition of a slight, configurable, delay before executing begins.
Create Backup
The module has two options for creating backups. Backup now and Schedule backup. Ultimately they end up calling the same action as all backups end up as scheduled backups. The difference with Backup now is an addition of a slight, configurable, delay before executing begins.
Initiate a backup on demand using the Backup now action. None of the fields are required. The default backup will produce a copy of the current instance’s magnolia
repository in the /${magnolia.home}/backups
directory using H2 database. The groups to be notified can be selected on the second tab. All selected groups will be able
to see the backup data from the Pulse. Only members of the backup group can abort
backups from the Pulse.
When saving the dialog the backup is started with a slight delay (10 secs). You can still abort the task from the Pulse before the expiration of the delay. |
Same fields as Backup now with an additional field for a future date time and the option to set a frequency. With a frequency the scheduled backup will automatically schedule the next backup as part of the job.
Create public backup
Each dialog allows for the option to initiate a public instance backup from author. Typically backing up a single public instance is enough but it’s possible to add more options to the dialogs.
In your light module create a rest client which calls backupx. Be sure the backup extended core module has been installed on the target instance.
baseUrl: http://localhost:8080/magnoliaPublic
securitySchemes:
basic:
$type: basic
username: superuser
password: superuser
restCalls:
backupx:
headers:
Content-Type: application/json; charset=UTF-8
method: post
entityClass: com.fasterxml.jackson.databind.JsonNode
path: /.rest/commands/v2/backup/backupx
securityScheme: basic
The name of the rest client should be synchronized with the value of the radio button on the dialog. Decorate the backup extended dialogs to add more options.
Backup Tasks app
Tasks are used to schedule the backups. First a task is created to hold all the parameters of the backup. The end result of the backup (successful or failed) will be recorded to the task. All metadata is visible through the detail subapp including the content (the parameters submitted) and the results of execution.
Groups
The module installs a new backup group for Backup Admins. The backup group is added to the superuser by default upon installation. Users in this group can access the Backup Tasks app and see the scheduled backups in the Pulse. They can abort scheduled backups from the Pulse.
Backupx Command
The backup extended command is used to trigger backups without the need of the UI. The command can execute on events such as workflow steps or rest calls. The backupx command is located within the backup catalog.
Properties:
Parameter | Description |
---|---|
|
optional, The file system directory where the backup can place files. If no directory is supplied the magnolia home directory is used. |
|
optional, default The repository configuration file for the backup. This can be a file in a light module or a file reachable through an http address. The default is an H2 backup since this typically produces the quickest backups. |
|
optional, default A comment regarding the backup, such as, why and/or how it was created. |
|
optional, default The repository to be backed up. Typically this is the magnolia repository but backups could be made more efficient by splitting the repository into content and configuration repositories. With separate repositories they can be backed up separately at different rates and/or times. |
|
optional, default The delay is used when a backupDate is not supplied. Simply adds a slight delay before the backup executes. All backups end up as scheduled tasks. |
|
optional, default backup group A list of group Ids which can see and/or administer the backup from the pulse. In some cases users in these groups could abort the scheduled backup. |
|
optional, default current time ( A concrete date and time to initiate the backup. |
REST based backup
By default the module will make the backupx command available within the rest-services module. Backups can be created via REST for a variety of reasons.
Example cURL calls:
curl http://localhost:8080/magnoliaAuthor/.rest/commands/v2/backup/backupx \
-H "Content-Type: application/json" \
-X POST --user superuser:superuser
curl http://localhost:8080/magnoliaPublic/.rest/commands/v2/backup/backupx \
-H "Content-Type: application/json" \
-X POST --user superuser:superuser \
--data \
'{
"comment": "Backed up via REST",
"directory": "/opt/backups/todaysDate",
"targetConfig": "/backup-extended/target-confs/jackrabbit-bundle-derby-disabled-search.xml",
"backupDate": "2021-08-13 21:53:00.000"
}'
curl http://localhost:8080/magnoliaAuthor/.rest/commands/v2/backup/backupx \
-H "Content-Type: application/json" \
-X POST --user superuser:superuser \
--data \
'{
"comment": "Backed up via REST",
"directory": "/opt/backups/todaysDate",
"targetConfig": "http://localhost:8080/magnoliaAuthorBackup/docroot/jackrabbit-bundle-h2-search.xml",
"backupDate": "2021-08-13 21:53:00.000"
}'
Autoscaling
Multiple target configurations are possible with this module. Any reachable resource can potentially become a configuration for a target instance. Supply the configuration files in a light module. It would only be practical in the most optimized of deployments with small to medium size repositories.
Change database types
Using this module you can migrate from one database type to another. For example, go from MySQL to PostgreSQL or vice versa. Install the module into the current system and create a target configuration for the desired system.
Troubleshooting
Logging levels
Increase logging levels to see finer detail:
<Logger name="info.magnolia.module.backup" level="ALL"/>
<Logger name="info.magnolia.task.schedule" level="ALL"/>
Common error codes
Here you can find some common problems that you might encounter while using the module.
Message | Example |
---|---|
Failed to copy content |
Solution: See MGNLDAM-970
Solution: See See Too Many Open Files. |
Configuration file could not be read |
Solution: Most likely the configuration file couldn’t be copied due to a permissions issue. |
Configuration file syntax error |
Solution: The configuration file is not well formed. The error log should point directly to the issue. Typically a parsing issue. |
Could not load JDBC driver |
Solution: You must install the driver for the target instance. When using multiple database types don’t forget any extra drivers required by the config files. |
Changelog
Version | Notes |
---|---|
|
|
|
Updated to use the resource linker provided OOTB |
|
|
|
Decouple the ui from the core functionality |
|
|
|
|
Initial release of the extensions version of the module. |