Clone
5
Installation
Nicolas Klier edited this page 2020-11-29 11:59:40 +01:00

Installation

The installation process of Livebeat is kind of complicated currently but this will change as we move more towards release.

Dependencies

These programs are required in order to run Livebeat:

Program Tested version Install Purpose
Node.js v15.3.0 instructions Both backend & frontend require Node.js as runtime in order to run.
RabbitMQ 3.8.9 instructions Is used for real-time and continuous communication between all parties.
MongoDB MongoDB Atlas instructions Main database

Node.js

Please pick your distribution here and follow the instruction there. For Debian/Ubuntu click here.

RabbitMQ

Fedora

Installing RabbitMQ on Fedora is a bit tricky.

Installing Erlang

Create /etc/yum.repos.d/erlang.repo and put this as content:

[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/x86_64
repo_gpgcheck=1
gpgcheck=1
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

Then you can execute the install command:

sudo dnf install erlang
Installing RabbitMQ

Same thing, add repository under /etc/yum.repos.d/rabbitmq_server.repo:

[rabbitmq_rabbitmq-server]
name=rabbitmq_rabbitmq-server
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/x86_64
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

[rabbitmq_rabbitmq-server-source]
name=rabbitmq_rabbitmq-server-source
baseurl=https://packagecloud.io/rabbitmq/rabbitmq-server/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
gpgkey=https://packagecloud.io/rabbitmq/rabbitmq-server/gpgkey
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

Now install the package:

sudo dnf install rabbitmq-server

Recommended is to enable the RabbitMQ service so it starts on boot:

sudo systemctl enable rabbitmq-server

Optional but a good choice is to enable the management web interface:

sudo rabbitmq-plugins enable rabbitmq_management

It can be accessed under http://localhost:15672

Getting started

Since we have everyting installed, we have to make our hands dirty before we can even touch Livebeat.

RabbitMQ

Authentification backend

We need to change a few things for RabbitMQ. Since Livebeat handles all authentifications we have to tell RabbitMQ to use Livebeat as authentification backend.

We need to enable the rabbitmq_auth_backend_http plugin:

rabbitmq-plugins enable rabbitmq_auth_backend_http

Now go into the /etc/rabbitmq/rabbitmq.conf config file and put this at the beginning of the file:

auth_backends.1 = http
auth_http.http_method   = get
auth_http.user_path     = http://localhost:8040/user/rabbitlogin
auth_http.vhost_path    = http://localhost:8040/user/vhost
auth_http.resource_path = http://localhost:8040/user/resource
auth_http.topic_path    = http://localhost:8040/user/topic

This will basicly tell RabbitMQ to use this plugin as authentification method and then which paths and method to use.

MQTT

The frontend uses MQTT over WebSockets for real-time communication.

Enable rabbitmq_web_mqtt plugin:

rabbitmq-plugins enable rabbitmq_web_mqtt

For more information read here if you want to setup SSL for example.

Livebeat

Livebeat uses a .env file as configuration so you have to create this file in the root folder of the backend.

For example /srv/livebeat/backend/.env:

DEBUG=false
MONGO_URI=mongodb+srv://...
RABBITMQ_URI=amqp://backend:RANDOM_PASSWORD@localhost
JWT_SECRET=Um5KwYv88JX9DEi5E^m@KW3u9^9j*AnDsr98ZRXJCAamPui@

Note: Please replace JWT_SECRET and RANDOM_PASSWORD with an other secret phrase. It is also recommended to set the read rights as low as possible. Only the Livebeat user/group should have read-only access to this file.

MONGO_URI requires a path to any working MongoDB server instance. If you don't want to setup you own server fell free to use MongoDB Atlas free sandbox cluster.