Skip to content

Commit

Permalink
Merge pull request #17 from red5pro/feature/vpc-only
Browse files Browse the repository at this point in the history
Feature/vpc only
  • Loading branch information
iolesyk authored Apr 26, 2024
2 parents facef9d + 680d69a commit b0ee352
Show file tree
Hide file tree
Showing 10 changed files with 471 additions and 325 deletions.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

Terraform Red5 Pro AWS module which create Red5 Pro resources on AWS.

## This module has 3 variants of Red5 Pro deployments
## This module has 4 variants of Red5 Pro deployments

* **single** - Single EC2 instance with installed and configured Red5 Pro server
* **cluster** - Stream Manager cluster (MySQL DB + Stream Manager instance + Autoscaling Node group with Origin, Edge, Transcoder, Relay instances)
* **autoscaling** - Autoscaling Stream Managers (MySQL RDS + Load Balancer + Autoscaling Stream Managers + Autoscaling Node group with Origin, Edge, Transcoder, Relay instances)
* **vpc** - VPC only (VPC, Sunbets, Route table, Internet Gateway) - this option is useful if you need to create VPC separately and after that use this VPC to deploy Red5 Pro resources

---

Expand Down Expand Up @@ -402,6 +403,37 @@ module "red5pro" {
}
```

## AWS VPC create only (vpc) - [Example](https://github.com/red5pro/terraform-aws-red5pro/tree/master/examples/vpc)

* VPC create

## Usage (vpc)
```
provider "aws" {
region = "us-west-1" # AWS region
access_key = "" # AWS IAM Access key
secret_key = "" # AWS IAM Secret key
}
module "red5pro_vpc" {
source = "red5pro/red5pro/aws"
type = "vpc" # Deployment type: single, cluster, autoscaling, vpc
name = "red5pro-vpc" # Name to be used on all the resources as identifier
# VPC configuration
vpc_create = true # true - create new VPC, false - use existing VPC
vpc_cidr_block = "10.105.0.0/16"
vpc_public_subnets = ["10.105.0.0/24", "10.105.1.0/24", "10.105.2.0/24", "10.105.3.0/24"] # Public subnets for Stream Manager and Red5 Pro server instances
# Red5 Pro tags configuration - it will be added to all Red5 Pro resources
tags = {
Terraform = "true"
Environment = "dev"
Project = "red5pro"
}
}
```
---

**NOTES**
Expand Down
158 changes: 79 additions & 79 deletions examples/autoscaling/main.tf

Large diffs are not rendered by default.

166 changes: 83 additions & 83 deletions examples/cluster/main.tf

Large diffs are not rendered by default.

106 changes: 53 additions & 53 deletions examples/single/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,75 +3,75 @@
#################################################

provider "aws" {
region = "us-west-1" # AWS region
access_key = "" # AWS IAM Access key
secret_key = "" # AWS IAM Secret key
region = "us-west-1" # AWS region
access_key = "" # AWS IAM Access key
secret_key = "" # AWS IAM Secret key
}

module "red5pro" {
source = "../../"
source = "../../"

type = "single" # Deployment type: single, cluster, autoscaling
name = "red5pro-single" # Name to be used on all the resources as identifier
type = "single" # Deployment type: single, cluster, autoscaling, vpc
name = "red5pro-single" # Name to be used on all the resources as identifier

ubuntu_version = "22.04" # Ubuntu version for Red5 Pro servers
path_to_red5pro_build = "./red5pro-server-0.0.0.b0-release.zip" # Absolute path or relative path to Red5 Pro server ZIP file
ubuntu_version = "22.04" # Ubuntu version for Red5 Pro servers
path_to_red5pro_build = "./red5pro-server-0.0.0.b0-release.zip" # Absolute path or relative path to Red5 Pro server ZIP file

# SSH key configuration
ssh_key_create = true # true - create new SSH key, false - use existing SSH key
ssh_key_name = "example_key" # Name for new SSH key or for existing SSH key
ssh_private_key_path = "/PATH/TO/EXISTING/SSH/PRIVATE/KEY/example_key.pem" # Path to existing SSH private key

# SSH key configuration
ssh_key_create = true # true - create new SSH key, false - use existing SSH key
ssh_key_name = "example_key" # Name for new SSH key or for existing SSH key
ssh_private_key_path = "/PATH/TO/EXISTING/SSH/PRIVATE/KEY/example_key.pem" # Path to existing SSH private key

# VPC configuration
vpc_create = true # true - create new VPC, false - use existing VPC
vpc_id_existing = "vpc-12345" # VPC ID for existing VPC
vpc_create = true # true - create new VPC, false - use existing VPC
vpc_id_existing = "vpc-12345" # VPC ID for existing VPC

# Security group configuration
security_group_create = true # true - create new security group, false - use existing security group
security_group_id_existing = "sg-12345" # Security group ID for existing security group
security_group_create = true # true - create new security group, false - use existing security group
security_group_id_existing = "sg-12345" # Security group ID for existing security group

# Elastic IP configuration
elastic_ip_create = true # true - create new elastic IP, false - use existing elastic IP
elastic_ip_existing = "1.2.3.4" # Elastic IP for existing elastic IP
elastic_ip_create = true # true - create new elastic IP, false - use existing elastic IP
elastic_ip_existing = "1.2.3.4" # Elastic IP for existing elastic IP

# Single Red5 Pro server HTTPS/SSL certificate configuration
https_letsencrypt_enable = true # true - create new Let's Encrypt HTTPS/SSL certificate, false - use Red5 Pro server without HTTPS/SSL certificate
https_letsencrypt_certificate_domain_name = "red5pro.example.com" # Domain name for Let's Encrypt SSL certificate
https_letsencrypt_certificate_email = "email@example.com" # Email for Let's Encrypt SSL certificate
https_letsencrypt_certificate_password = "examplepass" # Password for Let's Encrypt SSL certificate
https_letsencrypt_enable = true # true - create new Let's Encrypt HTTPS/SSL certificate, false - use Red5 Pro server without HTTPS/SSL certificate
https_letsencrypt_certificate_domain_name = "red5pro.example.com" # Domain name for Let's Encrypt SSL certificate
https_letsencrypt_certificate_email = "email@example.com" # Email for Let's Encrypt SSL certificate
https_letsencrypt_certificate_password = "examplepass" # Password for Let's Encrypt SSL certificate

# Single Red5 Pro server EC2 instance configuration
single_instance_type = "t3.medium" # Instance type for Red5 Pro server
single_volume_size = 8 # Volume size for Red5 Pro server
single_instance_type = "t3.medium" # Instance type for Red5 Pro server
single_volume_size = 8 # Volume size for Red5 Pro server

# Red5Pro server configuration
red5pro_license_key = "1111-2222-3333-4444" # Red5 Pro license key (https://account.red5.net/login)
red5pro_api_enable = true # true - enable Red5 Pro server API, false - disable Red5 Pro server API (https://www.red5.net/docs/development/api/overview/)
red5pro_api_key = "examplekey" # Red5 Pro server API key (https://www.red5.net/docs/development/api/overview/)
red5pro_inspector_enable = false # true - enable Red5 Pro server inspector, false - disable Red5 Pro server inspector (https://www.red5.net/docs/troubleshooting/inspector/overview/)
red5pro_restreamer_enable = false # true - enable Red5 Pro server restreamer, false - disable Red5 Pro server restreamer (https://www.red5.net/docs/special/restreamer/overview/)
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
red5pro_round_trip_auth_protocol = "http" # Round trip authentication server protocol
red5pro_round_trip_auth_endpoint_validate = "/validateCredentials" # Round trip authentication server endpoint for validate
red5pro_round_trip_auth_endpoint_invalidate = "/invalidateCredentials" # Round trip authentication server endpoint for invalidate
red5pro_cloudstorage_enable = false # true - enable Red5 Pro server cloud storage, false - disable Red5 Pro server cloud storage (https://www.red5.net/docs/special/cloudstorage-plugin/aws-s3-cloud-storage/)
red5pro_cloudstorage_aws_access_key = "" # AWS access key for Red5 Pro cloud storage (S3 Bucket)
red5pro_cloudstorage_aws_secret_key = "" # AWS secret key for Red5 Pro cloud storage (S3 Bucket)
red5pro_cloudstorage_aws_bucket_name = "s3-bucket-example-name" # AWS bucket name for Red5 Pro cloud storage (S3 Bucket)
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_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
red5pro_efs_dns_name = "example.efs.region.amazonaws.com" # EFS DNS name
red5pro_license_key = "1111-2222-3333-4444" # Red5 Pro license key (https://account.red5.net/login)
red5pro_api_enable = true # true - enable Red5 Pro server API, false - disable Red5 Pro server API (https://www.red5.net/docs/development/api/overview/)
red5pro_api_key = "examplekey" # Red5 Pro server API key (https://www.red5.net/docs/development/api/overview/)
red5pro_inspector_enable = false # true - enable Red5 Pro server inspector, false - disable Red5 Pro server inspector (https://www.red5.net/docs/troubleshooting/inspector/overview/)
red5pro_restreamer_enable = false # true - enable Red5 Pro server restreamer, false - disable Red5 Pro server restreamer (https://www.red5.net/docs/special/restreamer/overview/)
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
red5pro_round_trip_auth_protocol = "http" # Round trip authentication server protocol
red5pro_round_trip_auth_endpoint_validate = "/validateCredentials" # Round trip authentication server endpoint for validate
red5pro_round_trip_auth_endpoint_invalidate = "/invalidateCredentials" # Round trip authentication server endpoint for invalidate
red5pro_cloudstorage_enable = false # true - enable Red5 Pro server cloud storage, false - disable Red5 Pro server cloud storage (https://www.red5.net/docs/special/cloudstorage-plugin/aws-s3-cloud-storage/)
red5pro_cloudstorage_aws_access_key = "" # AWS access key for Red5 Pro cloud storage (S3 Bucket)
red5pro_cloudstorage_aws_secret_key = "" # AWS secret key for Red5 Pro cloud storage (S3 Bucket)
red5pro_cloudstorage_aws_bucket_name = "s3-bucket-example-name" # AWS bucket name for Red5 Pro cloud storage (S3 Bucket)
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_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
red5pro_efs_dns_name = "example.efs.region.amazonaws.com" # EFS DNS name

# Red5 Pro tags configuration - it will be added to all Red5 Pro resources
tags = {
Expand Down
64 changes: 64 additions & 0 deletions examples/vpc-only/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# AWS Red5 VPC only

This example illustrates how to create a VPC using red5pro module

* VPC create
* Subnets create
* Route table
* Internet Gateway

## Preparation

* Install **terraform** https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli
* Get AWS Access key and AWS Secret key or use existing (AWS IAM - EC2 full access, VPC full access)

## Usage

To run this example you need to execute:

```bash
$ terraform init
$ terraform plan
$ terraform apply
```

## Notes

* To activate HTTPS/SSL you need to add DNS A record for Elastic IP of Red5 Pro server
* Note that this example may create resources which can cost money. Run `terraform destroy` when you don't need these resources.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_red5pro_vpc"></a> [red5pro\_vpc](#module\_red5pro\_vpc) | ../../ | n/a |

## Resources

No resources.

## Inputs

No inputs.

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_subnet_ids"></a> [subnet\_ids](#output\_subnet\_ids) | Subnet IDs |
| <a name="output_vpc_id"></a> [vpc\_id](#output\_vpc\_id) | VPC ID |
| <a name="output_vpc_name"></a> [vpc\_name](#output\_vpc\_name) | VPC Name |
29 changes: 29 additions & 0 deletions examples/vpc-only/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
####################################################################################
# Create new VPC using red5pro module
####################################################################################

provider "aws" {
region = "us-west-1" # AWS region
access_key = "" # AWS IAM Access key
secret_key = "" # AWS IAM Secret key
}

module "red5pro_vpc" {
source = "../../"

type = "vpc" # Deployment type: single, cluster, autoscaling, vpc
name = "red5pro-vpc" # Name to be used on all the resources as identifier

# VPC configuration
vpc_create = true # true - create new VPC, false - use existing VPC
vpc_cidr_block = "10.105.0.0/16"
vpc_public_subnets = ["10.105.0.0/24", "10.105.1.0/24", "10.105.2.0/24", "10.105.3.0/24"] # Public subnets for Stream Manager and Red5 Pro server instances

# Red5 Pro tags configuration - it will be added to all Red5 Pro resources
tags = {
Terraform = "true"
Environment = "dev"
Project = "red5pro"
}
}

12 changes: 12 additions & 0 deletions examples/vpc-only/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
output "vpc_id" {
description = "VPC ID"
value = module.red5pro_vpc.vpc_id
}
output "vpc_name" {
description = "VPC Name"
value = module.red5pro_vpc.vpc_name
}
output "subnet_ids" {
description = "Subnet IDs"
value = module.red5pro_vpc.subnet_ids
}
Empty file added examples/vpc-only/variables.tf
Empty file.
Loading

0 comments on commit b0ee352

Please sign in to comment.