Skip to content
Snippets Groups Projects
bare-metal-installation.md 5.67 KiB

Install for Development

  1. Install for Development
    1. Prerequisites
    2. Preparation
      1. Setting up the database
    3. Configuration
    4. Running Engine
      1. Starting dependencies
    5. Daemonized Engine
      1. Running with Systemd
      2. Running with Supervisor
    6. Logging
    7. Read more

Prerequisites

Aura Engine runs on any modern Debian-based OS. It requires at least

Setting up the project structure

Then clone all engine related projects to some development folder. In production we recommend /opt/aura/ as the system base.

mkdir ~/code/aura
cd ~/code/aura
git clone https://gitlab.servus.at/autoradio/engine
git clone https://gitlab.servus.at/autoradio/engine-core
git clone https://gitlab.servus.at/autoradio/engine-api
     ...

If you are developing engine you also might want the projects steering, dashboard and tank in there, or you'll start them with Docker Compose (see how to run Aura Web with Docker in the meta repository)

Preparation

Install dependencies:

apt install \
    python3-wheel \
    python3-flask \
    python3-flask-sqlalchemy \
    python3-http-parser \
    python3-psycopg2 \
    python3-requests \
    python3-sqlalchemy \
    python3-validators \
    sqlite3

Create your base configuration from the sample configuration

# Development
cp config/sample-development.engine.ini config/engine.ini
# Production
cp config/sample-production.engine.ini config/engine.ini

Setting up the database

Engine requires a PostgreSQL database to cache any programme info locally.

sudo -u postgres psql -f contrib/postgresql-create-database.sql

Important: You might want to change the password for the database user created by the relevant script.

Configuration

In your development environment edit following file to configure the engine:

./config/engine.ini

Please note, if some configuration exists under /etc/aura/engine.ini the configuration by default is drawn from there. This overrides any configuration located in ./engine/config.

While the configuration file has plenty of options, you only need to set a few mandatory ones, given you are running the other components (such as 'engine-core', "engine-api" etc.) at their default settings too.

Required modifications are: - The password db_pass for the local database holding scheduling information - The app secret api_tank_secret for connecting to AURA Tank

Running Engine

There's a convencience script run.sh to get engine started

engine$ ./run.sh

The script executes the default target, which is usually dev for development environments.

You can call this target explicitly too:

engine$ ./run.sh dev

Or run Engine in production mode:

engine$ ./run.sh prod

For details on the run script, consult the AURA CLI documentation.

Starting dependencies

You'll also need to start Engine Core separately.

Note it should not matter in which order you start Engine and Engine Core.

engine-core$ ./run.sh

Last but not least, Engine API is the target service to store playlogs, health information and details for the Studio Clock.

engine-api$ ./run.sh

In order to have the complete Engine experience, other AURA Components are required to be running too. Checkout the Meta Repository on how to run for example AURA Web using Docker Compose.

Daemonized Engine

For this you can utilize either Systemd or Supervisor. Please check the their manuals on how to use these services.

The daemon configs are expecting you run engine under the user engineuser and being located under /opt/aura/engine, /opt/aura/engine-api and /opt/aura/engine-core respectively. Do prepare the project root and permissions you can use the script scripts/initialize-systemd.sh. To create the matching user and audio group membership run scripts/create-engineuser.sh.

Running with Systemd

Copy the unit files in /opt/aura/engine/config/systemd/aura-engine.service to your systemd unit directory, and reload the systemd daemon:

cp /opt/aura/engine/config/systemd/* /etc/systemd/system/
systemctl daemon-reload

Running with Supervisor

Now, given you are in the engine's home directory like /opt/aura/engine/, simply type following to start the services:

supervisord

This picks up the supervisor configuration provided in the local supervisord.conf and the service configurations located in config/supervisor/*.conf.