Skip to content

Backup and restore

📋 Introduction

Data required to fully backup and restore a R2Devops system are the following:

  • Configuration file: .env
  • Databases:
    • PostgreSQL database of Jobs service
    • PostgreSQL database of Kratos service
  • Files data:
    • Files stored in the Minio service
    • File storing data about certificate for Traefik service

All these data can be easily backup and restored using 2 scripts from the installation git repository:


💽 Backup

To backup the system, go to your installation git repository and run the following command:


The script will create a backups directory and create a backup archive inside it prefixed with the date (backup_r2-$DATE)

Regular backup

You can use a cron job to perform regular backups. Here is a cron job that launch a backup every day at 2am:

0 2 * * * /r2devops/
It can be added to your crontab with the command crontab -e. Check more information about cron jobs here.

🛳️ Restore

To restore a backup from scratch on a new system, follow this process:

  1. Be sure that your new system is compliant with requirements
  2. Copy the backup file on your new server
  3. Setup your environment
  4. Clone the installation repository
    git clone https://r2devops:${REPOSITORY_TOKEN} r2devops
    cd r2devops
  5. If the IP address of your server changed from your previous installation, update your DNS records. See section 2 of domain configuration
  6. Login to R2Devops registry
    echo $REGISTRY_TOKEN | docker login --username r2devops --password-stdin
  7. Launch the restore script
    ./ <path_to_your_backup_file>

Any errors during the restore process ?

Did you encounter a problem during the restore process ? See the troubleshooting section.

Last update: February 15, 2023