Backup

Backing up Buddy Self-Hosted

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

Success
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.
Warning
All commands listed in the article must be run as root.

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:

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

    buddy backup$
    Hint
    Use the 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.

Tip
Windows users can get similar results using the Task Scheduler.

Follow these steps to create a cronjob that performs a backup of Buddy self-hosted 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
    Tip
    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:

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

Restoring the application from a backup file

Follow these steps to restore Buddy self-hosted from a backup file:

  1. Stop the app with this command:

    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.

Success
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 Self-Hosted to another server

To relocate your self-hosted installation and data, follow these steps:

  1. Stop the application:

    buddy stop$
  2. Perform a backup:

    buddy backup$
    Hint
    Use the 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 self-hosted on the target server using the backup file:

    curl -sSL https://get.buddy.works | sh && buddy --backup={PATH_TO_BACKUP_FILE} install$
Last update:
Sep 24, 2024