From f2c7c310eca0263b363fcc1b066bbd51f32dd087 Mon Sep 17 00:00:00 2001 From: iolesyk Date: Wed, 28 Feb 2024 12:50:58 -0500 Subject: [PATCH 1/6] Add feature Red5 Pro webhooks --- examples/autoscaling/main.tf | 14 ++++++++++++++ examples/cluster/main.tf | 2 ++ examples/single/main.tf | 2 ++ main.tf | 8 ++++++++ variables.tf | 30 ++++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+) diff --git a/examples/autoscaling/main.tf b/examples/autoscaling/main.tf index 53ce7c8..663f5e2 100644 --- a/examples/autoscaling/main.tf +++ b/examples/autoscaling/main.tf @@ -67,6 +67,8 @@ module "red5pro" { origin_image_red5pro_socialpusher_enable = false # true - enable Red5 Pro server socialpusher, false - disable Red5 Pro server socialpusher (https://www.red5.net/docs/special/social-media-plugin/overview/) origin_image_red5pro_suppressor_enable = false # true - enable Red5 Pro server suppressor, false - disable Red5 Pro server suppressor origin_image_red5pro_hls_enable = false # true - enable Red5 Pro server HLS, false - disable Red5 Pro server HLS (https://www.red5.net/docs/protocols/hls-plugin/hls-vod/) + origin_image_red5pro_webhooks_enable = false # true - enable Red5 Pro server webhooks, false - disable Red5 Pro server webhooks (https://www.red5.net/docs/special/webhooks/overview/) + origin_image_red5pro_webhooks_endpoint = "https://example.com/red5/status" # Red5 Pro server webhooks endpoint origin_image_red5pro_round_trip_auth_enable = false # true - enable Red5 Pro server round trip authentication, false - disable Red5 Pro server round trip authentication (https://www.red5.net/docs/special/round-trip-auth/overview/) origin_image_red5pro_round_trip_auth_host = "round-trip-auth.example.com" # Round trip authentication server host origin_image_red5pro_round_trip_auth_port = 3000 # Round trip authentication server port @@ -83,6 +85,18 @@ module "red5pro" { 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 +variable "origin_image_red5pro_webhooks_enable" { + description = "Origin node image - Webhooks enable/disable (https://www.red5.net/docs/special/webhooks/overview/)" + type = bool + default = false +} +variable "origin_image_red5pro_webhooks_endpoint" { + description = "Origin node image - Webhooks endpoint" + type = string + default = "" +} + + # Red5 Pro autoscaling Node group - (Optional) node_group_create = true # Linux or Mac OS only. true - create new Node group, false - not create new Node group node_group_name = "terraform-node-group" # Node group name diff --git a/examples/cluster/main.tf b/examples/cluster/main.tf index 91ceac9..223387c 100644 --- a/examples/cluster/main.tf +++ b/examples/cluster/main.tf @@ -71,6 +71,8 @@ module "red5pro" { origin_image_red5pro_socialpusher_enable = false # true - enable Red5 Pro server socialpusher, false - disable Red5 Pro server socialpusher (https://www.red5.net/docs/special/social-media-plugin/overview/) origin_image_red5pro_suppressor_enable = false # true - enable Red5 Pro server suppressor, false - disable Red5 Pro server suppressor origin_image_red5pro_hls_enable = false # true - enable Red5 Pro server HLS, false - disable Red5 Pro server HLS (https://www.red5.net/docs/protocols/hls-plugin/hls-vod/) + origin_image_red5pro_webhooks_enable = false # true - enable Red5 Pro server webhooks, false - disable Red5 Pro server webhooks (https://www.red5.net/docs/special/webhooks/overview/) + origin_image_red5pro_webhooks_endpoint = "https://example.com/red5/status" # Red5 Pro server webhooks endpoint origin_image_red5pro_round_trip_auth_enable = false # true - enable Red5 Pro server round trip authentication, false - disable Red5 Pro server round trip authentication (https://www.red5.net/docs/special/round-trip-auth/overview/) origin_image_red5pro_round_trip_auth_host = "round-trip-auth.example.com" # Round trip authentication server host origin_image_red5pro_round_trip_auth_port = 3000 # Round trip authentication server port diff --git a/examples/single/main.tf b/examples/single/main.tf index 2b22566..0c6dc8f 100644 --- a/examples/single/main.tf +++ b/examples/single/main.tf @@ -53,6 +53,8 @@ module "red5pro" { red5pro_socialpusher_enable = false # true - enable Red5 Pro server socialpusher, false - disable Red5 Pro server socialpusher (https://www.red5.net/docs/special/social-media-plugin/overview/) red5pro_suppressor_enable = false # true - enable Red5 Pro server suppressor, false - disable Red5 Pro server suppressor red5pro_hls_enable = false # true - enable Red5 Pro server HLS, false - disable Red5 Pro server HLS (https://www.red5.net/docs/protocols/hls-plugin/hls-vod/) + red5pro_webhooks_enable = false # true - enable Red5 Pro server webhooks, false - disable Red5 Pro server webhooks (https://www.red5.net/docs/special/webhooks/overview/) + red5pro_webhooks_endpoint = "https://example.com/red5/status" # Red5 Pro server webhooks endpoint red5pro_round_trip_auth_enable = false # true - enable Red5 Pro server round trip authentication, false - disable Red5 Pro server round trip authentication (https://www.red5.net/docs/special/round-trip-auth/overview/) red5pro_round_trip_auth_host = "round-trip-auth.example.com" # Round trip authentication server host red5pro_round_trip_auth_port = 3000 # Round trip authentication server port diff --git a/main.tf b/main.tf index c67c47b..29aeb86 100644 --- a/main.tf +++ b/main.tf @@ -687,6 +687,8 @@ resource "aws_instance" "red5pro_node_origin" { "export NODE_SOCIALPUSHER_ENABLE='${var.origin_image_red5pro_socialpusher_enable}'", "export NODE_SUPPRESSOR_ENABLE='${var.origin_image_red5pro_suppressor_enable}'", "export NODE_HLS_ENABLE='${var.origin_image_red5pro_hls_enable}'", + "export NODE_WEBHOOKS_ENABLE='${var.origin_image_red5pro_webhooks_enable}'", + "export NODE_WEBHOOKS_ENDPOINT='${var.origin_image_red5pro_webhooks_endpoint}'", "export NODE_ROUND_TRIP_AUTH_ENABLE='${var.origin_image_red5pro_round_trip_auth_enable}'", "export NODE_ROUND_TRIP_AUTH_HOST='${var.origin_image_red5pro_round_trip_auth_host}'", "export NODE_ROUND_TRIP_AUTH_PORT='${var.origin_image_red5pro_round_trip_auth_port}'", @@ -772,6 +774,8 @@ resource "aws_instance" "red5pro_node_edge" { "export NODE_SOCIALPUSHER_ENABLE='${var.edge_image_red5pro_socialpusher_enable}'", "export NODE_SUPPRESSOR_ENABLE='${var.edge_image_red5pro_suppressor_enable}'", "export NODE_HLS_ENABLE='${var.edge_image_red5pro_hls_enable}'", + "export NODE_WEBHOOKS_ENABLE='${var.edge_image_red5pro_webhooks_enable}'", + "export NODE_WEBHOOKS_ENDPOINT='${var.edge_image_red5pro_webhooks_endpoint}'", "export NODE_ROUND_TRIP_AUTH_ENABLE='${var.edge_image_red5pro_round_trip_auth_enable}'", "export NODE_ROUND_TRIP_AUTH_HOST='${var.edge_image_red5pro_round_trip_auth_host}'", "export NODE_ROUND_TRIP_AUTH_PORT='${var.edge_image_red5pro_round_trip_auth_port}'", @@ -846,6 +850,8 @@ resource "aws_instance" "red5pro_node_transcoder" { "export NODE_SOCIALPUSHER_ENABLE='${var.transcoder_image_red5pro_socialpusher_enable}'", "export NODE_SUPPRESSOR_ENABLE='${var.transcoder_image_red5pro_suppressor_enable}'", "export NODE_HLS_ENABLE='${var.transcoder_image_red5pro_hls_enable}'", + "export NODE_WEBHOOKS_ENABLE='${var.transcoder_image_red5pro_webhooks_enable}'", + "export NODE_WEBHOOKS_ENDPOINT='${var.transcoder_image_red5pro_webhooks_endpoint}'", "export NODE_ROUND_TRIP_AUTH_ENABLE='${var.transcoder_image_red5pro_round_trip_auth_enable}'", "export NODE_ROUND_TRIP_AUTH_HOST='${var.transcoder_image_red5pro_round_trip_auth_host}'", "export NODE_ROUND_TRIP_AUTH_PORT='${var.transcoder_image_red5pro_round_trip_auth_port}'", @@ -1008,6 +1014,8 @@ resource "aws_instance" "red5pro_single" { "export NODE_SOCIALPUSHER_ENABLE='${var.red5pro_socialpusher_enable}'", "export NODE_SUPPRESSOR_ENABLE='${var.red5pro_suppressor_enable}'", "export NODE_HLS_ENABLE='${var.red5pro_hls_enable}'", + "export NODE_WEBHOOKS_ENABLE='${var.red5pro_webhooks_enable}'", + "export NODE_WEBHOOKS_ENDPOINT='${var.red5pro_webhooks_endpoint}'", "export NODE_ROUND_TRIP_AUTH_ENABLE='${var.red5pro_round_trip_auth_enable}'", "export NODE_ROUND_TRIP_AUTH_HOST='${var.red5pro_round_trip_auth_host}'", "export NODE_ROUND_TRIP_AUTH_PORT='${var.red5pro_round_trip_auth_port}'", diff --git a/variables.tf b/variables.tf index 5950cff..f11197d 100644 --- a/variables.tf +++ b/variables.tf @@ -142,6 +142,16 @@ variable "red5pro_hls_enable" { type = bool default = false } +variable "red5pro_webhooks_enable" { + description = "Red5 Pro Single server Webhooks enable/disable (https://www.red5.net/docs/special/webhooks/overview/)" + type = bool + default = false +} +variable "red5pro_webhooks_endpoint" { + description = "Red5 Pro Single server Webhooks endpoint" + type = string + default = "" +} variable "red5pro_round_trip_auth_enable" { description = "Round trip authentication on the red5pro server enable/disable - Auth server should be deployed separately (https://www.red5.net/docs/special/round-trip-auth/overview/)" type = bool @@ -394,6 +404,16 @@ variable "origin_image_red5pro_hls_enable" { type = bool default = false } +variable "origin_image_red5pro_webhooks_enable" { + description = "Origin node image - Webhooks enable/disable (https://www.red5.net/docs/special/webhooks/overview/)" + type = bool + default = false +} +variable "origin_image_red5pro_webhooks_endpoint" { + description = "Origin node image - Webhooks endpoint" + type = string + default = "" +} variable "origin_image_red5pro_round_trip_auth_enable" { description = "Origin node image - Round trip authentication on the enable/disable - Auth server should be deployed separately (https://www.red5.net/docs/special/round-trip-auth/overview/)" type = bool @@ -588,6 +608,16 @@ variable "transcoder_image_red5pro_hls_enable" { type = bool default = false } +variable "transcoder_image_red5pro_webhooks_enable" { + description = "Transcoder node image - Webhooks enable/disable (https://www.red5.net/docs/special/webhooks/overview/)" + type = bool + default = false +} +variable "transcoder_image_red5pro_webhooks_endpoint" { + description = "Transcoder node image - Webhooks endpoint" + type = string + default = "" +} variable "transcoder_image_red5pro_round_trip_auth_enable" { description = "Transcoder node image - Round trip authentication on the enable/disable - Auth server should be deployed separately (https://www.red5.net/docs/special/round-trip-auth/overview/)" type = bool From 9dc95b2efd0c6880f54bf5132e769ae6add830ef Mon Sep 17 00:00:00 2001 From: iolesyk Date: Wed, 28 Feb 2024 12:52:19 -0500 Subject: [PATCH 2/6] webhooks - minor fix --- examples/autoscaling/main.tf | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/examples/autoscaling/main.tf b/examples/autoscaling/main.tf index 663f5e2..e00eb64 100644 --- a/examples/autoscaling/main.tf +++ b/examples/autoscaling/main.tf @@ -85,18 +85,6 @@ module "red5pro" { 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 -variable "origin_image_red5pro_webhooks_enable" { - description = "Origin node image - Webhooks enable/disable (https://www.red5.net/docs/special/webhooks/overview/)" - type = bool - default = false -} -variable "origin_image_red5pro_webhooks_endpoint" { - description = "Origin node image - Webhooks endpoint" - type = string - default = "" -} - - # Red5 Pro autoscaling Node group - (Optional) node_group_create = true # Linux or Mac OS only. true - create new Node group, false - not create new Node group node_group_name = "terraform-node-group" # Node group name From 7a16a85d01e2e767a6fc4e1d23bdc588ff26ea1b Mon Sep 17 00:00:00 2001 From: iolesyk Date: Wed, 28 Feb 2024 12:54:13 -0500 Subject: [PATCH 3/6] webhooks - edge --- variables.tf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/variables.tf b/variables.tf index f11197d..11ca1dd 100644 --- a/variables.tf +++ b/variables.tf @@ -536,6 +536,16 @@ variable "edge_image_red5pro_hls_enable" { type = bool default = false } +variable "edge_image_red5pro_hls_enable" { + description = "Edge node image - HLS enable/disable (https://www.red5.net/docs/protocols/hls-plugin/overview/)" + type = bool + default = false +} +variable "edge_image_red5pro_webhooks_enable" { + description = "Edge node image - Webhooks enable/disable (https://www.red5.net/docs/special/webhooks/overview/)" + type = bool + default = false +} variable "edge_image_red5pro_round_trip_auth_enable" { description = "Edge node image - Round trip authentication on the enable/disable - Auth server should be deployed separately (https://www.red5.net/docs/special/round-trip-auth/overview/)" type = bool From 25229386525e404ccf96e656926232fd3e658ca1 Mon Sep 17 00:00:00 2001 From: iolesyk Date: Wed, 28 Feb 2024 12:58:44 -0500 Subject: [PATCH 4/6] webhooks - edge fix --- variables.tf | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/variables.tf b/variables.tf index 11ca1dd..c6e96ba 100644 --- a/variables.tf +++ b/variables.tf @@ -536,16 +536,16 @@ variable "edge_image_red5pro_hls_enable" { type = bool default = false } -variable "edge_image_red5pro_hls_enable" { - description = "Edge node image - HLS enable/disable (https://www.red5.net/docs/protocols/hls-plugin/overview/)" - type = bool - default = false -} variable "edge_image_red5pro_webhooks_enable" { description = "Edge node image - Webhooks enable/disable (https://www.red5.net/docs/special/webhooks/overview/)" type = bool default = false } +variable "edge_image_red5pro_webhooks_endpoint" { + description = "Edge node image - Webhooks endpoint" + type = string + default = "" +} variable "edge_image_red5pro_round_trip_auth_enable" { description = "Edge node image - Round trip authentication on the enable/disable - Auth server should be deployed separately (https://www.red5.net/docs/special/round-trip-auth/overview/)" type = bool From 9ab0349e890018ec68a7cc5a77ec7127698414ed Mon Sep 17 00:00:00 2001 From: iolesyk Date: Wed, 28 Feb 2024 15:52:29 -0500 Subject: [PATCH 5/6] webhooks - fix configuration issue --- red5pro-installer/r5p_config_node_apps_plugins.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/red5pro-installer/r5p_config_node_apps_plugins.sh b/red5pro-installer/r5p_config_node_apps_plugins.sh index 5cf39de..6a20d60 100755 --- a/red5pro-installer/r5p_config_node_apps_plugins.sh +++ b/red5pro-installer/r5p_config_node_apps_plugins.sh @@ -210,6 +210,7 @@ config_node_apps_plugins(){ log_e "Parameter NODE_WEBHOOKS_ENDPOINT is empty. EXIT." exit 1 fi + echo "" >> $RED5_HOME/webapps/live/WEB-INF/red5-web.properties echo "webhooks.endpoint=$NODE_WEBHOOKS_ENDPOINT" >> $RED5_HOME/webapps/live/WEB-INF/red5-web.properties fi ### Red5Pro Round-trip-auth From bf2f592534204e6611bf96b4238fe406fa90f3de Mon Sep 17 00:00:00 2001 From: iolesyk Date: Wed, 28 Feb 2024 19:01:02 -0500 Subject: [PATCH 6/6] HLS configuration, output_format and dvr_playlist --- main.tf | 6 ++++ .../r5p_config_node_apps_plugins.sh | 12 +++++++- variables.tf | 30 +++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 29aeb86..8843677 100644 --- a/main.tf +++ b/main.tf @@ -687,6 +687,8 @@ resource "aws_instance" "red5pro_node_origin" { "export NODE_SOCIALPUSHER_ENABLE='${var.origin_image_red5pro_socialpusher_enable}'", "export NODE_SUPPRESSOR_ENABLE='${var.origin_image_red5pro_suppressor_enable}'", "export NODE_HLS_ENABLE='${var.origin_image_red5pro_hls_enable}'", + "export NODE_HLS_OUTPUT_FORMAT='${var.origin_image_red5pro_hls_output_format}'", + "export NODE_HLS_DVR_PLAYLIST='${var.origin_image_red5pro_hls_dvr_playlist}'", "export NODE_WEBHOOKS_ENABLE='${var.origin_image_red5pro_webhooks_enable}'", "export NODE_WEBHOOKS_ENDPOINT='${var.origin_image_red5pro_webhooks_endpoint}'", "export NODE_ROUND_TRIP_AUTH_ENABLE='${var.origin_image_red5pro_round_trip_auth_enable}'", @@ -850,6 +852,8 @@ resource "aws_instance" "red5pro_node_transcoder" { "export NODE_SOCIALPUSHER_ENABLE='${var.transcoder_image_red5pro_socialpusher_enable}'", "export NODE_SUPPRESSOR_ENABLE='${var.transcoder_image_red5pro_suppressor_enable}'", "export NODE_HLS_ENABLE='${var.transcoder_image_red5pro_hls_enable}'", + "export NODE_HLS_OUTPUT_FORMAT='${var.transcoder_image_red5pro_hls_output_format}'", + "export NODE_HLS_DVR_PLAYLIST='${var.transcoder_image_red5pro_hls_dvr_playlist}'", "export NODE_WEBHOOKS_ENABLE='${var.transcoder_image_red5pro_webhooks_enable}'", "export NODE_WEBHOOKS_ENDPOINT='${var.transcoder_image_red5pro_webhooks_endpoint}'", "export NODE_ROUND_TRIP_AUTH_ENABLE='${var.transcoder_image_red5pro_round_trip_auth_enable}'", @@ -1014,6 +1018,8 @@ resource "aws_instance" "red5pro_single" { "export NODE_SOCIALPUSHER_ENABLE='${var.red5pro_socialpusher_enable}'", "export NODE_SUPPRESSOR_ENABLE='${var.red5pro_suppressor_enable}'", "export NODE_HLS_ENABLE='${var.red5pro_hls_enable}'", + "export NODE_HLS_OUTPUT_FORMAT='${var.red5pro_hls_output_format}'", + "export NODE_HLS_DVR_PLAYLIST='${var.red5pro_hls_dvr_playlist}'", "export NODE_WEBHOOKS_ENABLE='${var.red5pro_webhooks_enable}'", "export NODE_WEBHOOKS_ENDPOINT='${var.red5pro_webhooks_endpoint}'", "export NODE_ROUND_TRIP_AUTH_ENABLE='${var.red5pro_round_trip_auth_enable}'", diff --git a/red5pro-installer/r5p_config_node_apps_plugins.sh b/red5pro-installer/r5p_config_node_apps_plugins.sh index 6a20d60..3e9f4e5 100755 --- a/red5pro-installer/r5p_config_node_apps_plugins.sh +++ b/red5pro-installer/r5p_config_node_apps_plugins.sh @@ -10,6 +10,8 @@ # NODE_SOCIALPUSHER_ENABLE=true # NODE_SUPPRESSOR_ENABLE=true # NODE_HLS_ENABLE=true +# NODE_HLS_OUTPUT_FORMAT=TS #(TS,FMP4,SMP4) +# NODE_HLS_DVR_PLAYLIST=true # NODE_CLOUDSTORAGE_ENABLE=true # NODE_CLOUDSTORAGE_AWS_ACCESS_KEY # NODE_CLOUDSTORAGE_AWS_SECRET_KEY @@ -98,9 +100,17 @@ config_node_apps_plugins(){ rm $RED5_HOME/plugins/inspector.jar fi fi + ### Red5Pro HLS if [[ "$NODE_HLS_ENABLE" == "true" ]]; then - log_i "Red5Pro HLS - enable" + log_i "Red5Pro HLS - enable. Output format: $NODE_HLS_OUTPUT_FORMAT, DVR playlist: $NODE_HLS_DVR_PLAYLIST" + + hls_output_format='' + hls_output_format_new='' + + hls_dvr_playlist='' + hls_dvr_playlist_new='' + sed -i -e "s|$hls_output_format|$hls_output_format_new|" -e "s|$hls_dvr_playlist|$hls_dvr_playlist_new|" "$RED5_HOME/conf/hlsconfig.xml" else log_d "Red5Pro HLS - disable" if ls $RED5_HOME/plugins/red5pro-mpegts-plugin* >/dev/null 2>&1; then diff --git a/variables.tf b/variables.tf index c6e96ba..ec1e94c 100644 --- a/variables.tf +++ b/variables.tf @@ -142,6 +142,16 @@ variable "red5pro_hls_enable" { type = bool default = false } +variable "red5pro_hls_output_format" { + description = "Red5 Pro Single server - HLS output format. Options: TS, FMP4, SMP4" + type = string + default = "TS" +} +variable "red5pro_hls_dvr_playlist" { + description = "Red5 Pro Single server - HLS DVR playlist" + type = string + default = "false" +} variable "red5pro_webhooks_enable" { description = "Red5 Pro Single server Webhooks enable/disable (https://www.red5.net/docs/special/webhooks/overview/)" type = bool @@ -409,6 +419,16 @@ variable "origin_image_red5pro_webhooks_enable" { type = bool default = false } +variable "origin_image_red5pro_hls_output_format" { + description = "Origin node image - HLS output format. Options: TS, FMP4, SMP4" + type = string + default = "TS" +} +variable "origin_image_red5pro_hls_dvr_playlist" { + description = "Origin node image - HLS DVR playlist" + type = string + default = "false" +} variable "origin_image_red5pro_webhooks_endpoint" { description = "Origin node image - Webhooks endpoint" type = string @@ -618,6 +638,16 @@ variable "transcoder_image_red5pro_hls_enable" { type = bool default = false } +variable "transcoder_image_red5pro_hls_output_format" { + description = "Transcoder node image - HLS output format. Options: TS, FMP4, SMP4" + type = string + default = "TS" +} +variable "transcoder_image_red5pro_hls_dvr_playlist" { + description = "Transcoder node image - HLS DVR playlist" + type = string + default = "false" +} variable "transcoder_image_red5pro_webhooks_enable" { description = "Transcoder node image - Webhooks enable/disable (https://www.red5.net/docs/special/webhooks/overview/)" type = bool