Skip to main content

Backup and Restore

Database Backup

  1. Manual backup from GUI

    Login to OneDev as administrator, navigate to menu Administration / Database Backup, and click the button Backup Now

  2. Manual backup from command prompt

    Open a terminal to the machine running OneDev server, change to OneDev installation directory and run below command:

    bin/backup-db.(sh|bat) /path/to/backup.zip
    note
    • If OneDev is running inside container or deployed into Kubernetes, you will need to open the terminal to the container, and OneDev installation directory is /opt/onedev inside the container
    • If multiple servers connect to form a cluster, backup can be taken from any server
  3. Schedule auto-backup

    Login to OneDev as administrator, navigate to menu Administration / Database Backup, and enable auto backup. Note that if you are running a cluster, the scheduled backup will be stored on lead server

Database Restore

To restore database from an existing backup file, open a terminal to the machine running OneDev server, change to OneDev installation directory and run below command:

bin/restore-db.(sh|bat) /path/to/backup.zip
note
  • If OneDev is running inside container or deployed into Kubernetes, you will need to open the terminal to the container, and OneDev installation directory is /opt/onedev inside the container
  • If multiple servers connect to form a cluster, you may run restore from any server

Repository Backup

The sub directory site under OneDev' installation directory contains git repositories, attachments and other important data. It should be backed up periodically. You may use some volume backup tools or file sync tools for this purpose

tip

If OneDev is running inside container or deployed into Kubernetes, you may simply backup the data volume used by OneDev container