Development and Deployment of Heliport


This guide explains how to set up HELIPORT for development as well as how to deploy a demo instance of HELIPORT with limited functionality.

Prequisites

In this tutorial a fresh minimal installation of Ubuntu 20.04.3 is used.

Regardless if you want to develop HELIPORT or deploy it, you will need to install some dependencies of python-ldap as well as the tool Poetry:

sudo apt-get install python3-pip libsasl2-dev libldap2-dev libssl-dev libpq-dev
pip3 install --user poetry

If pip gives you a warning that Poetry was installed in a directory which is not in your $PATH, you can set the path like this:

export PATH="$PATH:$HOME/.local/bin"

If you want to deploy HELIPORT, make sure to install Poetry for your root user (by running the pip command as root).

Setup for Development

Get the code

First, checkout the official HELIPORT Git repository from codebase.helmholtz.cloud. If you need access, just contact us.

git clone "https://codebase.helmholtz.cloud/fwcc/data-management/dms-guidance-system.git"
cd dms-guidance-system

Setup the Virtual Environment

Create the python environment with the required packages:

poetry install

Configure HELIPORT

The next step is to configure HELIPORT. This is done using an environment file. You can get started by using a copy of the environment file that is distributed with the HELIPORT source code:

cd heliport_system/heliport_project
cp -i .env.dist .env

After copying it, you can make changes to .env. Some changes are required but most of the settings can be left untouched. The comments in the environment file will guide you through the process.

Run the Development Server

To run the development server, the first required step is to run the migrations on your database. This is only necessary if you want to run the app for the first time or if you made changes to the data models and created new migrations.

cd heliport_system/
poetry run python manage.py migrate

Now, you can finally run the server:

poetry run python manage.py runserver

You’ll see the following output on the command line:

Performing system checks...

System check identified no issues (0 silenced).
February 21, 2022 - 15:50:53
Django version 3.1.4, using settings 'heliport_projects.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.

Access your HELIPORT instance at your local system http://127.0.0.1:8000/

Deployment of a Demo Instance

As mentioned above, to deploy a demo instance of HELIPORT, you will need to run all commands as root. Make sure you have installed Poetry as the root user, too.

Get the Code

HELIPORT comes with a deployment script that expects the git repo to have been cloned into the /opt directory of your server:

cd /opt
git clone "https://codebase.helmholtz.cloud/fwcc/data-management/dms-guidance-system.git"

Configure Your Demo Instance

Configuration of the deployment version of HELIPORT works exactly as described above for the development setup. However, instead of copying the distributed environment file to the correct place in the source code, the deployment script expects to find the file outside of the source code, in the root user's home directory:

cp -i heliport_system/heliport_project/.env.dist /root/HELIPORT.env

Now you can do the necessary configurations by editing the HELIPORT.env file.

Run the Deployment Script

The next step to deploy HELIPORT is to run the deployment script.

bash scripts/deploy.sh deploy

This will set up the necessary HELIPORT services and start the application. You can also use the deployment script to restart the services and run a health check:

bash scripts/deploy.sh restart
bash scripts/deploy.sh status

Connect to HELIPORT via a Web Server

After running the deployment script, HELIPORT will be accessible via the unix domain socket /run/uwsgi/heliport.sock. The last step in the setup process is to make this socket available via a webserver. If you want to use nginx, you can use one of the example configurations that can be found in the HELIPORT source under config/nginx. But you can also use any other webserver that lets you proxy web requests to the socket.

Back