Knowledge base

1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!

Back up a web hosting with Restic on Swiss Backup (Swift)

Update 08/25/2026

This guide details how to back up data from your web hosting accounts (Starter, shared, or Cloud Server) using the restic application via the OpenStack Swift protocol on Swiss Backup, the backup solution in an independent Swiss cloud.

 

Introduction

  • Other solutions exist for backing up your web data: learn more in this other guide.

 

Install Restic

Prerequisites

To do this:

  1. Download the linux_amd64 binary from the restic GitHub repository:

    wget -O restic.bz2 {{URL_8}}

    ⚠️ The download link may change when a new version is released; version 0.14 uses default compression.

  2. Unzip the archive and make the binary executable:

    bunzip2 restic.bz2
    chmod +x restic

 

Configure Restic

Creating an encryption key to encrypt data

  • The key cannot be changed, and if lost, the data will no longer be readable.
  • Place this key in a file that can be read by Restic.
  • Example of key generation:

    openssl rand -base64 16 > restickey	

Restic configuration

To configure the backup:

  1. Create a resticconfig file with the following content, adapting it according to the information specific to your device:

    echo "export OS_AUTH_URL={{URL_10}}
    export OS_REGION_NAME=RegionOne
    export OS_PROJECT_NAME=sb_project_SBI-XXXX
    export OS_PASSWORD=''
    export OS_USER_DOMAIN_NAME=default
    export OS_USERNAME=SBI-XXXX
    export OS_PROJECT_DOMAIN_NAME=default
    export RESTIC_REPOSITORY=swift:sb_project_SBI-XXXX:/bucket name
    export RESTIC_PASSWORD_FILE=restickey" > resticconf
    • OS_AUTH_URL URL for accessing the Swiss Backup cluster (1)
    • OS_PROJECT_NAME and OS_USERNAME: replace SBI-XXXX with your ID
    • OS_PASSWORD: replace with the password generated during activation
    • RESTIC_REPOSITORY
      1. replace SBI-XXXX with your ID
      2. replace the bucket name with the name you want to give to your container that stores the backups
    • RESTIC_PASSWORD_FILE: replace with the full path to the file containing the encryption key
  2. Load the Restic configuration by running the following command:

    source resticconf	
  3. Initialize the bucket with the following command:

    ./restic -r $RESTIC_REPOSITORY init	

(1) The indication "//swiss-backup02", "//swiss-backup03", etc. changes depending on the cluster number indicated in the Manager under Cloud storage information in the "Location" section; and if your Swiss Backup device was created before October 2020, you will need to use https://swiss-backup.infomaniak.com/identity/v3.

 

Back up your files

To back up your files, simply run the following command:

./restic backup
#Example: Backing up the entire hosting account
./restic backup ./
#Example: Backing up the “sites” folder
./restic backup sites/

The first snapshot takes a long time (several hours, depending on the amount of data) because all files are copied, while subsequent snapshots will use a differential approach.

 

Backing up databases

Restic can read data from stdin, allowing you to save the output of a program.

Use the following command to back up an individual MySQL database:

mysqldump --databases db_name -u db_username -p | restic backup --stdin --stdin-filename database_dump.sql	

To back up all databases, run the mysqldump command to extract all databases from the server, then redirect the output to Restic:

mysqldump -u  -p --all-databases | restic backup --stdin --stdin-filename all_databases.sql	

 

List backups

To list your backups, you can use the following command:

./restic snapshots	

 

Restore a backup

You can restore a backup using the following command:

./restic restore  --target 	

 

Automate

On Cloud Server, it is possible to add a cron job to automate the backup process.

This option is not available on shared hosting.


Has this FAQ been helpful?