OpenProject installation on Ubuntu with Postgresql and Apache / Nginx
In this note, let's do a quick review on the installation of the very popular open source OpenProject software with Postgresql database and Apache/Nginx webservers. Open Project software has plenty of features, needed for managing the entire project life cycle and is offered with the Community Edition and Enterprise licenses.
The openproject installer for ubuntu configures mysql database and apache webserver by default. We will need to do little bit customization in order to use postgresql as the database for the repository and also check the basic configuration needed to get access to the web UI with either apache or the nginx webserver.
Configuration Info

Postgresql Setup
If you already have configured the postgresql database and users on your machine and ready for use with the openproject configuration, then you can skip this and go to the next step.
Install Postgresql
kiran@kiran-HPE$ sudo apt-get install postgresql
## Above command installs the latest version of postgresql
## To install specific version of postgresql, specify the version number as shown below
kiran@kiran-HPE$ sudo apt-get install postgresql-9.5
# check if the postgresql service is running
kiran@kiran-HPE:~$ sudo service postgresql status
[sudo] password for kiran:
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since Sat 2018-06-09 18:26:46 EDT; 21h ago
Main PID: 31796 (code=exited, status=0/SUCCESS)
CGroup: /system.slice/postgresql.service
kiran@kiran-HPE:~$ ps -ef|grep postgresql
postgres 31779 1 0 Jun09 ? 00:00:03 /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf
Create openproject database and user
kiran@kiran-HPE:~$ sudo -u postgres psql
psql (9.5.12)
Type "help" for help.
postgres=# create database openproject;
CREATE DATABASE
postgres=# create user openproject;
CREATE ROLE
postgres=# grant all privileges on database "openproject" to openproject;
GRANT
Test the Client Connectivity using the newly created openproject user. You may need to update pg_hba.conf file to add the entries for the open project user.
kiran@kiran-HPE:/etc/postgresql/9.5/main$ cat pg_hba.conf|grep openproject
local all openproject peer
kiran@kiran-HPE:/etc/postgresql/9.5/main$ sudo service postgresql stop
kiran@kiran-HPE:/etc/postgresql/9.5/main$ sudo service postgresql start
kiran@kiran-HPE:/etc/postgresql/9.5/main$ sudo -u openproject psql -d openproject
psql (9.5.12)
Type "help" for help.
openproject=> select current_user;
current_user
--------------
openproject
(1 row)
Download & Install the OpenProject Software
The information about adding the key and resource repositories for downloading the latest openproject software can be obtained from the openproject website.
https://www.openproject.org/download-and-installation/
wget -qO- https://dl.packager.io/srv/opf/openproject-ce/key | sudo apt-key add -
sudo apt-get install apt-transport-https
sudo wget -O /etc/apt/sources.list.d/openproject-ce.list \
> https://dl.packager.io/srv/opf/openproject-ce/stable/7/installer/ubuntu/16.04.repo
sudo apt-get update
sudo apt-get install openproject
kiran@kiran-HPE:~$ wget -qO- https://dl.packager.io/srv/opf/openproject-ce/key | sudo apt-key add -
OK
kiran@kiran-HPE:~$ sudo apt-get install apt-transport-https
Reading package lists... Done
Building dependency tree
Reading state information... Done
apt-transport-https is already the newest version (1.2.26).
0 upgraded, 0 newly installed, 0 to remove and 100 not upgraded.
kiran@kiran-HPE:~$ sudo wget -O /etc/apt/sources.list.d/openproject-ce.list > https://dl.packager.io/srv/opf/openproject-ce/stable/7/installer/ubuntu/16.04.repo
--2018-06-10 17:04:16-- https://dl.packager.io/srv/opf/openproject-ce/stable/7/installer/ubuntu/16.04.repo
Resolving dl.packager.io (dl.packager.io)... 52.205.131.8, 52.204.250.75
Connecting to dl.packager.io (dl.packager.io)|52.205.131.8|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/plain]
Saving to: ‘/etc/apt/sources.list.d/openproject-ce.list’
/etc/apt/sources.list.d/openproject-c [ <=> ] 126 --.-KB/s in 0s
2018-06-10 17:04:16 (7.51 MB/s) - ‘/etc/apt/sources.list.d/openproject-ce.list’ saved [126]
kiran@kiran-HPE:~$ sudo apt-get update
kiran@kiran-HPE:~$ sudo apt-get install openproject
kiran@kiran-HPE:~$ which openproject
/usr/bin/openproject
Parameter Configuration
After successfully installing the openproject software, let's do the customization needed for using postgresql as the repository database by setting the DATABASE_URL parameter
kiran@kiran-HPE:~$ sudo openproject config:set DATABASE_URL="postgresql://openproject:changeme@localhost/openproject"
You can check the values of various config parameters using the the config command
kiran@kiran-HPE:~$ sudo openproject config
APP_GROUP=openproject
APP_HOME=/opt/openproject
APP_NAME=openproject
APP_RUNNER_CLI=systemctl
APP_RUNNER_TYPE=systemd
APP_SAFE_NAME=openproject
APP_USER=openproject
APP_WIZARDS=legacy-installer,mysql,apache2,repositories,smtp,memcached,openproject
DATABASE_URL=postgresql://openproject:changeme@localhost/openproject
GEM_PATH=/opt/openproject/vendor/bundle/ruby/2.4.0:
HOME=/home/openproject
LANG=en_US.UTF-8
MEMORY_AVAILABLE=512
NODE_ENV=production
NODE_HOME=/opt/openproject/.heroku/node
OLDPWD=/
ORIGINAL_PWD=/home/kiran
PATH=/opt/openproject/bin:/opt/openproject/vendor/bundle/bin:/opt/openproject/vendor/bundle/ruby/2.4.0/bin:/opt/openproject/.heroku/node/bin:/opt/openproject/.heroku/yarn/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.:/usr/sbin:/opt/openproject/bin:/opt/openproject/node_modules/.bin
PORT=6000
PWD=/opt/openproject
RACK_ENV=production
RAILS_ENV=production
RAILS_LOG_TO_STDOUT=enabled
RAILS_SERVE_STATIC_FILES=enabled
ROOT_PATH=/
SECRET_KEY_BASE=6b36c52de8939919a1eeba7b1adff883baa4085b5dd3f63ff11b0fff927cc26ad470733ce7fc92d318a97275b58b8509676560cf18daeeb2f100276b4023836e
SHLVL=0
WEB_CONCURRENCY=1
WEB_MEMORY=512
Configure openproject
Now, launch the openproject configuration wizard and skip the mysql installation since we will be using the cusom parameter for the database configuration.
If everything goes well, we should be having a successful configuration as shown below.
kiran@kiran-HPE:~$ sudo openproject configure
.....................
↳ Creating demo project...
-Creating/Resetting Demo project
-Setting members.
-Creating timeline.
-Creating versions.
-Creating board
-CustomFieldSeeder
↳ Creating custom fields...
-WorkPackageSeeder
↳ Creating work_packages.......
-QuerySeeder
↳ Creating Queries.....
*** Loading action_cable_engine seed data
..............
*** Loading openproject_webhooks seed data
*** Loading openproject_github_integration seed data
Nothing to do.
Nothing to do.
Connect to postgresql and check if the database openproject contains the newly created tables.
kiran@kiran-HPE:~$ sudo -u openproject psql
[sudo] password for kiran:
psql (9.5.12)
Type "help" for help.
openproject=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-------------+----------+----------+-------------+-------------+--------------------------
openproject | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =Tc/postgres +
| | | | | postgres=CTc/postgres +
| | | | | openproject=CTc/postgres
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
openproject=> \d
List of relations
Schema | Name | Type | Owner
--------+------------------------------------------+----------+-------------
public | announcements | table | openproject
public | announcements_id_seq | sequence | openproject
public | ar_internal_metadata | table | openproject
public | attachable_journals | table | openproject
public | attachable_journals_id_seq | sequence | openproject
public | attachment_journals | table | openproject
public | attachment_journals_id_seq | sequence | openproject
public | attachments | table | openproject
public | attachments_id_seq | sequence | openproject
public | attribute_help_texts | table | openproject
:
Apache Configuration
The openproject installation wizard configures the openproject apache site by default. Here is the config file that we need to update if any customization is needed.
kiran@kiran-HPE:/etc/apache2/sites-enabled$ sudo cat /etc/apache2/sites-enabled/openproject.conf
Include /etc/openproject/addons/apache2/includes/server/*.conf
Listen 8770
<VirtualHost *:8770>
ServerName kiran-HPE
DocumentRoot /opt/openproject/public
ProxyRequests off
Include /etc/openproject/addons/apache2/includes/vhost/*.conf
# Can't use Location block since it would overshadow all the other proxypass directives on CentOS
ProxyPass / http://127.0.0.1:6000/ retry=0
ProxyPassReverse / http://127.0.0.1:6000/
</VirtualHost>
kiran@kiran-HPE:/etc/apache2/sites-enabled$ sudo service apache2 stop
kiran@kiran-HPE:/etc/apache2/sites-enabled$ sudo service apache2 start
Nginx configuration
If nginx is the preferred web server in your environment, you can create a new site configuration for openproject. Here is an example of the needed basic configuration.
kiran@kiran-HPE:~$ sudo cat /etc/nginx/sites-enabled/openproject
server {
listen 8787 default_server;
listen [::]:8787 default_server;
index index.html index.htm index.nginx-debian.html index.php;
server_name kiran-HPE;
root /opt/openproject/public;
location / {
autoindex on;
proxy_pass http://127.0.0.1:6000/;
}
}
kiran@kiran-HPE:/etc/nginx/sites-enabled$ sudo service nginx stop
kiran@kiran-HPE:/etc/nginx/sites-enabled$ sudo service nginx start
Congratulations! Your openproject website is up and running now! You can now access the web UI (http://<hostname>:<portno>) with the ports configured for the openproject website.