added missing sudo; made untar statements context free

pull/9089/head
Markus Kahl 4 years ago
parent f2afff90fa
commit 8790fb4a50
  1. 18
      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 [Backin
As a reference, we will assume you have the following dumps on your server, located in `/var/db/openproject/backup`:
```bash
ubuntu@ip-10-0-0-228:/home/admin# sudo ls -al /var/db/openproject/backup/
ubuntu@ip-10-0-0-228:/home/ubuntu# sudo 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 ..
@ -34,29 +34,23 @@ sudo service openproject stop
### Restoring assets
Go into the backup directory:
```bash
cd /var/db/openproject/backup
```
Untar the attachments to their destination:
```bash
sudo tar xzf attachments-20191119210038.tar.gz -C /var/db/openproject/files
sudo tar xzf /var/db/openproject/backup/attachments-20191119210038.tar.gz -C /var/db/openproject/files
```
Untar the configuration files to their destination:
```bash
sudo tar xzf conf-20191119210038.tar.gz -C /etc/openproject/conf.d/
sudo tar xzf /var/db/openproject/backup/conf-20191119210038.tar.gz -C /etc/openproject/conf.d/
```
Untar the repositories to their destination:
```bash
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
sudo tar xzf /var/db/openproject/backup/git-repositories-20191119210038.tar.gz -C /var/db/openproject/git
sudo tar xzf /var/db/openproject/backup/svn-repositories-20191119210038.tar.gz -C /var/db/openproject/svn
```
### Restoring the database
@ -77,7 +71,7 @@ Then, to restore the PostgreSQL dump please use the `pg_restore` command utility
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
sudo pg_restore --clean --if-exists --dbname $(openproject config:get DATABASE_URL) postgresql-dump-20200804094017.pgdump
sudo pg_restore --clean --if-exists --dbname $(sudo openproject config:get DATABASE_URL) postgresql-dump-20200804094017.pgdump
```
#### Troubleshooting

Loading…
Cancel
Save