Production server on Ubuntu

Deploying a production instance of Haplo can be a bit fiddly, so we have created a simple installation script that will install the correct system packages, configure them appropriately, download and build Haplo, and install it ready for use.

Pre-install planning

You should be running Ubuntu Server 20.04 or 18.04 LTS on a system with at least 4GB of memory. The system should be dedicated to Haplo, otherwise the security of your Haplo installation will be compromised.

You’ll probably want to install openssh to allow you to log in.

sudo apt-get install openssh-server

If creating user accounts, do not use haplo, as that will be created by the installation script and is used to run the application server.

You will need to register a name in DNS so that clients can connect to your server. This can either be the name of the server you’re going to install Haplo on, or an alias (CNAME). For example, if you want your Haplo installation to be available at the URL:

http://haplo.your.site.name/

then you need to create a DNS entry for haplo.your.site.name. This name will also be used in the installation script below.

Running the installation script

On the system where Haplo will be deployed, download the installation script

Make it executable:

chmod a+x haplo-install.sh

And run it, supplying the DNS name you chose above:

./haplo-install.sh haplo.your.site.name

You will be asked for your password so that sudo can modify the system on your behalf.

The script will perform most of the steps listed in the Build and run Haplo on Ubuntu Server documentation, create any necessary user accounts, create the directories needed by the server with the correct permissions and ownership, configure and start the PostgreSQL database server, and set up port forwarding. Having built Haplo, it will be deployed to /opt/haplo if this hasn’t already been done.

The script will then ask you for four pieces of information:

Enter the name for this site:
This is the name that will be displayed on all the pages of your Haplo installation. It should reflect the name of your department or organization, or the function of this Haplo installation.
Enter the name of the first user:
You need to create at least one user, so you will be asked for their details. This should be their full name, for example ‘Fred Bloggs’.
Enter the email of the first user:
And their email address, for example ‘fred.bloggs@example.com’.
Enter the password of the first user:
And then give a password for this user.

The installation script will then create a self-signed certificate, set up an application, and start the application server. You can then go to

http://haplo.your.site.name/

in your web browser and log in using the email address and password details you just entered. (You will get a security warning from your web browser due to the use of a self-signed certificate.)