OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
use sudo so straight copy & paste always works
Markus Kahlf2afff90fa5b
diff --git a/docs/installation-and-operations/operation/restoring/README.md b/docs/installation-and-operations/operation/restoring/README.mdindex f2527a2e6b2..e5d96d3fc61 100644--- a/docs/installation-and-operations/operation/restoring/README.md+++ b/docs/installation-and-operations/operation/restoring/README.md@@ -13,7 +13,7 @@ Assuming you have a backup of all the OpenProject files at hand (see the [BackinAs a reference, we will assume you have the following dumps on your server, located in `/var/db/openproject/backup`:```bash-root@ip-10-0-0-228:/home/admin# ls -al /var/db/openproject/backup/+ubuntu@ip-10-0-0-228:/home/admin# sudo ls -al /var/db/openproject/backup/total 1680drwxr-xr-x 2 openproject openproject 4096 Nov 19 21:00 .drwxr-xr-x 6 openproject openproject 4096 Nov 19 21:00 ..@@ -43,20 +43,20 @@ cd /var/db/openproject/backupUntar the attachments to their destination:```bash-tar xzf attachments-20191119210038.tar.gz -C /var/db/openproject/files+sudo tar xzf attachments-20191119210038.tar.gz -C /var/db/openproject/files```Untar the configuration files to their destination:```bash-tar xzf conf-20191119210038.tar.gz -C /etc/openproject/conf.d/+sudo tar xzf conf-20191119210038.tar.gz -C /etc/openproject/conf.d/```Untar the repositories to their destination:```bash-tar xzf git-repositories-20191119210038.tar.gz -C /var/db/openproject/git-tar xzf svn-repositories-20191119210038.tar.gz -C /var/db/openproject/svn+sudo tar xzf git-repositories-20191119210038.tar.gz -C /var/db/openproject/git+sudo tar xzf svn-repositories-20191119210038.tar.gz -C /var/db/openproject/svn```### Restoring the database@@ -68,18 +68,40 @@ installation.First, ensure the connection details about your database is the one you want to restore```bash-openproject config:get DATABASE_URL+sudo 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. **WARNING:** The command `--clean --if-exists` is used and it will drop objects in the database and you will lose all changes in this database! Double-check that the database URL above is the database you want to restore to.-This is necessary since the backups of OpenProject does not clean statements to remove existing options and will lead to duplicate index errors when trying to restore to an existing database. The alternative is to drop/recreate the database manually, if you have the permissions to do so.+This is necessary since the backups of OpenProject does not clean statements to remove existing options and will lead to duplicate index errors when trying to restore to an existing database. The alternative is to drop/recreate the database manually (see below), if you have the permissions to do so.```bash-pg_restore --clean --if-exists --dbname $(openproject config:get DATABASE_URL) postgresql-dump-20200804094017.pgdump+sudo pg_restore --clean --if-exists --dbname $(openproject config:get DATABASE_URL) postgresql-dump-20200804094017.pgdump```+#### Troubleshooting++**Restore fails with something like 'Error while PROCESSING TOC [...] cannot drop constraint'**++In this case you will have to drop and re-create the database, and then import it again.+If you have access to the postgres user, it's simply a matter of starting the psql console like this:++```bash+sudo su - postgres -c psql+```++And once in there drop and re-create the database.+Ensure that the new database has the correct name and owner.+You can get these values from the `DATABASE_URL` as shown above.++```psql+DROP DATABASE openproject; CREATE DATABASE openproject OWNER openproject;+```++Once done you can exit the psql console by entering `\q`.+Now you can restore the database as seen above.+### Restart the OpenProject processesFinally, restart all your processes as follows: