How-to: Backup OpenProject App

How to backup the OpenProject App

Environment

In this setup:

  • OpenProject ist installed as UCS-App through our AppCenter
  • the OpenProject-Container-ID is a675d9703b37d209c763ad92781062c5069f638c2efa61e0d5f69c0cc11eedcb
  • the systems hostname is example
  • the backup-directory is /var/backup/

Important Notes

  • The backup process of the UCS installation of OpenProject differs from the official variant.
  • As of you need to stop OpenProject for that, you should do the backup outside the regular usage timeframe.

Backup process

As of OpenProject is installed as Docker-Container through our AppCenter, the corresponding files are stored at /var/lib/univention-appcenter/apps/openproject/:

root@example:~# ls -lah /var/lib/univention-appcenter/apps/openproject/
insgesamt 24K
drwxr-xr-x  4 root root 4,0K Feb  4 05:07 .
drwxr-xr-x 11 root root 4,0K Feb  4 05:06 ..
drwxr-xr-x  2 root root 4,0K Feb  4 05:06 conf
drwxr-xr-x  4 root root 4,0K Feb  4 05:29 data
-rw-------  1 root root   64 Feb  4 05:07 machine.secret
-r--------  1 root root 1,7K Feb  4 05:07 openproject.env

The SQL-Data is stored in the UCS-PostgreSQL-Database.
You can backup both, files and SQL-Data from your UCS-Host but to prevent data garbage, we recommend stopping the container before the backup.

Stop the Container:
root@example:~# docker stop $(ucr get appcenter/apps/openproject/container)
a675d9703b37d209c763ad92781062c5069f638c2efa61e0d5f69c0cc11eedcb
backup all files:
root@example:~# tar -cvf /var/backup/openproject_files.tar /var/lib/univention-appcenter/apps/openproject/
tar: Entferne führende „/“ von Elementnamen
/var/lib/univention-appcenter/apps/openproject/
/var/lib/univention-appcenter/apps/openproject/machine.secret
/var/lib/univention-appcenter/apps/openproject/conf/
/var/lib/univention-appcenter/apps/openproject/openproject.env
/var/lib/univention-appcenter/apps/openproject/data/
/var/lib/univention-appcenter/apps/openproject/data/openproject/
/var/lib/univention-appcenter/apps/openproject/data/openproject/svn/
/var/lib/univention-appcenter/apps/openproject/data/openproject/git/
/var/lib/univention-appcenter/apps/openproject/data/openproject/files/
/var/lib/univention-appcenter/apps/openproject/data/openproject/files/attachment/
/var/lib/univention-appcenter/apps/openproject/data/openproject/files/attachment/file/
/var/lib/univention-appcenter/apps/openproject/data/openproject/files/attachment/file/1/
/var/lib/univention-appcenter/apps/openproject/data/openproject/files/attachment/file/1/demo_project_teaser.png
/var/lib/univention-appcenter/apps/openproject/data/openproject/files/attachment/file/2/
/var/lib/univention-appcenter/apps/openproject/data/openproject/files/attachment/file/2/scrum_project_teaser.png
/var/lib/univention-appcenter/apps/openproject/data/listener/
create the SQL-Dump:
root@example:~# PGPASSWORD="$(cat /etc/postgres-openproject.secret)"  pg_dump -U openproject -h localhost -d openproject -c -x -O > /var/backup/openproject.sql
start the Container:
root@example:~# docker start $(ucr get appcenter/apps/openproject/container)
a675d9703b37d209c763ad92781062c5069f638c2efa61e0d5f69c0cc11eedcb
now you should have a full backup of openproject:
root@example:~# ls -lah /var/backup/
insgesamt 1,2M
drwxr-xr-x  2 root root 4,0K Feb 10 10:51 .
drwxr-xr-x 15 root root 4,0K Feb 10 10:49 ..
-rw-r--r--  1 root root 900K Feb 10 10:49 openproject_files.tar
-rw-r--r--  1 root root 315K Feb 10 10:51 openproject.sql
1 Like
Mastodon