Setting Up OpenProject on a New Server and Restoring Backups

Tags
Linux Git Bash

OpenProject can be challenging to set up. The setup and restore process is a bit more hands on than most Self-Hosted Software Solutions. This guide is to help my future self set up OpenProject on a new server and restore data from a backup.

Install OpenProject

On a fresh install of Ubuntu 22.02 LTS:

  1. sudo apt-get update
  2. sudo apt-get install apt-transport-https ca-certificates wget
  3. sudo wget -O /etc/apt/trusted.gpg.d/openproject.asc https://dl.packager.io/srv/opf/openproject/key
  4. sudo wget -O /etc/apt/sources.list.d/openproject.list https://dl.packager.io/srv/opf/openproject/stable/15/installer/ubuntu/22.04.repo
  5. sudo apt-get update
  6. sudo apt-get install openproject
  7. sudo openproject configure
  8. Run through the installation wizard. This will setup the database.
  9. Get the Postgres Database Connection String.
    1. sudo openproject config:get DATABASE_URL
      This will output the database connection string which looks something like:
      postgres://openproject:password@127.0.0.1:45432/openproject

Import the Files, Configuration, and Git Repository

  1. Copy all files from the backup directory into the new system. (Attachments, Configuration, Git Repository and Database)
  2. sudo service openproject stop
  3. sudo tar xzf attachments-20250306021211.tar.gz -C /var/db/openproject/files
  4. sudo tar xzf conf-20250306021211.tar.gz -C /etc/openproject
  5. sudo tar xzf git-repositories-20250306021211.tar.gz -C /var/db/openproject/git

Edit The Configuration To Use the New Database Connection String

  1. nano /etc/openproject/conf.d/00_addon_postgres
    1. Edit this file to use the New Database Connection String from the previous step.

Drop the Database

  1. sudo su - postgres -c psql
  2. Run the following query:
    1. DROP DATABASE openproject; CREATE DATABASE openproject OWNER openproject;
    2. To exit postgres, enter \q and press enter.

Import the Database

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

Install Certbot

  1. sudo snap install core; sudo snap refresh core
  2. sudo snap install --classic certbot
  3. sudo certbot certonly --apache
  4. Run through the wizard to install the certificate.

Configure OpenProject

  1. sudo openproject configure
  2. sudo service openproject start

This should be all that is required.

Troubleshooting

If for whatever reason Certbot can't set up the certificate and OpenProject won't start perform the following actions

  1. nano /etc/openproject/installer.dat
    1. Change server/ssl yes to server/ssl no
  2. sudo openproject configure
  3. sudo certbot certonly --apache
  4. nano /etc/openproject/installer.dat
    1. Change server/ssl no to server/ssl yes
  5. sudo openproject configure