Kamis, 21 Januari 2021

OPENPROJECT-restore

root@ubuntu:~# su - postgres
postgres@ubuntu:~$ ls
10  logfile  openproject.sql  postgresql-dump-20210121064442.pgdump
postgres@ubuntu:~$ psql openproject < openproject.sql

 

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.

First, ensure the connection details about your database is the one you want to restore

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.

pg_restore --clean --if-exists --dbname $(openproject config:get DATABASE_URL) postgresql-dump-20200804094017.pgdump

Restart the OpenProject processes

Finally, restart all your processes as follows:

sudo service openproject restart

Docker-based installation

For Docker-based installations, assuming you have a backup as per the procedure described in the Backing up guide, you simply need to restore files into the correct folders (when using the all-in-one container), or restore the docker volumes (when using the Compose file), then start OpenProject using the normal docker or docker-compose command.

Restoring a dump

I get this show error message:
Internal error An error occurred on the page you were trying to access. If you continue to experience problems please contact your OpenProject administrator for assistance. If you are the OpenProject administrator, check your log files for details about the error.

Then, simply run openproject configure, otherwise, use RAILS_ENV=production bundle exec rails db:migrate

Tidak ada komentar:

Posting Komentar