Configure Terraform Server
Install Red5 Pro Terraform Software on the Instance:
- Copy the
terraform-service.zip
file up to the/usr/local
directory on your server. - SSH into the server, then run
apt-get update
. - Install Java 8 and NTP (to ensure that the terraform server is in sync with your stream manager(s). Run:
apt-get install -y default-jre unzip ntp
- Unzip
terraform-service.zip
in the/usr/local/
directory (new directory added will be calledred5service
) - Delete the
cloud_controller_azure.tf
file from thered5service
directory - Make
red5terra.sh
andterraform
executable (chmod +x red5terra.sh terraform
) - Copy
red5proterraform.service
to/lib/systemd/system/
- Modify service properties,
chmod 644 /lib/systemd/system/red5proterraform.service
, then reload the daemon:systemctl daemon-reload
, and enable the servicesystemctl enable red5proterraform.service
Update application.properties
Modify the following values in the application.properties
file:
server.port
– the port you will be running this service on (default = 8083)api.accessToken
– the passphrase to use for making API calls to this service (to be used in the stream manager configuration)terra.operationTimeoutMilliseconds
– default timeout is set to 3 minutes (180000 milliseconds). Make this value higher if you will be initiating more than 20 nodes concurrentlyterra.token
– the Digital Ocean API token created aboveterra.sshkey
– the SSH key created aboveterra.parallelism
– the default, 10, should work well. If you are creating very large groups, you can set this to 30, but we don’t recommend going much highercloud.do_api_token={}
— this is the Digital Ocean API token that you created; it is used by Terraform to create and destroy dropletscloud.do_ssh_key_name={}
— the name of the ssh key that you created an copied up to Digital Ocean; the key will be copied to the droplets so you can ssh to themconfig.dbHost
— the DB Endpoint URL of your PostgreSQL server instanceconfig.dbPort
— the default PostgreSQL port on DO is25060
; if you are using MySQL, then the port should be3306
config.dbUser
— Database Master Usernameconfig.dbPass
— Database Master Passwordconfig.dbDriver
— chooseorg.postgresql.Driver
if you are using PostGres, ororg.mysql.Driver
if you are using MySQLconfig.dbSSL
— should be set tofalse
for Digital Ocean
The Settings to maintain application health
should be left to the default settings. These are used in conjunction with the Stream Manager to ensure that the Terraform service is functional.
sample application.properties file:
#Server port configurations
server.port=8083
#Log level
logging.pattern.console=%d{yyyy-MM-dd} | %d{HH:mm:ss.SSS} | %5p | %-40.40logger{40} | %m%n
logging.level.com.red5pro.services.terraform.client.TerraformService=DEBUG
#Terraform Service Rest API token to be used by stream manager to connect to this service
api.accessToken=Kyj9aqLtLi6T
#Terraform configurations
terra.location=/usr/local/red5service
#set to 180000 for small groups; higher for larger groups
terra.operationTimeoutMilliseconds=720000
terra.parallelism=10
#Cloud specific params must start with cloud.
# Azure
#cloud.az_subscription_id={}
#cloud.az_client_id={}
#cloud.az_client_secret={}
#cloud.az_tenant_id={}
#cloud.az_resource_group_name={}
#cloud.az_ssh_user_name={}
#cloud.az_ssh_user_password={}
# DigitalOcean
cloud.do_api_token=912258d5db5d13a8e3xxxxxxxxxxxfdba334d4d13xxxxxxxxx85924d
cloud.do_ssh_key_name=id_autoscale
#DataBase configurations
config.dbHost=qa-terraform-db01-do-user-1234567-0.a.db.ondigitalocean.com
config.dbPort=25060
config.dbUser=dbadmin
config.dbPass=ledtdjk9123niud5h
config.dbDriver=org.postgresql.Driver
# config.dbDriver=org.mysql.Driver
config.dbName=cluster
# define to use SSL mode or not ( Azure required to use SSL )
config.dbSSL=false
#Setting to maintaine application health
management.endpoints.web.base-path=/admin
management.endpoints.web.exposure.include=health,restart
management.endpoint.health.show-details=always
management.endpoint.restart.enabled=true
management.health.defaults.enabled=false
management.health.ping.enabled=true
management.health.database.enabled=true
Start terraform service
From /usr/local/red5service
directory, run:
terraform init
then
red5terra.sh start
Test terraform service
Navigate in a browser to http://{host}:8083/terraform/test?accessToken={api.accessToken}
– the response should be: Red5Pro Terraform Service is working