SmartTUBE Server Installation

The initial deployment of the SmartTUBE server is usually carried out by SmartLabs specialists during the project commissioning phase. This document serves as a reference guide for advanced users who intend to set up a distributed component structure, where each component is installed on a separate machine. It also provides information on integrating with your existing databases and configurations.

SmartTUBE installation requires manual configuration from a repository. Please follow the steps outlined below to successfully install SmartTUBE.

  1. Connect the repository (for the repository details contact the SmartLabs official representative).
  2. Install Java JDK from the repository:

# yum -y install smartlabs-java8-stub


Alternatively, you can download the rpm-package from the official source http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html and install it:

# rpm -ivh <package_name>

  1. Install and run Elasticsearch (reference guide: https://www.elastic.co/guide/en/elasticsearch/reference/7.8/rpm.html):
  2. Import the Elasticsearch PGP Key:

# rpm –import https://artifacts.elastic.co/GPG-KEY-elasticsearch

  1. Create a file called elasticsearch.repo in the /etc/yum.repos.d/ directory:

[elasticsearch]

name=Elasticsearch repository for 7.8 packages
baseurl=https://artifacts.elastic.co/packages/7.8/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md

  1. Install Elasticsearch:

sudo yum install –enablerepo=elasticsearch elasticsearch-7.8.1

  1. The RPM for Elasticsearch v7.8.1 can be downloaded from the website and installed as follows:

# yum -y install wget
# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.1-x86_64.rpm
# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.1-x86_64.rpm.sha512
# sha512sum -c elasticsearch-7.8.1-x86_64.rpm.sha512


This command compares the SHA of the downloaded RPM and the published checksum, which should output elasticsearch-7.8.1-x86_64.rpm: OK.

#  yum localinstall elasticsearch-7.8.1-x86_64.rpm

  1. Start the Elasticsearch service:

# systemctl start elasticsearch.service

  1. Add these settings in the configuration file /etc/elasticsearch/elasticsearch.yml:

cluster.name: smartlabs_cache_client
cluster.initial_master_nodes:
 – 127.0.0.1
network.host: _local_,_site_
node.data: true
node.master: true
node.name: node01
reindex.remote.whitelist: ‘*:9200’
xpack.license.self_generated.type: basic
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

  1. Restart the Elasticsearch service:

# systemctl restart elasticsearch.service

  1. Set the password for built-in users:

# /usr/share/elasticsearch/bin/elasticsearch-setup-passwords auto

  1. Follow the on-screen instructions.
  2. Remember the password for the elastic user. It will be needed in the SmartTUBE Cache client configuration.
  3. After you install Elasticsearch, enable the service autorun

    RHEL7: # systemctl enable elasticsearch.service

    and run the service:

    RHEL7: # systemctl start elasticsearch.service

  4. Install PostgreSQL (reference guide: https://wiki.postgresql.org/wiki/YUM_Installation)
  5. Install the ps-rpm file corresponding to your OS version and the required version of the package (https://yum.postgresql.org/repopackages.php), for example:

# yum localinstall https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-2.noarch.rpm

  1. Check the packages available for installation: # yum list postgres*
  2. Install PostgreSQL (the command depends on the package version you are installing):

# yum -y install postgresql96-server

  1. Initialize the database

    RHEL7:

# su – postgres
$ /usr/pgsql-9.6/bin/initdb (the path to initdb)
$
exit

  1. Enable the service autorun

    RHEL7: # systemctl enable postgresql-9.6.service

  2. Run the service

    RHEL7: # systemctl start postgresql-9.6.service

  3. Download the database dump: # yum -y install postgresql-initial
  4. Install SmartTUBE from the repository

# yum -y install smarttube5-mod-dataserver smarttube5-mod-cacheserver smarttube5-mod-datacore smarttube5-aui5 smartlabs-nginx smarttube5-mod-reports

  1. Make the following changes to the configuration file /opt/smartlabs/smarttube5/conf/modules/cache-server.conf:

     elasticsearch {

         auth.password = “elastic_user_password”

         auth.username = elastic

         connectTimeoutMillisec = 1000

         nodes = [

               “127.0.0.1:9200”

         ]

         socketTimeoutMillisec = 30000

       }

Where elastic_user_password — password for elastic user generated in Step 3.

  1. Make the following changes to the configuration file /opt/smartlabs/smarttube5/conf/modules/data-server.conf:
  2. Find the database section;
  3. Change the IP and PORT and DB reference in the connection-string parameter;
  4. Add the password for DB access;

Example of the correct section configuration:

database {

   connection-string = “jdbc:postgresql://192.168.10.25:5432/master?tcpKeepAlive=true&ApplicationName=sdp5_application”

   login = master

   max-connections = 38

   password = Jmmsd3k09sSQj54

   server = postgresql

}

  1. Open the configuration file /opt/smartlabs/nginx/conf/nginx.conf. It should contain the following:

user            nginx;
worker_processes    
6;
worker_rlimit_nofile    
40960;
worker_priority    
-5;

error_log   /var/log/smartlabs/nginx/error.log;

pid     /var/run/nginx.pid;

events {
   worker_connections 20480;
   epoll_events 8192;
   use epoll;
   accept_mutex off;
}

timer_resolution    1ms;

http {
   include ./mime.types;
   default_type application/octet-stream;

log_format main ‘$remote_addr [$http_x_forwarded_for] – $http_x_smartlabs_mac_address [$time_local] $upstream_cache_status $request “$status” $body_bytes_sent “$http_referer” “$http_user_agent” “$upstream_addr” $server_port “$http_host” $request_time $req uest_send_time “$upstream_response_time” $gzip_ratio’;
log_format mgmt ‘$remote_addr [$http_x_forwarded_for] – $http_x_smartlabs_mac_address [$time_local] MGMT $upstream_cache_status $request “$status” $body_bytes_sent “$http_referer” “$http_user_agent” “$upstream_addr” $server_port “$http_host” $request_time $request_send_time “$upstream_response_time” $gzip_ratio’;

access_log      /var/log/smartlabs/nginx/access.log main;

sendfile            on;
sendfile_max_chunk  131072;
keepalive_timeout   60;
underscores_in_headers  on;
server_tokens       off;
output_buffers      256 1024k;
tcp_nodelay     on;
tcp_nopush      on;

proxy_next_upstream error timeout http_500 http_502 http_503 http_504 ;
proxy_cache_path    /opt/smartlabs/nginx/cache levels=l:2 keys_zone=one:100m inactive=60m max_size=1500m;

push_stream_shared_memory_size 128M;

include     “http.d/*.conf”;
include    
“upstreams.d/*.conf”;
include    
“servers.d/*.conf”;

server {
   listen 127.0.0.1:7999;

   location /sla_status {
       sla_status;
       sla_pass off;
       allow 127.0.0.1;
       deny all;
   }

   location /sla_purge {
       sla_purge;
       sla_pass off;
       allow 127.0.0.1;
       deny all;
   }

   location / {
       access_log off;
       deny all;
   }

   location = /nginx_status {
       stub_status on;
       access_log off;
       allow 127.0.0.1;
       deny all;
   }

   location /push_stream_admin {
       push_stream_publisher admin;
       push_stream_channels_path $arg_topic;
       access_log off;
       allow 127.0.0.1;
       deny all;
   }
 }
}

  1. Configure the /opt/smartlabs/smarttube5/conf/modules/report.conf file with the IP, port and DB name. It should look like this:

component = {

  description = “SmartTUBE5 Report”

  jar = “sdp-report.jar”

  class = “smartsdp.report.main.SmartSDPReport”

  singleton = true

  load-on-startup = 14

  servlet-context-path = “/report/*”

  install-path = “/opt/smartlabs/smarttube5/modules/reports”

  number-of-http-get-handlers = 100

  properties = {

      akka-local = {

      host = “127.0.0.1”

      port = 5054

      }

  datasources = [

      {

          ds-name = “jdbc/sdp”

          server = “postgresql”

          connection-string = “jdbc:postgresql://185.5.42.72:5432/master?tcpKeepAlive=true&ApplicationName=sdpreport_application” login = “master”

          password = “MfXXDeQ6WC”

          max-connections = 5

          }

      ]

  }

}

  1. If you need to apply other changes to configuration files, see their description in the Configuration files part. Normally, you can work with default settings.
  2. Add the rule to iptables (# vi /etc/sysconfig/iptables)

-A INPUT -p tcp -m tcp –dport 8084 -j ACCEPT


Restart the service

RHEL7: # systemctl restart iptables.service

If the service is not set for the RHEL 7 iptables (you can see it by the empty file /etc/sysconfig/iptables), do the following:

  1. Disable firewalld

# systemctl stop firewalld

  1. Delete it from autorun

# systemctl disable firewalld

  1. Install the package with utilities

# yum -y install iptables-services

  1. Add iptables to autorun

# systemctl enable iptables.service

  1. Run the service

# systemctl start iptables.service

  1. Add the rule from above and restart the service
  2. Run the smarttube5 service:

    RHEL7: # systemctl start smarttube5.service
  3. Check the operability:

# wget –header “Content-Type:application/json” -O – ” http://localhost:8084/sdpapi?metacontentingenre=list “


The response must be 200 OK.

CONTENTS
Sign-in
Sign-in with your SmartLabs Support Portal account credentials to see non-public articles.