Create node group
To communicate with the Stream Manager 2.0 API, you can use the integrated Swagger UI, Postman, or curl from the command line.
Stream Manager 2.0 include OpenAPI/Swagger UI by default, you can find it on the main Stream Manager 2.0 web page https://<STREAM_MANAGER_DOMAIN_NAME>
or using direct url: https://<STREAM_MANAGER_DOMAIN_NAME>/swagger-ui/index.html
.
If you are using Stream Manager 2.0 without an SSL certificate and domain name, use
http://<STREAM_MANAGER_IP_ADDRESS>
instead.
Documentation: Stream Manager 2.0 API Overview.
Get JWT Token
JWT token is used to authenticate and authorize users, ensuring secure access to the API.
- First example using username and password in the URL:
Please do not use this example if you have special characters like
@
in your R5AS_AUTH_USER or R5AS_AUTH_PASS variables.
curl -H "Content-Type: application/json"
-X PUT https://<R5AS_AUTH_USER>:<R5AS_AUTH_PASS>@<STREAM_MANAGER_DOMAIN_NAME>/as/v1/auth/login
- Second example using Base64 encoding for your username and password:
curl -X 'PUT'
'https://<STREAM_MANAGER_DOMAIN_NAME>/as/v1/auth/login'
-H 'accept: application/json'
-H 'Authorization: Basic <USER_AND_PASSWORD_IN_BASE64>'
In this example, you need to replace <USER_AND_PASSWORD_IN_BASE64>
with your Base64-encoded username and password. To generate this encoded string, combine your username and password in the format username:password
, then encode this string using Base64. You can use the following command to encode it:
echo -n 'username:password' | base64
-
R5AS_AUTH_USER
– Authentication user name used to get JWT token. You set this secret in the.env
file during the configuration of Stream Manager 2.0. -
R5AS_AUTH_PASS
– Authentication user password used to get JWT token. You set this secret in the.env
file during the configuration of Stream Manager 2.0. -
Response body
{
"token": "YOUR_JWT_TOKEN"
}
Create Node Group Config
Creating a new node group will immediately begin scaling out Red5 Pro nodes using your configuration.
curl -X POST
'https://<STREAM_MANAGER_DOMAIN_NAME>/as/v1/admin/nodegroup'
--header 'Content-Type: application/json'
--header "Authorization: Bearer <YOUR_JWT_TOKEN>"
--data "@node-group-create.json"
Json node-group-create.json
body:
{
"name": "<NODE_GROUP_NAME>",
"description": "This is an OCI nodegroup example",
"cloudProperties": "environment=example;subnet=<NODE_SUBNET_NAME>;security_group=<NODE_SECURITY_GROUP>;volume_size=50",
"cloudPlatform": "OCI",
"isScalingPaused": false,
"images": {
"base_image": {
"name": "base_image",
"image": "<NODE_IMAGE_NAME>",
"cloudProperties": "instance_type=<NODE_INSTANCE_TYPE>"
}
},
"roles": {
"origin": {
"name": "origin",
"imageName": "base_image",
"capabilities": [
"PUBLISH"
]
},
"edge": {
"name": "edge",
"imageName": "base_image",
"capabilities": [
"SUBSCRIBE"
],
"parentRoleName": "origin",
"parentCardinality": "GLOBAL"
}
},
"groups": {
"<SUB_GROUP_NAME>": {
"subGroupName": "<SUB_GROUP_NAME>",
"nodeGroupName": "<NODE_GROUP_NAME>",
"groupType": "main",
"rulesByRole": {
"origin": {
"nodeGroupName": "<NODE_GROUP_NAME>",
"subGroupName": "<SUB_GROUP_NAME>",
"nodeRoleName": "origin",
"min": 1,
"max": 5,
"increment": 1,
"outExpression": "(avg(connections.client) / 200) * 0.5 + (avg(connections.publisher) / 50) * 0.5 > 1.0",
"inExpression": "avg(connections.client) < 10",
"capacityRankingExpression": "(connections.client / 200) * 10",
"capacityLimitExpression": "10"
},
"edge": {
"nodeGroupName": "<NODE_GROUP_NAME>",
"subGroupName": "<SUB_GROUP_NAME>",
"nodeRoleName": "edge",
"min": 1,
"max": 10,
"increment": 1,
"outExpression": "(avg(connections.client) / 200) * 0.5 + (avg(connections.subscriber) / 50) * 0.5 > 1.0",
"inExpression": "avg(connections.client) < 10",
"capacityRankingExpression": "(connections.client / 200) * 10",
"capacityLimitExpression": "10"
}
},
"cloudProperties": "region=<NODE_OCI_REGION>"
}
},
"internalVersionCount": 0
}
Please replace these variables with the values you recorded in the previous steps:
NODE_GROUP_NAME
– The name of node group. Min 1 char, max 16 chars. Alphanumeric, plus -, _, and .. Must be GLOBALLY unique (no two Node Groups can share the same name) Example:node-group-test
SUB_GROUP_NAME
– The name of this SubGroup. Min 1 char, max 16 chars. Example:sub-group-test
NODE_SUBNET_NAME
– The name of the subnet you created when setting up the network (VCN). Example:red5pro-autoscaling-public-subnet
NODE_SECURITY_GROUP
– The name of the Network Security Group for Red5 Pro nodes, created during the network (VCN) setup. Example:red5pro-autoscaling-node-security-group
NODE_IMAGE_NAME
– The name of the Red5 Pro node instance image you created when preparing the Red5 Pro node image. Example:red5pro-autoscaling-node-image
NODE_OCI_REGION
– The Oracle Cloud region where you deployed your Stream Manager. This is the region where the Stream Manager will create autoscaling Red5 Pro nodes. Example:us-ashburn-1
NODE_INSTANCE_TYPE
– OCI instance shape (Instance Type). Example:VM.Standard.E4.Flex-1-4
(1 OCPU – 2 CPUs and 4GB of memory)
OCI supports Flex instance shapes like VM.Standard.E4
or VM.Standard.E5
. In the node group configuration, you can use this template to set different shape types and amounts of OCPUs and memory: {flex instance shape}-{OCPUs}-{GB Memory}
.
Examples:
NODE_INSTANCE_TYPE | Shape | OCPUs | CPUs | GB memory |
---|---|---|---|---|
VM.Standard.E4.Flex-1-4 | VM.Standard.E4 | 1 | 2 | 4 |
VM.Standard.E4.Flex-2-8 | VM.Standard.E4 | 2 | 4 | 8 |
VM.Standard.E4.Flex-4-16 | VM.Standard.E4 | 4 | 8 | 16 |
VM.Standard.E5.Flex-1-4 | VM.Standard.E5 | 1 | 2 | 4 |
VM.Standard.E5.Flex-2-8 | VM.Standard.E5 | 2 | 4 | 8 |
VM.Standard.E5.Flex-4-16 | VM.Standard.E5 | 4 | 8 | 16 |
This example node group config will create 2 Red5 Pro node instances (origin and edge)
Get node group lists
curl -X 'GET'
'https://<STREAM_MANAGER_DOMAIN_NAME>/as/v1/admin/nodegroup'
-H 'accept: application/json'
-H 'Authorization: Bearer <YOUR_JWT_TOKEN>'
- Response body
[
"<NODE_GROUP_NAME>"
]
Delete node group
curl -X 'DELETE'
'https://<STREAM_MANAGER_DOMAIN_NAME>/as/v1/admin/nodegroup/<NODE_GROUP_NAME>'
-H 'accept: application/json'
-H 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Debug page
Debug UI it is extra web application which can help with checking active node groups, streams, and more using UI interface.
Stream Manager 2.0 includes a Debug UI web page, which you can find on the main Stream Manager 2.0 web page at https://<STREAM_MANAGER_DOMAIN_NAME>
or directly at https://<STREAM_MANAGER_DOMAIN_NAME>/debug/
.