About

The plugin allows to backup the application code and data.

You can see an enabled plugin operation in Demo System.

Setup

Enable the plugin via server config.

backup:enable=1

# Setting to set up maximum number of backups stored
#backup:cleanup.candidate.count.more.than=3
# Setting to set up maximum number of backups with DB stored
#backup:cleanup.candidate.db.count.more.than=3

Scheduler

Configure a Scheduler task with class Backup to perform backups automatically. Example:

// PzdcDoc snippet of: 'Backup Scheduler Config Sample', lines: 1 - 10

# backup of app code only
scheduler.task.backup.class=Backup
scheduler.task.backup.hours=9,18
scheduler.task.backup.minutes=30

# full backup, including DB dump
scheduler.task.backupFull.class=Backup
scheduler.task.backupFull.db=1
scheduler.task.backupFull.hours=3
scheduler.task.backupFull.minutes=10

Setting up remote backup via SSH

All commands are executed by root.

Backup Server

On a backup host has to be generated a SSH key pair for user root:

ssh-keygen -t ed25519

The public key of the pair must be allowed to access for a created user backup:

useradd backup
mkdir -m 700 /home/backup/.ssh
mkdir -m 600 /home/backup/.ssh/authorized_keys
cat /root/.ssh/id_ed25519.pub >> /home/backup/.ssh/authorized_keys
chown -R backup:backup /home/backup/.ssh

Application Server

Assuming we are configuring backup for a BGERP instance running on server bgerp.org to backup server backup.bgerp.org.

The previously mentioned private key id_ed25519 for user root@backup.bgerp.org store to file /root/.ssh/backup on bgerp.org. Create the directory if missing:

mkdir -m 700 /root/.ssh

In the same directory place a config file with the following content:

Host backup.bgerp.org
    HostName backup.bgerp.org
    IdentityFile /root/.ssh/backup
Host *
    StrictHostKeyChecking no
    UserKnownHostsFile=/dev/null

Install package sshfs:

dnf install sshfs

Mount SSHFS using the command below:

sshfs -o allow_other backup@backup.bgerp.org:/home/backup/bgerp.org/opt/bgerp/backup /opt/bgerp/backup

Usage

Backup tool is available in Administration / Backup menu. There is content mode switch available.

backup
  • You can use drop-box to create backups with or without DB content.

  • Outdated backups can be removed using a button in the top-left corner of table. Number of backups preserved by the system is configured via configured.

  • Buttons in right table column allow restoring from backups. The application is automatically restarted after this operation.