Backup

Backing up Buddy On-Premises

When you perform a backup, the system creates a tar.gz archive with all repositories and databases of your Buddy On-Premises installation.

All backups are stored in the application directory, by default in ~/.buddy/app/backups. If you’re running out of space, you can move the directory to another location using Buddy CLI.

Every time you perform a backup, a new archive is created. The names of the archives are UNIX timestamps that record the date and time when a backup was created.

To perform a backup, follow these steps:

  1. Stop the app with this command:

    sudo buddy stop
    $
  2. Run this command to perform backup:

    sudo buddy backup
    $

    Use the sudo buddy --full backup command to include cached files in the backup. Depending on your setup, this can make the backup archive much bigger.

Configuring recurrent backups

On Linux and macOS you can use cron to perform automatic backups.

Windows users can get similar results using the Task Scheduler.

Follow these steps to create a cronjob that performs a backup of Buddy On-Premises once a day at 12.00 PM:

  1. Run crontab -e to open the cron table editor.
  2. Add this line that defines the job:

    0 0 * * * ~/.buddy/app/backups/backup.sh

    If you need help creating cron schedule expressions, check out this handy tool.

  3. Go to ~/.buddy/app/backups/ and create a backup.sh file.
  4. Add these lines to backup.sh:

    sudo buddy --yes stop
    sudo buddy --yes backup
    sudo buddy --yes start

Restoring application from a backup file

Follow these steps to restore Buddy On-Premises from a backup file:

  1. Stop the app with this command:

    sudo buddy stop
    $
  2. Run this command:

    buddy restore
    $
  3. Specify the path to the backup file. Alternatively, press enter to use the latest file from the default backup directory.

All backups are stored in the application directory, by default in ~/.buddy/app/backups. If you’re running out of space, you can move the directory to another location using Buddy CLI.

Moving Buddy On-Premises to another server

To relocate your On-Premises installation and data, follow these steps:

  1. Stop the application:

    sudo buddy stop
    $
  2. Perform a backup:

    sudo buddy backup
    $

    Use the sudo buddy --full backup command to include cached files in the backup. Depending on your setup, this can make the backup archive much bigger.

  3. Copy the created backup file to the target server. By default, backups are stored in ~/.buddy/app/backups.
  4. Install Buddy On-Premises on the target server using the backup file:

    curl -sSL https://get.buddy.works | sh && sudo buddy --backup={PATH_TO_BACKUP_FILE} install
    $