OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/help/installation-and-operations/operation/restoring
Oliver Günther fb9a3082d3
Move help into separate folder per article
5 years ago
..
README.md Move help into separate folder per article 5 years ago

README.md

sidebar_navigation
[{title Restoring} {priority 8}]

Restoring an OpenProject backup

Package-based installation (DEB/RPM)

Assuming you have a backup of all the OpenProject files at hand (see the Backing up guide), here is how you would restore your OpenProject installation from that backup.

As a reference, we will assume you have the following dumps on your server, located in /var/db/openproject/backup:

root@ip-10-0-0-228:/home/admin# ls -al /var/db/openproject/backup/
total 1680
drwxr-xr-x 2 openproject openproject    4096 Nov 19 21:00 .
drwxr-xr-x 6 openproject openproject    4096 Nov 19 21:00 ..
-rw-r----- 1 openproject openproject 1361994 Nov 19 21:00 attachments-20191119210038.tar.gz
-rw-r----- 1 openproject openproject    1060 Nov 19 21:00 conf-20191119210038.tar.gz
-rw-r----- 1 openproject openproject     126 Nov 19 21:00 git-repositories-20191119210038.tar.gz
-rw-r----- 1 openproject openproject  332170 Nov 19 21:00 postgresql-dump-20191119210038.pgdump
-rw-r----- 1 openproject openproject     112 Nov 19 21:00 svn-repositories-20191119210038.tar.gz

Stop the processes

First, it is a good idea to stop the OpenProject instance:

sudo service openproject stop

Restoring assets

Go into the backup directory:

cd /var/db/openproject/backup

Untar the attachments to their destination:

tar xzf attachments-20191119210038.tar.gz -C /var/db/openproject/files

Untar the configuration files to their destination:

tar xzf conf-20191119210038.tar.gz -C /etc/openproject/conf.d/

Untar the repositories to their destination:

tar xzf git-repositories-20191119210038.tar.gz -C /var/db/openproject/git
tar xzf svn-repositories-20191119210038.tar.gz -C /var/db/openproject/svn

Restoring the database

Note: in this section, the <dbusername>, <dbhost> and <dbname> variables that appear below have to be replaced with the values that are contained in the DATABASE_URL setting of your installation. This setting can be seen by running:

First, get the necessary details about your database:

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

Then, to restore the PostgreSQL dump please use the pg_restore command utility:

pg_restore -h <dbhost> -p <dbport> -U <dbusername> -d <dbname> postgresql-dump-20191119210038.pgdump

Example:

$ openproject config:get DATABASE_URL
postgres://openproject:L0BuQvlagjmxdOl6785kqwsKnfCEx1dv@127.0.0.1:45432/openproject

$ pg_restore -h 127.0.0.1 -p 45432 -U openproject -d openproject postgresql-dump-20191119210038.pgdump

Restart the OpenProject processes

Finally, restart all your processes as follows:

sudo service openproject restart

Docker-based installation

Assuming you have a backup as per the procedure described in the Backing up guide, if at any point you want to restore from a backup, just put your backup back in /var/lib/openproject on your local host, and re-launch the docker container with the recommended options.

For instance, assuming your backup was stored on S3:

aws s3 cp --recursive s3://my-backup-bucket/openproject-backups/ /var/lib/openproject/

docker run -d -p 8080:80 --name openproject -e SECRET_KEY_BASE=secret \
  -v /var/lib/openproject/pgdata:/var/lib/postgresql/9.6/main \
  -v /var/lib/openproject/logs:/var/log/supervisor \
  -v /var/lib/openproject/static:/var/db/openproject \
  openproject/community:10