July 18, 2021

Install Niostreamer in Docker on CentOS

In this article we will describe how to get started with niostreamer. We will show how to run Niostreamer in Docker container in CentOS operating system.

Docker is the easiest way to try Niostreamer in action.

In this post we will show how to install Niostreamer server to use RTMP, RTSP or HLS streaming capabilities in Docker.

Install Docker

Setup you repository first. Install `yum-utils` package and setup DOcker stable repository.

sudo yum install -y yum-utils
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo


Install latest version of Docker engine amd containerd:

sudo yum install docker-ce docker-ce-cli containerd.io

Start Docker:

sudo systemctl start docker

Ensure Docker is installed correctly by running the example:

sudo docker run hello-world

Install Niostreamer

Niostreamer has it's official Docker repository located here: https://hub.docker.com/r/niostreamer/niostreamer

Download niostreamer image:

sudo docker pull niostreamer/niostreamer

Prepare docker-compose file. Niostreamer is standalone application with static config file and dynamic cloud setting it got from admin panel. Config directories and logs should be mounted as external volumes.

Prepare docker-compose file. Niostreamer is standalone application with static config file and dynamic cloud setting it got from admin panel. Config directories and logs should be mounted as external volumes.

Create configuration directories:

    mkdir conf
    touch conf/nio.conf
    mkdir conf/conf.d
    mkdir log

Create docker compose file `docker-compose.yml`:

version: '3.1'
services:
    niostreamer:
        image: "niostreamer/niostreamer"
        hostname: "niostreamer"
        ports:
            - "8080:8080"
        volumes:
          - /home/user/niostreamer/docker/conf:/etc/niostreamer
          - /home/user/niostreamer/docker/log:/var/log

TCP port 8080 is local port provide HTTP API for internal needs. Using this API you can register streamer instance in control panel on https://niostreamer.com.

First pull the container

    docker-compose pull

And run it:

    docker-compose up

Now niostreamer is up and running. Let's register it in admin panel.

Using control panel you are able to manage and monitor your instances using web browser or mobile.

First, register a new account to proceed: https://niostreamer.com/console/register

Sign into your account. You will see empty dashboard as there are no server instances registered yet: https://niostreamer.com/console/instances

You will see the example of curl command line utility demonstrates how to register instance in control panel. Niostreamer has special API on HTTP port 8080 to do that.

Run the following command in other window:

curl -X POST http://localhost:8080/api/v1/saas/instances/register \
     -H "X-Account-Key: AA1SXUJHBWT277LNMM6P" \
     -H "X-Account-Secret: 2ibhtnyHRCetYkOh9r5IoYZqPcZ0oBj8DJrO5Sb8"

You will see in logs that instance is registered:

You will see the new instance in web panel:

Now Niostreamer is ready to accept incoming connections. In next articles we will show how you can ingest incoming RTMP connections to niostreamer server in Docker.

Best,

Niostreamer team