Getting Started with Flussonic Central
This article contains tips to help you get started with Flussonic Central.
You will learn:
- How to install and start Flussonic Central on your server
- How to run Flussonic Central in Docker
- How to connect a streamer to Flussonic Central
- How to create a stream via the web interface or using the Flussonic Central API.
You can access Flussonic Central via web interface as well as Flussonic Central API.
Prerequisites
Before you proceed to install Flussonic Central:
- Update Flussonic Media Server on the streamers (peers) to the latest version. Make sure that
cluster-key
andhttp
port are specified in their config. - Create and configure the database following the steps below. Recommended version is PostgreSQL 14.4.
Install and start Flussonic Central
To install Flussonic Central on the server:
-
Run the following commands in the terminal:
echo "deb http://apt.flussonic.com/repo binary/" > /etc/apt/sources.list.d/flussonic.list
wget http://apt.flussonic.com/binary/gpg.key -O /etc/apt/trusted.gpg.d/flussonic.gpg
apt-get update && apt-get install flussonic-central
-
After successfully installing Flussonic Central, open the configuration file
/etc/central/central.conf
and set the required parameters:-
DATABASE_URL
is a connection string to your PostgreSQL database. Make sure to replace the default login and password to those you set when installed PostgreSQL. For example,postgres://central:pass@localhost:5432/central_dev
.If your database requires SSL support, specify the
sslmode
parameter at the end of the URI string with the possible value as in the sslmode in libpq. By default,sslmode=prefer
. -
API_KEY
is the API key necessary for Flussonic Central to communicate with other Flussonic servers. Set any value at your discretion. API_URL
is the URL formatted ashttp://CENTRAL-HOSTNAME:PORT
that is used for makingconfig_external
URL that is provisioned to streamers referring to Flussonic Central for configuration.EDIT_AUTH
is administrator login and password of your Flussonic Central server that you will need to access the web UI. If you do not plan to use the web interface, then this parameter can be omitted.
-
-
(Optional) If the default HTTP port 9019 is already used, specify another HTTP port number in the
HTTP_PORT
parameter. This port should be used inAPI_URL
. If you need to enable HTTPS port, upload the SSL certificate and the key files and specify the following parameters in the config file:HTTPS_PORT
is the port number.SSL_CERTIFICATE
is the path to the SSL certificate file.SSL_CERTIFICATE_KEY
is the path to the key file.
The SSL certificate must be generated manually.
-
Save the changes and exit the editor.
Warning
After you make changes to the configuration file in the future, make sure to restart the Flussonic Central by running the
service central restart
command to apply the changes. -
Start the Flussonic Central service by running the following command in the terminal:
service central start
-
Open the Flussonic Central administrator web interface using the following link:
http://CENTRAL-HOSTNAME:PORT_NUMBER/admin
where
CENTRAL-HOSTNAME
is the IP address or URL of the server where Flusssonic Central is installedPORT_NUMBER
is the number of HTTP port specified inhttp_port
variable.
-
In the opened window, specify login and password of the Flussonic Central server and click Sign to log in to the server:
You should see the Flussonic Central web interface:
Running Flussonic Central in a Docker container
Execute the following command to run Flussonic Central in Docker:
docker run flussonic/central:latest
Use the environment variables of the same name as the settings in the configuration file to configure your containerized Flussonic Central.
Connect a streamer
To connect a streamer to Flussonic Central:
-
Open the sidebar navigation menu to the left, go to the Streamers section and click + to add a new streamer.
-
Type the unique name of the streamer you would like to connect in the New streamer hostname field. If using special characters, URL-encode them.
-
Click Save to apply the changes. The settings of the created streamer are displayed.
-
In the API URL field, enter the address of Flussonic Media Server streamer as
http://FLUSSONIC_HOSTNAME:HTTP_PORT
. Flussonic Central will use this address to send API requests to the streamer.If you use an API URL that is only accessible from your local network, make sure to specify a publicly accessible address in the Public payload URL field so that the streams could be accessed over the Internet.
If no API URL is specified, Flussonic Central will try to use Hostname to access the streamer.
-
Specify the cluster key in the Cluster key field. The same cluster key should be specified in the configuration of the Flussonic Media Server streamer that you want to connect.
-
Click Save to apply the changes. If all parameters are set correctly, Flussonic Central will connect to the streamer and add
config_external
option to its configuration so that Flussonic Media Server could receive the configuration from Flussonic Central. If theconfig_external
option does not appear in the streamer's configuration file, check your settings or contact support. -
Go back to the Flussonic Central web interface, open the Streamers section and click the Overview tab, where the streamer health should be displayed. Make sure that the streamer is connected.
Create a stream
To create a stream in Flussonic Central, you can use both admin web interface and Flussonic Central API.
Note
After a stream has been created, it is started on one of the randomly selected streamers connected to Flussonic Central. You can select a preferable streamer in the stream settings.
Warning
The stream configuration defined in Flussonic Central will not be written in the configuration file of the Flussonic Media Server on which the stream is running. The active stream will only be displayed on the server web interface and will be accessible via an API request.
Create a stream via web interface
To create a stream via web interface:
-
Go to the Media section of the sidebar navigation menu.
-
Click on the Add stream button and specify the name of your stream in the Stream name field and the source in the Source URL field. Then click Create to apply the changes.
-
Go to the Streams tab and make sure your stream is up and running.
Use URLs on the Output tab in the stream profile to play the stream.
Create a stream using the API
To create a stream, use the PUT /streams/{name} method from the Flussonic Central API.
Here is the example of a simple PUT request to create a stream:
curl --request PUT --url http://CENTRAL-IP:CENTRAL_PORT/streamer/api/v3/streams/STREAM_NAME \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--header 'Content-Type: application/json' \
--data '{"name": "STREAM_NAME", "inputs": [{"url": "fake://fake"}]}'
Note
This request can be used to both create and modify the stream, so the stream name is specified twice: in the path and in the request body. If you specify different name
values in the path and in the body, then the one in the body takes precedence.
The following response will be returned:
{"config_on_disk":{"inputs":[{"url":"fake://fake"}],"name":"STREAM_NAME"},"inputs":[{"url":"fake://fake"}],"name":"STREAM_NAME","named_by":"config"}
Creating a PostgreSQL database
To create a PostgreSQL database:
-
Install PostgreSQL according to the instructions on the website.
-
After successfully installing PostgreSQL, create a user by running the following command in the terminal:
sudo -u postgres -i createuser -P central
The system will then ask you to set a password that the user will have two times in a row:
Caution
Both login and password must NOT include any of the following characters: @, ;, #, [, \, /, =, $
Enter password for new role: (think up and specify the password of the superuser of the database) Enter it again: (repeat the password for the superuser)
-
Create a database with the superuser created at the previous step as the owner:
sudo -u postgres -i createdb -O central -e -E UTF8 -T template0 central_dev
If database is created successfully, the system's response will be as follows:
CREATE DATABASE central_dev OWNER central ENCODING 'UTF8' TEMPLATE template0;