From b7b5fd05db124ca8659c654e962d455f1d3b6d6a Mon Sep 17 00:00:00 2001 From: iolesyk Date: Fri, 21 Jun 2024 12:01:36 -0400 Subject: [PATCH] AUTO-RECORD - add ability to enable disable auto record broadcast strteams on the Origin,Transcoder and single red5pro server --- README.md | 3 +++ examples/autoscaling/main.tf | 1 + examples/cluster/main.tf | 1 + examples/single/main.tf | 1 + main.tf | 3 +++ red5pro-installer/r5p_config_node_apps_plugins.sh | 11 +++++++++++ variables.tf | 15 +++++++++++++++ 7 files changed, 35 insertions(+) diff --git a/README.md b/README.md index f12e0d5..2459578 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ module "red5pro" { red5pro_cloudstorage_aws_region = "us-west-1" # AWS region for Red5 Pro cloud storage (S3 Bucket) red5pro_cloudstorage_postprocessor_enable = false # true - enable Red5 Pro server postprocessor, false - disable Red5 Pro server postprocessor (https://www.red5.net/docs/special/cloudstorage-plugin/server-configuration/) red5pro_cloudstorage_aws_bucket_acl_policy = "public-read" # AWS bucket ACL policy for Red5 Pro cloud storage (S3 Bucket) Example: none, public-read, authenticated-read, private, public-read-write + red5pro_stream_auto_record_enable = false # true - enable Red5 Pro server broadcast stream auto record, false - disable Red5 Pro server broadcast stream auto record red5pro_coturn_enable = false # true - enable customized Coturn configuration for Red5Pro server, false - disable customized Coturn configuration for Red5Pro server (https://www.red5.net/docs/installation/turn-stun/turnstun/) red5pro_coturn_address = "stun:1.2.3.4:3478" # Customized coturn address for Red5Pro server (https://www.red5.net/docs/installation/turn-stun/turnstun/) red5pro_efs_enable = false # enable/disable EFS mount to record streams @@ -224,6 +225,7 @@ module "red5pro" { origin_image_red5pro_cloudstorage_aws_region = "us-west-1" # AWS region for Red5 Pro cloud storage (S3 Bucket) origin_image_red5pro_cloudstorage_postprocessor_enable = false # true - enable Red5 Pro server postprocessor, false - disable Red5 Pro server postprocessor (https://www.red5.net/docs/special/cloudstorage-plugin/server-configuration/) origin_image_red5pro_cloudstorage_aws_bucket_acl_policy = "public-read" # AWS bucket ACL policy for Red5 Pro cloud storage (S3 Bucket) Example: none, public-read, authenticated-read, private, public-read-write + origin_image_red5pro_stream_auto_record_enable = false # true - enable Red5 Pro server broadcast stream auto record, false - disable Red5 Pro server broadcast stream auto record origin_image_red5pro_efs_enable = false # enable/disable EFS mount to record streams origin_image_red5pro_efs_dns_name = "example.efs.region.amazonaws.com" # EFS DNS name @@ -367,6 +369,7 @@ module "red5pro" { origin_image_red5pro_cloudstorage_aws_region = "us-west-1" # AWS region for Red5 Pro cloud storage (S3 Bucket) origin_image_red5pro_cloudstorage_postprocessor_enable = false # true - enable Red5 Pro server postprocessor, false - disable Red5 Pro server postprocessor (https://www.red5.net/docs/special/cloudstorage-plugin/server-configuration/) origin_image_red5pro_cloudstorage_aws_bucket_acl_policy = "public-read" # AWS bucket ACL policy for Red5 Pro cloud storage (S3 Bucket) Example: none, public-read, authenticated-read, private, public-read-write + origin_image_red5pro_stream_auto_record_enable = false # true - enable Red5 Pro server broadcast stream auto record, false - disable Red5 Pro server broadcast stream auto record origin_image_red5pro_efs_enable = false # enable/disable EFS mount to record streams origin_image_red5pro_efs_dns_name = "example.efs.region.amazonaws.com" # EFS DNS name diff --git a/examples/autoscaling/main.tf b/examples/autoscaling/main.tf index 279a9d6..cf7ee50 100644 --- a/examples/autoscaling/main.tf +++ b/examples/autoscaling/main.tf @@ -82,6 +82,7 @@ module "red5pro" { origin_image_red5pro_cloudstorage_aws_region = "us-west-1" # AWS region for Red5 Pro cloud storage (S3 Bucket) origin_image_red5pro_cloudstorage_postprocessor_enable = false # true - enable Red5 Pro server postprocessor, false - disable Red5 Pro server postprocessor (https://www.red5.net/docs/special/cloudstorage-plugin/server-configuration/) origin_image_red5pro_cloudstorage_aws_bucket_acl_policy = "public-read" # AWS bucket ACL policy for Red5 Pro cloud storage (S3 Bucket) Example: none, public-read, authenticated-read, private, public-read-write + origin_image_red5pro_stream_auto_record_enable = false # true - enable Red5 Pro server broadcast stream auto record, false - disable Red5 Pro server broadcast stream auto record origin_image_red5pro_efs_enable = false # enable/disable EFS mount to record streams origin_image_red5pro_efs_dns_name = "example.efs.region.amazonaws.com" # EFS DNS name diff --git a/examples/cluster/main.tf b/examples/cluster/main.tf index 5e2a1a9..aee7680 100644 --- a/examples/cluster/main.tf +++ b/examples/cluster/main.tf @@ -86,6 +86,7 @@ module "red5pro" { origin_image_red5pro_cloudstorage_aws_region = "us-west-1" # AWS region for Red5 Pro cloud storage (S3 Bucket) origin_image_red5pro_cloudstorage_postprocessor_enable = false # true - enable Red5 Pro server postprocessor, false - disable Red5 Pro server postprocessor (https://www.red5.net/docs/special/cloudstorage-plugin/server-configuration/) origin_image_red5pro_cloudstorage_aws_bucket_acl_policy = "public-read" # AWS bucket ACL policy for Red5 Pro cloud storage (S3 Bucket) Example: none, public-read, authenticated-read, private, public-read-write + origin_image_red5pro_stream_auto_record_enable = false # true - enable Red5 Pro server broadcast stream auto record, false - disable Red5 Pro server broadcast stream auto record origin_image_red5pro_efs_enable = false # enable/disable EFS mount to record streams origin_image_red5pro_efs_dns_name = "example.efs.region.amazonaws.com" # EFS DNS name diff --git a/examples/single/main.tf b/examples/single/main.tf index 370f233..a72a920 100644 --- a/examples/single/main.tf +++ b/examples/single/main.tf @@ -68,6 +68,7 @@ module "red5pro" { red5pro_cloudstorage_aws_region = "us-west-1" # AWS region for Red5 Pro cloud storage (S3 Bucket) red5pro_cloudstorage_postprocessor_enable = false # true - enable Red5 Pro server postprocessor, false - disable Red5 Pro server postprocessor (https://www.red5.net/docs/special/cloudstorage-plugin/server-configuration/) red5pro_cloudstorage_aws_bucket_acl_policy = "public-read" # AWS bucket ACL policy for Red5 Pro cloud storage (S3 Bucket) Example: none, public-read, authenticated-read, private, public-read-write + red5pro_stream_auto_record_enable = false # true - enable Red5 Pro server broadcast stream auto record, false - disable Red5 Pro server broadcast stream auto record red5pro_coturn_enable = false # true - enable customized Coturn configuration for Red5Pro server, false - disable customized Coturn configuration for Red5Pro server (https://www.red5.net/docs/installation/turn-stun/turnstun/) red5pro_coturn_address = "stun:1.2.3.4:3478" # Customized coturn address for Red5Pro server (https://www.red5.net/docs/installation/turn-stun/turnstun/) red5pro_efs_enable = false # enable/disable EFS mount to record streams diff --git a/main.tf b/main.tf index 2688815..9da4336 100644 --- a/main.tf +++ b/main.tf @@ -710,6 +710,7 @@ resource "aws_instance" "red5pro_node_origin" { "export NODE_CLOUDSTORAGE_AWS_REGION='${var.origin_image_red5pro_cloudstorage_aws_region}'", "export NODE_CLOUDSTORAGE_POSTPROCESSOR_ENABLE='${var.origin_image_red5pro_cloudstorage_postprocessor_enable}'", "export NODE_CLOUDSTORAGE_AWS_BUCKET_ACL_POLICY='${var.origin_image_red5pro_cloudstorage_aws_bucket_acl_policy}'", + "export NODE_STREAM_AUTO_RECORD_ENABLE='${var.origin_image_red5pro_stream_auto_record_enable}'", "export NODE_EFS_ENABLE='${var.origin_image_red5pro_efs_enable}'", "export NODE_EFS_DNS_NAME='${var.origin_image_red5pro_efs_dns_name}'", "export NODE_EFS_MOUNT_POINT='${var.origin_image_red5pro_efs_mount_point}'", @@ -875,6 +876,7 @@ resource "aws_instance" "red5pro_node_transcoder" { "export NODE_CLOUDSTORAGE_AWS_REGION='${var.transcoder_image_red5pro_cloudstorage_aws_region}'", "export NODE_CLOUDSTORAGE_POSTPROCESSOR_ENABLE='${var.transcoder_image_red5pro_cloudstorage_postprocessor_enable}'", "export NODE_CLOUDSTORAGE_AWS_BUCKET_ACL_POLICY='${var.transcoder_image_red5pro_cloudstorage_aws_bucket_acl_policy}'", + "export NODE_STREAM_AUTO_RECORD_ENABLE='${var.transcoder_image_red5pro_stream_auto_record_enable}'", "export NODE_EFS_ENABLE='${var.transcoder_image_red5pro_efs_enable}'", "export NODE_EFS_DNS_NAME='${var.transcoder_image_red5pro_efs_dns_name}'", "export NODE_EFS_MOUNT_POINT='${var.transcoder_image_red5pro_efs_mount_point}'", @@ -1041,6 +1043,7 @@ resource "aws_instance" "red5pro_single" { "export NODE_CLOUDSTORAGE_AWS_REGION='${var.red5pro_cloudstorage_aws_region}'", "export NODE_CLOUDSTORAGE_POSTPROCESSOR_ENABLE='${var.red5pro_cloudstorage_postprocessor_enable}'", "export NODE_CLOUDSTORAGE_AWS_BUCKET_ACL_POLICY='${var.red5pro_cloudstorage_aws_bucket_acl_policy}'", + "export NODE_STREAM_AUTO_RECORD_ENABLE='${var.red5pro_stream_auto_record_enable}'", "export NODE_EFS_ENABLE='${var.red5pro_efs_enable}'", "export NODE_EFS_DNS_NAME='${var.red5pro_efs_dns_name}'", "export NODE_EFS_MOUNT_POINT='${var.red5pro_efs_mount_point}'", diff --git a/red5pro-installer/r5p_config_node_apps_plugins.sh b/red5pro-installer/r5p_config_node_apps_plugins.sh index 4ddcc93..3def53f 100755 --- a/red5pro-installer/r5p_config_node_apps_plugins.sh +++ b/red5pro-installer/r5p_config_node_apps_plugins.sh @@ -19,6 +19,7 @@ # NODE_CLOUDSTORAGE_AWS_REGION=us-east-1 # NODE_CLOUDSTORAGE_POSTPROCESSOR_ENABLE=true # NODE_CLOUDSTORAGE_AWS_BUCKET_ACL_POLICY=public-read # none, public-read, authenticated-read, private, public-read-write +# NODE_STREAM_AUTO_RECORD_ENABLE=true # NODE_WEBHOOKS_ENABLE=true # NODE_WEBHOOKS_ENDPOINT="https://test.webhook.app/api/v1/broadcast/webhook" @@ -179,6 +180,16 @@ config_node_apps_plugins(){ else log_d "Red5Pro AWS Cloudstorage plugin (S3) - disable" fi + ### Red5Pro Stream Auto Record + if [[ "$NODE_STREAM_AUTO_RECORD_ENABLE" == "true" ]]; then + log_i "Red5Pro Broadcas Stream Auto Record - enable" + + stream_auto_record="broadcaststream.auto.record=.*" + stream_auto_record_new="broadcaststream.auto.record=true" + sed -i -e "s|$stream_auto_record|$stream_auto_record_new|" "$RED5_HOME/conf/red5.properties" + else + log_d "Red5Pro Broadcas Stream Auto Record - disable" + fi ### Red5Pro Restreamer if [[ "$NODE_RESTREAMER_ENABLE" == "true" ]]; then log_i "Red5Pro Restreamer - enable" diff --git a/variables.tf b/variables.tf index 70cbd70..b0b58e6 100644 --- a/variables.tf +++ b/variables.tf @@ -223,6 +223,11 @@ variable "red5pro_cloudstorage_aws_bucket_acl_policy" { type = string default = "public-read" } +variable "red5pro_stream_auto_record_enable" { + description = "Red5 Pro server - enable/disable broadcast stream auto record" + type = bool + default = false +} variable "red5pro_coturn_enable" { description = "Red5Pro server customized Coturn configuration" type = bool @@ -495,6 +500,11 @@ variable "origin_image_red5pro_cloudstorage_aws_bucket_acl_policy" { type = string default = "public-read" } +variable "origin_image_red5pro_stream_auto_record_enable" { + description = "Origin node image - enable/disable Red5 Pro server broadcast stream auto record" + type = bool + default = false +} variable "origin_image_red5pro_efs_enable" { description = "Origin node image enable/disable EFS mount to record streams" type = bool @@ -719,6 +729,11 @@ variable "transcoder_image_red5pro_cloudstorage_aws_bucket_acl_policy" { type = string default = "public-read" } +variable "transcoder_image_red5pro_stream_auto_record_enable" { + description = "Transcoder node image - enable/disable Red5 Pro server broadcast stream auto record" + type = bool + default = false +} variable "transcoder_image_red5pro_efs_enable" { description = "Transcoder node image enable/disable EFS mount to record streams" type = bool