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 Said that, in order for all related file system operations to be successful, only SSH access to remote server is sufficient.

Client PC has to have sshfs client installed:

apt install sshfs

Create a mount directory:

mkdir /mnt/backup

Mount SSHFS using the command below:

sshfs [user@]host:[dir] mountpoint [options]

Example:

sshfs root@backup.bgerp.org:/opt/BGERP/backup /mnt/backup

Use the following command to display remote filesystem mount point:

df -hT

Now you can use this directory to exchange files with remote server. If there is a need for other users to access this directory, use allow_other option. Option will be operational only if /etc/fuse.conf also has user_allow_other option.

Mounting SSHFS with allow_other option:

sshfs -o allow_other root@backup.bgerp.org:/opt/BGERP/backup /mnt/backup

Unmount a file system:

umount /mnt/backup

Automatic SSHFS mount

First, create SSH-keypair, where one key will be private (id_rsa) and another one - public (id_rsa.pub)

ssh-keygen

In order to copy public key into a remote server (to authorize SSH client), use the following command:

ssh-copy-id -i ~/.ssh/id_dsa.pub root@backup.bgerp.org

Use the following command to test SSH connection to remote server using a private SSH key you’ve created earlier:

ssh root@backup.bgerp.org
When using Windows, you an use PuTTY or KiTTY to generate SSH keys.

After configuring authorization on remote server (see above), you can start mounting remote file system into your local folder using the following command:

sshfs root@backup.bgerp.org:/opt/bgerp/backup /mnt/backup -o allow_other,default_permissions,IdentityFile=~/.ssh/id_rsa

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.