This website uses cookies to ensure you get the best experience on our website More Information

SCHEDULE A PERSONAL DEMO with us and learn how to improve project collaboration with OpenProject.

Backup your OpenProject installation

Note: this guide only applies if you've installed OpenProject using our DEB/RPM packages.

We advise to backup your OpenProject installation regularly — especially before upgrading to a newer version.

What should be backed up

In general the following parts of your OpenProject installation should be backed up:

  • Data stored in the database
  • Configuration files
  • Uploaded files (attachments)
  • Repositories (typically subversion) if applicable

How to backup

The DEB/RPM packages provide a backup tool which can be used to take a snaphsot of the current OpenProject installation. This tool will create a backup of all parts mentioned above. The backup tool is used by executing the following command:

sudo openproject run backup

The command will create backup files in the following location on your system

/var/db/openproject/backup

The content of that directory should look very similar to the following (depending on your used database, you will see either a mysql-dump-<date>.sql.gz or a postgresql-dump-<pgdump> file).

root@test-packager-backup:/opt/openproject# ls -l /var/db/openproject/backup/
total 24
-rw-r----- 1 openproject openproject  117 Apr  8 09:55 attachments-20150408095521.tar.gz
-rw-r----- 1 openproject openproject  667 Apr  8 09:55 conf-20150408095521.tar.gz
-rw-r----- 1 openproject openproject 8298 Apr  8 09:55 mysql-dump-20150408095521.sql.gz
-rw-r----- 1 openproject openproject  116 Apr  8 09:55 svn-repositories-20150408095521.tar.gz

How to restore

The backup created with the tool consists of four parts which are all compressed using gzip. Except the database dump these parts can be restored by decompressing the *.tar.gz files and copy the content to the proper location. The command to untar and unzip the *.tar.gz files looks like this (using sample file names from above):

tar vxfz attachments-20150408095521.tar.gz

Database

The <dbuser>, <dbhost> and <dbname> variables have to be replaced with the values that are container in the DATABASE_URL setting of your installation. This setting can be seen by running:

openproject config:get DATABASE_URL
#=> e.g.: mysql2://dbusername:dbpassword@dbhost:dbport/dbname

PostgreSQL

To restore the PostgreSQL dump please use the pg_restore command utilities.

pg_restore -h <dbhost> -u <dbuser> -W <dbname>

First the dump has to be extracted (unzipped) and then restored. The command used should look very similar to this:

MySQL

To restore the MySQL dump it is recommended to use the mysql command line client.

First the dump has to be extracted (unzipped) and then restored. The command used should look very similar to this:

zcat mysql-dump-20150408095521.sql.gz | mysql -u <dbuser> -h <dbhost> -p <dbname>

 

Note:

You can find the master document in GitHub. You can propose a change to this guide by creating a pull request on GitHub.

Go to GitHub