Introduction
This page describes how Alexis Huxley installed OpenProject Community Edition. This is based on the official upgrade procedure, which, in turn, references large parts of the official installation procedure.
Procedure
- To allow concurrent operation of an existing production OpenProject server and the installation of a replacement OpenProject server, in the appropriate front-end webserver’s configuration, replace the simple proxying code:
ProxyPass / <production-server-url-including-trailing-slash> ProxyPassReverse / <production-server-url-including-trailing-slash>
with something like:
RewriteEngine on RewriteCond %{REMOTE_ADDR} !=<webmaster-client-ip> RewriteRule "^/(.*)" "<production-server-url-including-trailing-slash>$1" [P] ProxyPassReverse / <production-server-url-including-trailing-slash> RewriteEngine on RewriteCond %{REMOTE_ADDR} =<webmaster-client-ip> RewriteRule "^/(.*)" "<replacement-server-url-including-trailing-slash>$1" [P] ProxyPassReverse / <replacement-server-url-including-trailing-slash>
- Do the basic installation:
apt-get -y install apt-transport-https ca-certificates wget gpg wget -qO- https://dl.packager.io/srv/opf/openproject/key | gpg --dearmor > /etc/apt/trusted.gpg.d/packager-io.gpg wget -qO /etc/apt/sources.list.d/openproject.list https://dl.packager.io/srv/opf/openproject/stable/14/installer/debian/12.repo apt-get update apt-get -y install openproject mkdir /var/db/openproject/backup chown openproject:openproject /var/db/openproject/backup
- Install the database software:
apt -y install postgresql sleep 30 ss -tlpn
and verify that the postgres server is listening on port 5432.
- Dump data on the existing production OpenProject server as follows:
- To prevent tickets being created or changing state while the dump is in progress, stop the service:
systemctl stop openproject
- Make the dump:
openproject run backup
- Run the following command and verify you get similar output:
paccheri# ls -lrtc /var/db/openproject/backup ... -rw-r----- 1 openproject openproject 660598 Aug 5 16:10 postgresql-dump-20240805161020.pgdump -rw-r----- 1 openproject openproject 8991774 Aug 5 16:10 attachments-20240805161020.tar.gz -rw-r----- 1 openproject openproject 1127 Aug 5 16:10 conf-20240805.tar.gz paccheri#
(If OpenProject manages GIT or SVN repositories then there will be additional corresponding files present.)
- Additionally, backup the configuration files under /etc/openproject with:
tar cvzCf /etc/openproject /var/db/openproject/backup/etc-openproject-$(date +%Y%m%d%H%M%S).tar.gz .
(Note that the conf-*.tar.gz file created above contains only a subset of the files we’ve just tarred.)
- At this point the existing production OpenProject server could be restarted, but somehow blocking the creation of new tickets.
- To prevent tickets being created or changing state while the dump is in progress, stop the service:
- Copy the backup files over to the new machine as in this example:
farfalle# scp -3 paccheri:/var/db/openproject/backup/*20240805* piombi:/var/db/openproject/backup/ attachments-20240805161020.tar.gz 100% 8781KB 28.5MB/s 00:00 conf-20240805161020.tar.gz 100% 1127 601.6KB/s 00:00 etc-openproject-20240805161907.tar.gz 100% 2133 1.4MB/s 00:00 postgresql-dump-20240805161020.pgdump 100% 645KB 31.0MB/s 00:00 farfalle#
- Load the dump on the replacement OpenProject server as follows:
- Unpack the etc-openproject-*.tar.gz file by running something like:
tar xvzCf /etc/openproject /var/db/openproject/backup/etc-openproject-20240805*.tar.gz
- Retrieve information about the previously-used database:
openproject config:get DATABASE_URL
and note the database name, the database user and the database password.
- Create a database using the same credentials:
su - postgres psql -U postgres create user openproject with superuser createrole createdb replication bypassrls password '<the-password>'; create database openproject with owner openproject encoding 'UTF8' LC_COLLATE 'en_GB.UTF-8' LC_CTYPE 'en_GB.UTF-8'; \q exit
- Restore the database by running something like:
pg_restore --host=127.0.0.1 --username=openproject --dbname=openproject --clean \ /var/db/openproject/backup/postgresql-dump-20240805*.pgdump
(Expect a lot of errors about attempting to drop things that don’t exist.)
- Retrieve information about the location for attachments:
openproject config:get OPENPROJECT_ATTACHMENTS__STORAGE__PATH
- Restore the attachments by running something like:
mkdir -p /var/db/openproject/files chown openproject:openproject /var/db/openproject/files tar xvzCf /var/db/openproject/files /var/db/openproject/backup/attachments-20240805161020.tar.gz
- (In my configuration OpenProject does not manage GIT or SVN repositories so there are no further files to restore.)
- Unpack the etc-openproject-*.tar.gz file by running something like:
- Run:
openproject configure top
and wait for CPU consumption to return to normal levels.
- Go the the OpenProject installation’s URL.
For me this did not work correctly, redirecting me to the real pasta.net, until I had restored the original front-end web server configuration, but now pointing to the new server, as detailed below.
- Restore the original front-end web server configuration, but now pointing to the new server:
ProxyPass / <replacement-server-url-including-trailing-slash> ProxyPassReverse / <replacement-server-url-including-trailing-slash>
- Make any necessary changes to DNS.