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 connect a peer 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.
Install and start Flussonic Central
Warning
Before you proceed to install Flussonic Central, update Flussonic Media Server to the latest version.
To install Flussonic Central on the server:
1) Run the following command in the terminal:
apt install flussonic-central
2) After successfully installing Flussonic Central, open the configuration file /etc/central/central.conf
. Edit the URI database_url
by specifying the connection parameters to the PostgreSQL database and replacing the default values. If your database requires SSL support, specify the ssl
parameter in the URI string with one of the possible values: false
, true
or required
like so: postgres://central:pass@127.0.0.1/central_dev?ssl=required
. The parameter values correspond to the sslmode in libpq values: false = disable
, true = prefer
, required = require
. By default, ssl=false
.
If you do not have a database, create one following the steps below.
3) Specify the login, password and API key by uncommenting the api_key
and edit_auth
lines and removing the "%" symbol at the beginning of each line. Replace the default value (KEY0
) of the API key (api_key
) with your own (chosen randomly), and the default login and password (admin REPLACE_YOUR_PASSWORD
) of the edit_auth
with the administrator login and password of your Flussonic server. An API key is used for Flussonic Central to communicate with other Flussonic servers.
4) You can also specify a different HTTP port number (http_port
) than the default one. 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.
5) Start the Flussonic Central service by running the following command in the terminal:
service central start
6) Open the Flussonic Central administrator web interface using the following link:
http://FLUSSONIC-IP:PORT_NUMBER/admin
where
FLUSSONIC-IP
is the IP address of the server where Flusssonic Central is installedPORT_NUMBER
is the number of HTTP port specified inhttp_port
variable.
7) In the opened window, specify the license key, 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:
Connect a peer
To connect a peer to Flussonic Central:
1) Open the sidebar navigation menu to the left and go to the Streamers section.
2) Go to the Settings tab and type the hostname of the peer you would like to connect in the New peer hostname field. Then click Save to apply the changes.
3) Go to the peer settings by clicking the edit icon.
4) Specify the cluster key in the Cluster key field and click Save to apply the changes. The same cluster key should be specified in the configuration of the Flussonic Media Server peer that you want to connect.
5) Add the config_external parameter to the configuration of the Flussonic Media Server peer and specify the path for the peer to access the Flussonic Central:
config_external http://API_KEY@CENTRAL-IP:CENTRAL_PORT/streamer/api/v3/streamers
where
API_KEY
is the API key specified in theapi_key
variable in the Flussonic Central configuration file/etc/central/central.conf
,CENTRAL-IP
is the IP address of the Flussonic Central server,CENTRAL_PORT
is the HTTP port number (http_port
) of Flussonic Central.
6) Go back to the Flussonic Central web interface, open the Streamers section and click the Overview tab, where the peer health should be displayed. Make sure you have the peer 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 peers connected to Flussonic Central.
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:
1) Go to the Media section of the sidebar navigation menu.
2) 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.
3) Go to the Streams tab and make sure your stream is up and running.
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:
1) Install PostgreSQL according to the instructions on the website.
2) 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)
3) 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;