/
9. Configure Terraform Server
Install Red5 Pro Terraform Software on the Instance:
- Copy the
terraform-service.zip
file up to 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
- Create a
red5service
directory in /usr/local (mkdir /usr/local/red5service
) - Unzip
terraform-service.zip
, and copy the following files to/usr/local/red5service
application.properties
cloud_controller_do.tf
red5terra.sh
terraform
terraform-service-*.jar
variables_do.tf
- 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 token 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 higherconfig.dbHost
-- the DB Endpoint URL of your PostgreSQL server instanceconfig.dbPort
-- leave this as25060
, the default PostgreSQL port on DOconfig.dbUser
-- Database Master Usernameconfig.dbPass
-- Database Master Password
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=INFO
#Rest API token
api.accessToken=Kyj9aqLtLi6T
#Terraform configurations
terra.location=/usr/local/red5service
#set to 180000 for small groups; higher for larger groups
terra.operationTimeoutMilliseconds=180000
terra.token=912258d5db5d13a8e3xxxxxxxxxxxfdba334d4d13xxxxxxxxx85924d
terra.sshkey=id_autoscale
terra.parallelism=10
#DataBase configurations
config.dbHost=qa-terraform-db01-do-user-1234567-0.a.db.ondigitalocean.com
config.dbPort=25060
config.dbUser=doadmin
config.dbPass=ledtdjk9123niud5h
config.dbDriver=org.postgresql.Driver
config.dbName=cluster
Test terraform service
- To start the service manually, run:
./usr/local/red5service/red5terra.sh start
- Create GET call to
{host}:8083/terraform/test?accessToken={api.accessToken}
- response should be:Red5Pro Terraform Service is working
You can run the service directly via ./usr/local/red5service/red5terra.sh start
(./usr/local/red5service/red5terra.sh stop
to stop), or sudo systemctl start red5proterraform