Configure Terraform Server

Install Red5 Pro Terraform Software on the Instance:

  1. Copy the terraform-service.zip file up to the /usr/local directory on your server.
  2. SSH into the server, then run apt-get update.
  3. 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
  4. Unzip terraform-service.zip in the /usr/local/ directory (new directory added will be called red5service)
  5. Delete the cloud_controller_azure.tf file from the red5service directory
  6. Make red5terra.sh and terraform executable (chmod +x red5terra.sh terraform)
  7. Copy red5proterraform.service to /lib/systemd/system/
  8. Modify service properties, chmod 644 /lib/systemd/system/red5proterraform.service, then reload the daemon: systemctl daemon-reload, and enable the service systemctl 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 concurrently
  • terra.token - the Digital Ocean API token created above
  • terra.sshkey - the SSH key created above
  • terra.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 higher
  • cloud.do_api_token={} -- this is the Digital Ocean API token that you created; it is used by Terraform to create and destroy droplets
  • cloud.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 them
  • config.dbHost -- the DB Endpoint URL of your PostgreSQL server instance
  • config.dbPort -- the default PostgreSQL port on DO is 25060; if you are using MySQL, then the port should be 3306
  • config.dbUser -- Database Master Username
  • config.dbPass -- Database Master Password
  • config.dbDriver -- choose org.postgresql.Driver if you are using PostGres, or org.mysql.Driver if you are using MySQL
  • config.dbSSL -- should be set to false 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

#Log level
logging.pattern.console=%d{yyyy-MM-dd} | %d{HH:mm:ss.SSS} | %5p | %-40.40logger{40} | %m%n

#Terraform Service Rest API token to be used by stream manager to connect to this service

#Terraform configurations

#set to 180000 for small groups; higher for larger groups

#Cloud specific params must start with cloud.
# Azure

# DigitalOcean

#DataBase configurations
# config.dbDriver=org.mysql.Driver
# define to use SSL mode or not ( Azure required to use SSL )

#Setting to maintaine application health

Start terraform service

From /usr/local/red5service directory, run:

terraform init


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