diff --git a/.github/workflows/check-marketplace-jwt-token.yml b/.github/workflows/check-marketplace-jwt-token.yml new file mode 100644 index 00000000..18fbcfb5 --- /dev/null +++ b/.github/workflows/check-marketplace-jwt-token.yml @@ -0,0 +1,57 @@ +name: Marketplace SSL Test + +#run tests on schedule because we don't want to generate a subdomain everytime +on: + schedule: + - cron: '0 0 * * 1' + + + +jobs: + run_build: + name: Marketplace SSL Test + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Run enable_ssl.sh for marketplace + uses: appleboy/ssh-action@master + with: + #OVH_REMOTE_HOST has marketplace version deployed + host: ${{ secrets.OVH_REMOTE_HOST }} + username: ${{ secrets.OVH_REMOTE_USERNAME }} + key: ${{ secrets.OVH_SSH_PRIVATE_KEY }} + port: ${{ secrets.OVH_REMOTE_PORT }} + # If the version is not marketplace, following enable_ssl.sh script fails + script: | + SECRET_KEY=$(openssl rand -base64 32 | head -c 32) + sudo sed -i "/^server.jwtServerControlEnabled=/s|.*|server.jwtServerControlEnabled=true|" /usr/local/antmedia/conf/red5.properties + sudo sed -i "/^server.jwtServerSecretKey=/s|.*|server.jwtServerSecretKey=$SECRET_KEY|" /usr/local/antmedia/conf/red5.properties + sudo service antmedia restart + sleep 20 + OUTPUT=$(sudo bash /usr/local/antmedia/enable_ssl.sh) + echo "OUTPUT -> $OUTPUT"; + HTTPS_URL=$(echo "$OUTPUT" | grep 'You can use this url: '| grep -o 'https://[^ ]*') + echo "HTTPS_URL -> $HTTPS_URL" + sleep 20 + status_code=$(curl -o /dev/null -s -I -w "%{http_code}" "$HTTPS_URL") + if [ "$status_code" -eq 200 ]; then + echo "URL($HTTPS_URL) is working: $status_code" + else + echo "URL($HTTPS_URL) is not working: $status_code" + exit 1; + fi + + + - name: Run enable_ssl.sh for existing domain + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.OVH_REMOTE_HOST }} + username: ${{ secrets.OVH_REMOTE_USERNAME }} + key: ${{ secrets.OVH_SSH_PRIVATE_KEY }} + port: ${{ secrets.OVH_REMOTE_PORT }} + #restore the old domain to not encounter any issue + script: | + sudo bash /usr/local/antmedia/enable_ssl.sh -d ${{ secrets.OVH_REMOTE_HOST }} diff --git a/.github/workflows/install-latest-snapshot-to-ubuntu-24-04.yml b/.github/workflows/install-latest-snapshot-to-ubuntu-24-04.yml new file mode 100644 index 00000000..1cda503c --- /dev/null +++ b/.github/workflows/install-latest-snapshot-to-ubuntu-24-04.yml @@ -0,0 +1,27 @@ +name: Install Latest Snapshot to Ubuntu 24.04 +#on: [push] + +jobs: + Install-Ubuntu-24-04: + runs-on: ubuntu-24.04 + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + + - run: wget -O maven-metadata.xml https://oss.sonatype.org/service/local/repositories/snapshots/content/io/antmedia/ant-media-server/maven-metadata.xml + #Get latest snapshot + - run: | + export LATEST_SNAPSHOT=$(cat maven-metadata.xml | grep "" | tail -n 1 | xargs | cut -c 10-23) + echo $LATEST_SNAPSHOT + wget -O ant-media-server-community.zip "https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=io.antmedia&a=ant-media-server&v=${LATEST_SNAPSHOT}&c=community&e=zip"; + - run: ./install_ant-media-server.sh -i ant-media-server-community.zip + - run: sudo service antmedia status + - run: sleep 30 + - run: cat /usr/local/antmedia/log/ant-media-server.log + - run: | + if [ $(cat /usr/local/antmedia/log/ant-media-server.log | grep "LiveApp started" | wc -l | xargs) -eq 0 ]; then + echo "LiveApp started log does not exist. Check the logs above" + exit 1; + fi; + - run: cat /usr/local/antmedia/log/antmedia-error.log diff --git a/.github/workflows/install-latest-to-ubuntu-22-04.yml b/.github/workflows/install-latest-to-ubuntu-22-04.yml index 665d6780..6709c9c4 100644 --- a/.github/workflows/install-latest-to-ubuntu-22-04.yml +++ b/.github/workflows/install-latest-to-ubuntu-22-04.yml @@ -42,7 +42,7 @@ jobs: uses: actions/checkout@v3 - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." #Get latest version - - run: ./install_ant-media-server.sh -l"${{ secrets.ENTERPRISE_LICENSE }}" + - run: bash -x ./install_ant-media-server.sh -l"${{ secrets.ENTERPRISE_LICENSE }}" - run: sleep 30 - run: cat /usr/local/antmedia/log/ant-media-server.log - run: | diff --git a/.github/workflows/install-latest-to-ubuntu-24-04.yml b/.github/workflows/install-latest-to-ubuntu-24-04.yml new file mode 100644 index 00000000..9ca05277 --- /dev/null +++ b/.github/workflows/install-latest-to-ubuntu-24-04.yml @@ -0,0 +1,53 @@ +name: Install Latest to Ubuntu 24.04 +#on: [push] + +jobs: + Install-Ubuntu-24-04: + runs-on: ubuntu-24.04 + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + #Get latest version + - run: curl -L -o ant-media-server-community.zip $(curl -s https://api.github.com/repos/ant-media/Ant-Media-Server/releases/latest | grep "browser_download_url" | cut -d '"' -f 4) + - run: ./install_ant-media-server.sh -i ant-media-server-community.zip + - run: sleep 30 + - run: cat /usr/local/antmedia/log/ant-media-server.log + - run: | + if [ $(cat /usr/local/antmedia/log/ant-media-server.log | grep "LiveApp started" | wc -l | xargs) -eq 0 ]; then + echo "LiveApp started log does not exist. Check the logs above" + exit 1; + fi; + - run: cat /usr/local/antmedia/log/antmedia-error.log + Auto-Install-Community-: + runs-on: ubuntu-24.04 + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + #Get latest version + - run: ./install_ant-media-server.sh + - run: sleep 30 + - run: cat /usr/local/antmedia/log/ant-media-server.log + - run: | + if [ $(cat /usr/local/antmedia/log/ant-media-server.log | grep "LiveApp started" | wc -l | xargs) -eq 0 ]; then + echo "LiveApp started log does not exist. Check the logs above" + exit 1; + fi; + - run: cat /usr/local/antmedia/log/antmedia-error.log + Auto-Install-Enterprise-: + runs-on: ubuntu-24.04 + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." + #Get latest version + - run: bash -x ./install_ant-media-server.sh -l"${{ secrets.ENTERPRISE_LICENSE }}" + - run: sleep 30 + - run: cat /usr/local/antmedia/log/ant-media-server.log + - run: | + if [ $(cat /usr/local/antmedia/log/ant-media-server.log | grep "LiveApp started" | wc -l | xargs) -eq 0 ]; then + echo "LiveApp started log does not exist. Check the logs above" + exit 1; + fi; + - run: cat /usr/local/antmedia/log/antmedia-error.log diff --git a/.github/workflows/upgrade-sh-validation.yml b/.github/workflows/upgrade-sh-validation.yml new file mode 100644 index 00000000..7620bf16 --- /dev/null +++ b/.github/workflows/upgrade-sh-validation.yml @@ -0,0 +1,31 @@ +name: upgrade.sh Validation Test +on: [push] + +jobs: + install_and_upgrade_ant_media_server: + runs-on: ubuntu-latest + name: Install Previous Version of Ant Media Server + steps: + - name: Check out repository code + uses: actions/checkout@v3 + - name: Install Ant Media Server + run: | + curl --progress-bar -o ams_community.zip -L "$(curl -s -H "Accept: application/vnd.github+json" https://api.github.com/repos/ant-media/Ant-Media-Server/releases | jq -r '.[1].assets[0].browser_download_url')" + wget https://raw.githubusercontent.com/ant-media/Scripts/master/install_ant-media-server.sh + sudo bash ./install_ant-media-server.sh -i ams_community.zip + sleep 30 + PREVIOUS_VERSION=$(unzip -p /usr/local/antmedia/ant-media-server.jar | grep -a "Implementation-Version"|cut -d' ' -f2 | tr -d '\r') + echo "Previous Version: $PREVIOUS_VERSION" + wget https://raw.githubusercontent.com/ant-media/Ant-Media-Server/master/src/main/server/upgrade.sh + DIR='/usr/local/antmedia/' sudo bash ./upgrade.sh + sleep 20 + wget http://localhost:5080 -O index.html + CURRENT_VERSION=$(unzip -p /usr/local/antmedia/ant-media-server.jar | grep -a "Implementation-Version"|cut -d' ' -f2 | tr -d '\r') + (if [ "$(printf "%s\n" "$PREVIOUS_VERSION" "$CURRENT_VERSION" | sort -V | tail -n 1)" = "$PREVIOUS_VERSION" ]; + then + echo "It's not upgraded to the latest release.PREVIOUS_VERSION-> $PREVIOUS_VERSION and CURRENT_VERSION-> $CURRENT_VERSION "; + exit 1; + elif [ "$VERSION_PREVIOUS_THAN_LATEST_RELEASE" != "$CURRENT_VERSION" ]; then + echo "Version upgraded to the latest release -> from PREVIOUS_VERSION-> $PREVIOUS_VERSION to CURRENT_VERSION->$CURRENT_VERSION "; + fi) + diff --git a/azure-arm-template/antmedia-azure-autoscale.yaml b/azure-arm-template/antmedia-azure-autoscale.yaml new file mode 100644 index 00000000..6319e36a --- /dev/null +++ b/azure-arm-template/antmedia-azure-autoscale.yaml @@ -0,0 +1,861 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "projectName": { + "defaultValue": "antmedia-cluster", + "type": "String" + }, + "OriginInstanceCapacity": { + "type": "int", + "defaultValue": 1, + "metadata": { + "description": "Number of VM instances (100 or less)." + }, + "minValue": 1, + "maxValue": 100 + }, + "OriginInstanceType": { + "type": "string", + "defaultValue": "Standard_F2s_v2", + "metadata": { + "description": "Size of Origin VMs in the VM Scale Set." + } + }, + "EdgeInstanceCapacity": { + "type": "int", + "defaultValue": 2, + "metadata": { + "description": "Number of VM instances (100 or less)." + }, + "minValue": 1, + "maxValue": 100 + }, + "EdgeInstanceType": { + "type": "string", + "defaultValue": "Standard_F4s_v2", + "metadata": { + "description": "Type of Edge VMs in the VM Scale Set." + } + }, + "CPUPolicyTargetValue": { + "type": "int", + "defaultValue": 60, + "metadata": { + "description": "This parameter for creates new Instances when CPU load exceed to %60." + } + }, + "MongoDBInstanceType": { + "defaultValue": "Standard_D2s_v3", + "type": "String", + "metadata": { + "description": "The instance type of the MongoDB Instance" + } + }, + "certData": { + "type": "securestring", + "metadata": { + "description": "Base-64 encoded form of the .pfx file" + } + }, + "certPassword": { + "type": "securestring", + "metadata": { + "description": "Password for .pfx certificate" + } + }, + "InstanceUsername": { + "type": "String", + "metadata": { + "description": "Username for the Virtual Machine." + } + }, + "authenticationType": { + "defaultValue": "password", + "allowedValues": [ + "sshPublicKey", + "password" + ], + "type": "String", + "metadata": { + "description": "Type of authentication to use on the Virtual Machine. SSH key is recommended." + } + }, + "InstancePassword": { + "type": "SecureString", + "metadata": { + "description": "SSH Key or password for the Virtual Machine. SSH key is recommended." + } + } + }, + "variables": { + "publicIPAddressName": "[concat(parameters('projectName'), '-ip')]", + "appGwPublicIPAddressName": "app-gw-ip", + "osDiskType": "Standard_LRS", + "applicationGateWayName": "antmedia-app-gw", + "virtualNetworks_antmedia_cluster_vnet_name": "antmedia-cluster-vnet", + + "linuxConfiguration": { + "disablePasswordAuthentication": true, + "ssh": { + "publicKeys": [ + { + "path": "[format('/home/{0}/.ssh/authorized_keys', parameters('InstanceUsername'))]", + "keyData": "[parameters('InstancePassword')]" + } + ] + } + } + }, + "resources": [ + { + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2023-09-01", + "name": "[variables('virtualNetworks_antmedia_cluster_vnet_name')]", + "location": "[resourceGroup().location]", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "10.0.0.0/16" + ] + }, + "encryption": { + "enabled": false, + "enforcement": "AllowUnencrypted" + }, + "subnets": [ + { + "name": "origin", + "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworks_antmedia_cluster_vnet_name'), 'origin')]", + "properties": { + "addressPrefixes": [ + "10.0.1.0/24" + ], + "delegations": [], + "privateEndpointNetworkPolicies": "Disabled", + "privateLinkServiceNetworkPolicies": "Enabled" + }, + "type": "Microsoft.Network/virtualNetworks/subnets" + }, + { + "name": "edge", + "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworks_antmedia_cluster_vnet_name'), 'edge')]", + "properties": { + "addressPrefixes": [ + "10.0.2.0/24" + ], + "delegations": [], + "privateEndpointNetworkPolicies": "Disabled", + "privateLinkServiceNetworkPolicies": "Enabled" + }, + "type": "Microsoft.Network/virtualNetworks/subnets" + }, + { + "name": "app-gw", + "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworks_antmedia_cluster_vnet_name'), 'app-gw')]", + "properties": { + "addressPrefixes": [ + "10.0.0.0/24" + ], + "delegations": [], + "privateEndpointNetworkPolicies": "Disabled", + "privateLinkServiceNetworkPolicies": "Enabled" + }, + "type": "Microsoft.Network/virtualNetworks/subnets" + } + ], + "virtualNetworkPeerings": [], + "enableDdosProtection": false + } + }, + { + "type": "Microsoft.Network/networkSecurityGroups", + "apiVersion": "2020-05-01", + "name": "MongoDB-Security-Group", + "location": "[resourceGroup().location]", + "properties": { + "securityRules": [ + { + "name": "ssh_rule", + "properties": { + "description": "Locks inbound down to ssh default port 22.", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "22", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 100, + "direction": "Inbound" + } + }, + { + "name": "mongodb_rule", + "properties": { + "description": "Locks inbound down to MongoDB default port 27017.", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "27017", + "sourceAddressPrefix": "10.0.0.0/16", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 101, + "direction": "Inbound" + } + } + ] + } + }, + { + "type": "Microsoft.Network/networkSecurityGroups", + "apiVersion": "2020-05-01", + "name": "AMSScaleSet-Security-Group", + "location": "[resourceGroup().location]", + "properties": { + "securityRules": [ + { + "name": "ssh_rule", + "properties": { + "description": "Locks inbound down to ssh default port 22.", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "22", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 100, + "direction": "Inbound" + } + }, + { + "name": "cluster_rule1", + "properties": { + "description": "Locks inbound down to Cluster default port 5000.", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "5000", + "sourceAddressPrefix": "10.0.0.0/16", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 101, + "direction": "Inbound" + } + }, + { + "name": "cluster_rule2", + "properties": { + "description": "Locks inbound down to Cluster default port 1935.", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "1935", + "sourceAddressPrefix": "0.0.0.0/0", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 102, + "direction": "Inbound" + } + }, + { + "name": "cluster_rule3", + "properties": { + "description": "Locks inbound down to Cluster default port 5080.", + "protocol": "Tcp", + "sourcePortRange": "*", + "destinationPortRange": "5080", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 103, + "direction": "Inbound" + } + }, + { + "name": "cluster_rule4", + "properties": { + "description": "Locks inbound down to Cluster default port 50000-60000.", + "protocol": "Udp", + "sourcePortRange": "*", + "destinationPortRange": "50000-60000", + "sourceAddressPrefix": "*", + "destinationAddressPrefix": "*", + "access": "Allow", + "priority": 104, + "direction": "Inbound" + } + } + ] + } + }, + { + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('appGwPublicIPAddressName')]", + "location": "[resourceGroup().location]", + "apiVersion": "2020-06-01", + "sku": { + "name": "Standard" + }, + "properties": { + "publicIPAllocationMethod": "Static" + } + }, + { + "type": "Microsoft.Network/publicIPAddresses", + "apiVersion": "2020-05-01", + "name": "[variables('publicIPAddressName')]", + "location": "[resourceGroup().location]", + "sku": { + "name": "Basic" + }, + "properties": { + "publicIPAllocationMethod": "Dynamic" + } + }, + { + "type": "Microsoft.Network/virtualNetworks/subnets", + "apiVersion": "2023-09-01", + "name": "[concat(variables('virtualNetworks_antmedia_cluster_vnet_name'), '/app-gw')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworks_antmedia_cluster_vnet_name'), 'origin')]" + ], + "properties": { + "addressPrefixes": [ + "10.0.0.0/24" + ], + "delegations": [], + "privateEndpointNetworkPolicies": "Disabled", + "privateLinkServiceNetworkPolicies": "Enabled" + } + }, + { + "type": "Microsoft.Network/virtualNetworks/subnets", + "apiVersion": "2023-09-01", + "name": "[concat(variables('virtualNetworks_antmedia_cluster_vnet_name'), '/edge')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworks_antmedia_cluster_vnet_name'), 'origin')]" + ], + "properties": { + "addressPrefixes": [ + "10.0.2.0/24" + ], + "delegations": [], + "privateEndpointNetworkPolicies": "Disabled", + "privateLinkServiceNetworkPolicies": "Enabled" + } + }, + { + "type": "Microsoft.Network/virtualNetworks/subnets", + "apiVersion": "2023-09-01", + "name": "[concat(variables('virtualNetworks_antmedia_cluster_vnet_name'), '/origin')]", + "dependsOn": [ + "[resourceId('Microsoft.Network/virtualNetworks', variables('virtualNetworks_antmedia_cluster_vnet_name'))]" + ], + "properties": { + "addressPrefixes": [ + "10.0.1.0/24" + ], + "delegations": [], + "privateEndpointNetworkPolicies": "Disabled", + "privateLinkServiceNetworkPolicies": "Enabled" + } + }, + { + "type": "Microsoft.Network/applicationGateways", + "apiVersion": "2021-05-01", + "name": "[variables('applicationGateWayName')]", + "location": "[resourceGroup().location]", + "properties": { + "sku": { + "name": "Standard_v2", + "tier": "Standard_v2" + }, + "sslCertificates": [ + { + "name": "appGatewaySslCert", + "properties": { + "data": "[parameters('certData')]", + "password": "[parameters('certPassword')]" + } + } + ], + "gatewayIPConfigurations": [ + { + "name": "appGatewayIpConfig", + "properties": { + "subnet": { + "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworks_antmedia_cluster_vnet_name'), 'app-gw')]" + } + } + } + ], + "frontendIPConfigurations": [ + { + "name": "appGwPublicFrontendIp", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('appGwPublicIPAddressName'))]" + } + } + } + ], + "frontendPorts": [ + { + "name": "port_443", + "properties": { + "port": 443 + } + }, + { + "name": "port_5443", + "properties": { + "port": 5443 + } + } + ], + "backendAddressPools": [ + { + "name": "OriginBackendPool", + "properties": {} + }, + { + "name": "EdgeBackendPool", + "properties": {} + } + ], + "backendHttpSettingsCollection": [ + { + "name": "myHTTPSetting", + "properties": { + "port": 5080, + "protocol": "Http", + "cookieBasedAffinity": "Disabled", + "pickHostNameFromBackendAddress": false, + "requestTimeout": 20 + } + } + ], + "httpListeners": [ + { + "name": "443Listener", + "properties": { + "frontendIPConfiguration": { + "id": "[resourceId('Microsoft.Network/applicationGateways/frontendIPConfigurations', variables('applicationGateWayName'), 'appGwPublicFrontendIp')]" + }, + "frontendPort": { + "id": "[resourceId('Microsoft.Network/applicationGateways/frontendPorts', variables('applicationGateWayName'), 'port_443')]" + }, + "Protocol": "Https", + "SslCertificate": { + "Id": "[resourceId('Microsoft.Network/applicationGateways/sslCertificates',variables('applicationGatewayName'), 'appGatewaySslCert')]" + } + } + }, + { + "name": "5443Listener", + "properties": { + "frontendIPConfiguration": { + "id": "[resourceId('Microsoft.Network/applicationGateways/frontendIPConfigurations', variables('applicationGateWayName'), 'appGwPublicFrontendIp')]" + }, + "frontendPort": { + "id": "[resourceId('Microsoft.Network/applicationGateways/frontendPorts', variables('applicationGateWayName'), 'port_5443')]" + }, + "Protocol": "Https", + "SslCertificate": { + "Id": "[resourceId('Microsoft.Network/applicationGateways/sslCertificates',variables('applicationGatewayName'), 'appGatewaySslCert')]" + } + } + } + ], + "requestRoutingRules": [ + { + "name": "443RoutingRule", + "properties": { + "ruleType": "Basic", + "httpListener": { + "id": "[resourceId('Microsoft.Network/applicationGateways/httpListeners', variables('applicationGateWayName'), '443Listener')]" + }, + "backendAddressPool": { + "id": "[resourceId('Microsoft.Network/applicationGateways/backendAddressPools', variables('applicationGateWayName'), 'OriginBackendPool')]" + }, + "backendHttpSettings": { + "id": "[resourceId('Microsoft.Network/applicationGateways/backendHttpSettingsCollection', variables('applicationGateWayName'), 'myHTTPSetting')]" + } + } + }, + { + "name": "5443RoutingRule", + "properties": { + "ruleType": "Basic", + "httpListener": { + "id": "[resourceId('Microsoft.Network/applicationGateways/httpListeners', variables('applicationGateWayName'), '5443Listener')]" + }, + "backendAddressPool": { + "id": "[resourceId('Microsoft.Network/applicationGateways/backendAddressPools', variables('applicationGateWayName'), 'EdgeBackendPool')]" + }, + "backendHttpSettings": { + "id": "[resourceId('Microsoft.Network/applicationGateways/backendHttpSettingsCollection', variables('applicationGateWayName'), 'myHTTPSetting')]" + } + } + } + ], + "enableHttp2": false, + "autoscaleConfiguration": { + "minCapacity": 0, + "maxCapacity": 10 + } + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses', variables('appGwPublicIPAddressName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworks_antmedia_cluster_vnet_name'), 'app-gw')]", + "[resourceId('Microsoft.Compute/virtualMachines', 'antmedia-mongodb')]" + ] + }, + { + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2023-09-01", + "name": "antmedia-mongodb", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworks_antmedia_cluster_vnet_name'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups', 'MongoDB-Security-Group')]", + "[resourceId('Microsoft.Network/networkInterfaces', 'antmedia-mongodb-NIC')]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('MongoDBInstanceType')]" + }, + "storageProfile": { + "osDisk": { + "createOption": "FromImage", + "managedDisk": { + "storageAccountType": "[variables('osDiskType')]" + } + }, + "imageReference": { + "publisher": "Canonical", + "offer": "0001-com-ubuntu-server-jammy", + "sku": "22_04-lts-gen2", + "version": "latest" + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', 'antmedia-mongodb-NIC')]" + } + ] + }, + "osProfile": { + "computerName": "antmedia-mongodb", + "adminUsername": "[parameters('InstanceUsername')]", + "adminPassword": "[parameters('InstancePassword')]", + "linuxConfiguration": "[if(equals(parameters('authenticationType'), 'password'), null(), variables('linuxConfiguration'))]", + "customData": "[base64('#!/bin/bash\nwget -O install_mongodb.sh https://raw.githubusercontent.com/ant-media/Scripts/master/install_mongodb.sh\nchmod +x install_mongodb.sh\n./install_mongodb.sh')]" + + } + } + }, + { + "type": "Microsoft.Network/networkInterfaces", + "apiVersion": "2023-09-01", + "name": "antmedia-mongodb-NIC", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworks_antmedia_cluster_vnet_name'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups', 'MongoDB-Security-Group')]" + + ], + "properties": { + "ipConfigurations": [ + { + "name": "antmedia-mongodb-IPConfig", + "properties": { + "privateIPAllocationMethod": "Static", + "privateIPAddress": "10.0.1.99", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]" + }, + "subnet": { + "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworks_antmedia_cluster_vnet_name'), 'origin')]" + } + } + } + ], + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', 'MongoDB-Security-Group')]" + } + } + }, + { + "type": "Microsoft.Compute/virtualMachineScaleSets", + "apiVersion": "2023-03-01", + "name": "antmedia-origin", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityGroups', 'AMSScaleSet-Security-Group')]", + "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworks_antmedia_cluster_vnet_name'))]", + "[resourceId('Microsoft.Network/applicationGateways/', variables('applicationGateWayName'))]" + + ], + "sku": { + "name": "[parameters('OriginInstanceType')]", + "tier": "Standard", + "capacity": "[parameters('OriginInstanceCapacity')]" + }, + "plan": { + "name": "enterprise_edition", + "product": "ant_media_server_enterprise", + "publisher": "antmedia" + }, + "properties": { + "platformFaultDomainCount": 1, + "singlePlacementGroup": false, + "orchestrationMode": "Flexible", + "virtualMachineProfile": { + "osProfile": { + "computerNamePrefix": "antmedia-", + "adminUsername": "[parameters('InstanceUsername')]", + "adminPassword": "[parameters('InstancePassword')]", + "linuxConfiguration": "[if(equals(parameters('authenticationType'), 'password'), null(), variables('linuxConfiguration'))]", + "customData": "[base64('#!/bin/bash\nsudo sed -i \"/org.apache.catalina.valves.RemoteIpValve/d\" /usr/local/antmedia/conf/jee-container.xml\n/usr/local/antmedia/change_server_mode.sh cluster 10.0.1.99')]" + }, + "storageProfile": { + "osDisk": { + "createOption": "FromImage", + "managedDisk": { + "storageAccountType": "Premium_LRS" + } + }, + "imageReference": { + "publisher": "antmedia", + "offer": "ant_media_server_enterprise", + "sku": "enterprise_edition", + "version": "latest" + } + }, + "networkProfile": { + "networkApiVersion": "2020-11-01", + "networkInterfaceConfigurations": [ + { + "name": "nicConfig", + "properties": { + "primary": true, + "ipConfigurations": [ + { + "name": "antmedia-cluster-vnet-nic01-defaultIpConfiguration", + "properties": { + "privateIPAddressVersion": "IPv4", + "subnet": { + "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworks_antmedia_cluster_vnet_name'), 'origin')]" + }, + "applicationGatewayBackendAddressPools": [ + { + "id": "[resourceId('Microsoft.Network/applicationGateways/backendAddressPools', variables('applicationGateWayName'), 'OriginBackendPool')]" + } + ], + "primary": true, + "publicIPAddressConfiguration": { + "name": "publicIp-antmedia-cluster-vnet-nic01", + "properties": { + "idleTimeoutInMinutes": 15, + "ipTags": [], + "publicIPAddressVersion": "IPv4" + } + } + } + } + ], + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', 'AMSScaleSet-Security-Group')]" + } + } + } + ] + } + } + } + }, + + { + "type": "Microsoft.Insights/autoscaleSettings", + "apiVersion": "2022-10-01", + "name": "AMSScaleSetAutoscaleSettings-Origin", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Compute/virtualMachineScaleSets', 'antmedia-origin')]" + ], + "properties": { + "name": "AMSScaleSetAutoscaleSettings-Origin", + "targetResourceUri": "[resourceId('Microsoft.Compute/virtualMachineScaleSets', 'antmedia-origin')]", + "enabled": true, + "profiles": [ + { + "name": "DefaultProfile", + "capacity": { + "minimum": "[parameters('EdgeInstanceCapacity')]", + "maximum": "10", + "default": "[parameters('EdgeInstanceCapacity')]" + }, + "rules": [ + { + "metricTrigger": { + "metricName": "Percentage CPU", + "metricNamespace": "", + "metricResourceUri": "[resourceId('Microsoft.Compute/virtualMachineScaleSets', 'antmedia-origin')]", + "timeGrain": "PT1M", + "statistic": "Average", + "timeWindow": "PT5M", + "timeAggregation": "Average", + "operator": "GreaterThan", + "threshold": "[parameters('CPUPolicyTargetValue')]" + }, + "scaleAction": { + "direction": "Increase", + "type": "ChangeCount", + "value": "1", + "cooldown": "PT5M" + } + } + ] + } + ] + } + }, + + { + "type": "Microsoft.Compute/virtualMachineScaleSets", + "apiVersion": "2023-03-01", + "name": "antmedia-edge", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Network/networkSecurityGroups', 'AMSScaleSet-Security-Group')]", + "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworks_antmedia_cluster_vnet_name'))]", + "[resourceId('Microsoft.Network/applicationGateways/', variables('applicationGateWayName'))]" + + + ], + "sku": { + "name": "[parameters('EdgeInstanceType')]", + "tier": "Standard", + "capacity": "[parameters('EdgeInstanceCapacity')]" + }, + "plan": { + "name": "enterprise_edition", + "product": "ant_media_server_enterprise", + "publisher": "antmedia" + }, + "properties": { + "platformFaultDomainCount": 1, + "singlePlacementGroup": false, + "orchestrationMode": "Flexible", + "virtualMachineProfile": { + "osProfile": { + "computerNamePrefix": "antmedia-", + "adminUsername": "[parameters('InstanceUsername')]", + "adminPassword": "[parameters('InstancePassword')]", + "linuxConfiguration": "[if(equals(parameters('authenticationType'), 'password'), null(), variables('linuxConfiguration'))]", + "customData": "[base64('#!/bin/bash\nsudo sed -i \"/org.apache.catalina.valves.RemoteIpValve/d\" /usr/local/antmedia/conf/jee-container.xml\n/usr/local/antmedia/change_server_mode.sh cluster 10.0.1.99')]" + }, + "storageProfile": { + "osDisk": { + "createOption": "FromImage", + "managedDisk": { + "storageAccountType": "Premium_LRS" + } + }, + "imageReference": { + "publisher": "antmedia", + "offer": "ant_media_server_enterprise", + "sku": "enterprise_edition", + "version": "latest" + } + }, + "networkProfile": { + "networkApiVersion": "2020-11-01", + "networkInterfaceConfigurations": [ + { + "name": "nicConfig", + "properties": { + "primary": true, + "ipConfigurations": [ + { + "name": "antmedia-cluster-vnet-nic01-defaultIpConfiguration", + "properties": { + "privateIPAddressVersion": "IPv4", + "subnet": { + "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworks_antmedia_cluster_vnet_name'), 'edge')]" + }, + "applicationGatewayBackendAddressPools": [ + { + "id": "[resourceId('Microsoft.Network/applicationGateways/backendAddressPools', variables('applicationGateWayName'), 'EdgeBackendPool')]" + } + ], + "primary": true, + "publicIPAddressConfiguration": { + "name": "publicIp-antmedia-cluster-vnet-nic01", + "properties": { + "idleTimeoutInMinutes": 15, + "ipTags": [], + "publicIPAddressVersion": "IPv4" + } + } + } + } + ], + "networkSecurityGroup": { + "id": "[resourceId('Microsoft.Network/networkSecurityGroups', 'AMSScaleSet-Security-Group')]" + } + } + } + ] + } + } + } + }, + { + "type": "Microsoft.Insights/autoscaleSettings", + "apiVersion": "2022-10-01", + "name": "AMSScaleSetAutoscaleSettings-Edge", + "location": "[resourceGroup().location]", + "dependsOn": [ + "[resourceId('Microsoft.Compute/virtualMachineScaleSets', 'antmedia-edge')]" + ], + "properties": { + "name": "AMSScaleSetAutoscaleSettings-Edge", + "targetResourceUri": "[resourceId('Microsoft.Compute/virtualMachineScaleSets', 'antmedia-edge')]", + "enabled": true, + "profiles": [ + { + "name": "DefaultProfile", + "capacity": { + "minimum": "[parameters('EdgeInstanceCapacity')]", + "maximum": "10", + "default": "[parameters('EdgeInstanceCapacity')]" + }, + "rules": [ + { + "metricTrigger": { + "metricName": "Percentage CPU", + "metricNamespace": "", + "metricResourceUri": "[resourceId('Microsoft.Compute/virtualMachineScaleSets', 'antmedia-edge')]", + "timeGrain": "PT1M", + "statistic": "Average", + "timeWindow": "PT5M", + "timeAggregation": "Average", + "operator": "GreaterThan", + "threshold": 60 + }, + "scaleAction": { + "direction": "Increase", + "type": "ChangeCount", + "value": "1", + "cooldown": "PT5M" + } + } + ] + } + ] + } + } + ] +} diff --git a/cloudformation/antmedia-aws-autoscale-template.yaml b/cloudformation/antmedia-aws-autoscale-template.yaml index 744d747f..66ee6c40 100644 --- a/cloudformation/antmedia-aws-autoscale-template.yaml +++ b/cloudformation/antmedia-aws-autoscale-template.yaml @@ -4,7 +4,7 @@ Description: >- If you have any questions, please just drop a line to contact (at) antmedia.io Parameters: VpcCidrBlock: - Description: 'CIDR value for Wavelength Network' + Description: 'CIDR value for Network' Type: String MinLength: '9' MaxLength: '18' @@ -143,6 +143,25 @@ Parameters: - r3.2xlarge - r3.4xlarge - r3.8xlarge + - p2.xlarge + - p2.8xlarge + - p2.16xlarge + - p3.2xlarge + - p3.8xlarge + - p3.16xlarge + - p3dn.24xlarge + - g4dn.xlarge + - g4dn.2xlarge + - g4dn.4xlarge + - g4dn.8xlarge + - g4dn.12xlarge + - g4dn.16xlarge + - g5.xlarge + - g5.2xlarge + - g5.4xlarge + - g5.8xlarge + - g5.12xlarge + - g5.16xlarge ConstraintDescription: must be a valid EC2 instance type. MongoDBInstanceType: @@ -232,11 +251,22 @@ Parameters: Type: String Default: '' DiskSize: - Default: '10' + Default: '16' Description: Disk size of instances Type: Number - MinValue: '10' + MinValue: '16' MaxValue: '1000' + GPUImage: + Description: Select "true" to use GPU Image in Origin Cluster. You must select one of the g and p instance types. + Default: false + Type: String + AllowedValues: + - true + - false +Conditions: + UseGPUImage: !Equals + - !Ref GPUImage + - true Resources: DescribeImagesRole: @@ -262,7 +292,7 @@ Resources: AMSGetLatestAMI: Type: AWS::Lambda::Function Properties: - Runtime: python3.11 + Runtime: python3.12 Handler: index.handler Role: !Sub ${DescribeImagesRole.Arn} Timeout: 60 @@ -296,7 +326,7 @@ Resources: UbuntuGetLatestAMI: Type: AWS::Lambda::Function Properties: - Runtime: python3.11 + Runtime: python3.12 Handler: index.handler Role: !Sub ${DescribeImagesRole.Arn} Timeout: 60 @@ -336,12 +366,21 @@ Resources: Name: "AntMedia-AWS-Marketplace-EE-*" Architecture: "x86_64" + AntMediaGPUAmi: + Condition: UseGPUImage + Type: Custom::FindAMI + Properties: + ServiceToken: !Sub ${AMSGetLatestAMI.Arn} + ProductId: "8kf9kapq2qbo37fuekp8k7o6r" + Name: "AntMedia-AWS-Marketplace-GPU-*" + Architecture: "x86_64" + UbuntuAmi: Type: Custom::FindAMI Properties: ServiceToken: !Sub ${UbuntuGetLatestAMI.Arn} Owner: "099720109477" - Name: "ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*" + Name: "ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*" Architecture: "x86_64" AntMediaVPC: @@ -518,7 +557,7 @@ Resources: LaunchTemplateData: InstanceType: !Ref OriginInstanceType KeyName: !Ref KeyName - ImageId: !Ref AntMediaAmi + ImageId: !If [UseGPUImage, !Ref AntMediaGPUAmi, !Ref AntMediaAmi] SecurityGroupIds: - !GetAtt "InstanceSecurityGroup.GroupId" BlockDeviceMappings: @@ -533,12 +572,11 @@ Resources: touch /usr/local/antmedia/conf/initialized bash /usr/local/antmedia/change_server_mode.sh cluster ${DBInstance.PrivateIp} apt-get update - apt-get install -y python3-pip - apt-get install -y python3-setuptools + sudo apt-get -y install python3-pip mkdir -p /opt/aws/bin - wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz - python3 -m easy_install --script-dir /opt/aws/bin aws-cfn-bootstrap-py3-latest.tar.gz - /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource OriginGroup --region ${AWS::Region} + sudo pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz + sudo ln -s /usr/local/init/ubuntu/cfn-hup /etc/init.d/cfn-hup + /usr/local/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource OriginGroup --region ${AWS::Region} TagSpecifications: - ResourceType: instance Tags: @@ -608,13 +646,12 @@ Resources: #!/bin/bash touch /usr/local/antmedia/conf/initialized bash /usr/local/antmedia/change_server_mode.sh cluster ${DBInstance.PrivateIp} - apt-get update - apt-get install -y python3-pip - apt-get install -y python3-setuptools + sudo apt-get update + sudo apt-get -y install python3-pip mkdir -p /opt/aws/bin - wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz - python3 -m easy_install --script-dir /opt/aws/bin aws-cfn-bootstrap-py3-latest.tar.gz - /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource EdgeGroup --region ${AWS::Region} + sudo pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz + sudo ln -s /usr/local/init/ubuntu/cfn-hup /etc/init.d/cfn-hup + /usr/local/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource EdgeGroup --region ${AWS::Region} TagSpecifications: - ResourceType: instance Tags: @@ -864,13 +901,8 @@ Resources: Fn::Base64: !Sub | #!/bin/bash -xe - wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list - sudo apt-get update - sudo apt-get install -y mongodb-org python3-pip python3-setuptools - sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mongod.conf - systemctl enable mongod - systemctl restart mongod + wget -P /tmp/ https://raw.githubusercontent.com/ant-media/Scripts/master/install_mongodb.sh + bash /tmp/install_mongodb.sh Outputs: diff --git a/cloudformation/aws-streaming-wizard/template-custom-cert.yaml b/cloudformation/aws-streaming-wizard/template-custom-cert.yaml index debdd014..a8f93707 100644 --- a/cloudformation/aws-streaming-wizard/template-custom-cert.yaml +++ b/cloudformation/aws-streaming-wizard/template-custom-cert.yaml @@ -345,13 +345,12 @@ Resources: #!/bin/bash touch /usr/local/antmedia/conf/initialized bash /usr/local/antmedia/change_server_mode.sh cluster ${DBInstance.PrivateIp} - apt-get update - apt-get install -y python3-pip - apt-get install -y python3-setuptools + sudo apt-get update + sudo apt-get -y install python3-pip mkdir -p /opt/aws/bin - wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz - python3 -m easy_install --script-dir /opt/aws/bin aws-cfn-bootstrap-py3-latest.tar.gz - /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource OriginGroup --region ${AWS::Region} + sudo pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz + sudo ln -s /usr/local/init/ubuntu/cfn-hup /etc/init.d/cfn-hup + /usr/local/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource OriginGroup --region ${AWS::Region} TagSpecifications: - ResourceType: instance Tags: @@ -414,13 +413,12 @@ Resources: #!/bin/bash touch /usr/local/antmedia/conf/initialized bash /usr/local/antmedia/change_server_mode.sh cluster ${DBInstance.PrivateIp} - apt-get update - apt-get install -y python3-pip - apt-get install -y python3-setuptools + sudo apt-get update + sudo apt-get -y install python3-pip mkdir -p /opt/aws/bin - wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz - python3 -m easy_install --script-dir /opt/aws/bin aws-cfn-bootstrap-py3-latest.tar.gz - /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource EdgeGroup --region ${AWS::Region} + sudo pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz + sudo ln -s /usr/local/init/ubuntu/cfn-hup /etc/init.d/cfn-hup + /usr/local/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource EdgeGroup --region ${AWS::Region} TagSpecifications: - ResourceType: instance Tags: @@ -660,13 +658,8 @@ Resources: Fn::Base64: !Sub | #!/bin/bash -xe - wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list - sudo apt-get update - sudo apt-get install -y mongodb-org python3-pip python3-setuptools - sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mongod.conf - systemctl enable mongod - systemctl restart mongod + wget -P /tmp/ https://raw.githubusercontent.com/ant-media/Scripts/master/install_mongodb.sh + bash /tmp/install_mongodb.sh Outputs: diff --git a/cloudformation/aws-streaming-wizard/template.yaml b/cloudformation/aws-streaming-wizard/template.yaml index 598de5d4..1d27dd61 100644 --- a/cloudformation/aws-streaming-wizard/template.yaml +++ b/cloudformation/aws-streaming-wizard/template.yaml @@ -292,13 +292,12 @@ Resources: #!/bin/bash touch /usr/local/antmedia/conf/initialized bash /usr/local/antmedia/change_server_mode.sh cluster ${DBInstance.PrivateIp} - apt-get update - apt-get install -y python3-pip - apt-get install -y python3-setuptools + sudo apt-get update + sudo apt-get -y install python3-pip mkdir -p /opt/aws/bin - wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz - python3 -m easy_install --script-dir /opt/aws/bin aws-cfn-bootstrap-py3-latest.tar.gz - /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource OriginGroup --region ${AWS::Region} + sudo pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz + sudo ln -s /usr/local/init/ubuntu/cfn-hup /etc/init.d/cfn-hup + /usr/local/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource OriginGroup --region ${AWS::Region} TagSpecifications: - ResourceType: instance Tags: @@ -361,13 +360,12 @@ Resources: #!/bin/bash touch /usr/local/antmedia/conf/initialized bash /usr/local/antmedia/change_server_mode.sh cluster ${DBInstance.PrivateIp} - apt-get update - apt-get install -y python3-pip - apt-get install -y python3-setuptools + sudo apt-get update + sudo apt-get -y install python3-pip mkdir -p /opt/aws/bin - wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz - python3 -m easy_install --script-dir /opt/aws/bin aws-cfn-bootstrap-py3-latest.tar.gz - /opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource EdgeGroup --region ${AWS::Region} + sudo pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz + sudo ln -s /usr/local/init/ubuntu/cfn-hup /etc/init.d/cfn-hup + /usr/local/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource EdgeGroup --region ${AWS::Region} TagSpecifications: - ResourceType: instance Tags: @@ -607,13 +605,8 @@ Resources: Fn::Base64: !Sub | #!/bin/bash -xe - wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list - sudo apt-get update - sudo apt-get install -y mongodb-org python3-pip python3-setuptools - sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mongod.conf - systemctl enable mongod - systemctl restart mongod + wget -P /tmp/ https://raw.githubusercontent.com/ant-media/Scripts/master/install_mongodb.sh + bash /tmp/install_mongodb.sh Outputs: diff --git a/docker/Dockerfile_Process b/docker/Dockerfile_Process index 0da258bb..946836d2 100644 --- a/docker/Dockerfile_Process +++ b/docker/Dockerfile_Process @@ -2,7 +2,7 @@ # It accepts all cluster related parameters at run time. # It means it's very easy to add new containers to the cluster -FROM ubuntu:20.04 +FROM ubuntu:22.04 ARG AntMediaServer ARG LicenseKey diff --git a/init.sh b/init.sh index dadd5958..4a90ef13 100644 --- a/init.sh +++ b/init.sh @@ -46,4 +46,8 @@ then fi touch $INITIALIZED + ## Add default ServerSecretKey + SECRET_KEY=$(openssl rand -base64 32 | head -c 32) + sudo sed -i "/^server.jwtServerControlEnabled=/s|.*|server.jwtServerControlEnabled=true|" /usr/local/antmedia/conf/red5.properties + sudo sed -i "/^server.jwtServerSecretKey=/s|.*|server.jwtServerSecretKey=$SECRET_KEY|" /usr/local/antmedia/conf/red5.properties fi diff --git a/install_ant-media-server.sh b/install_ant-media-server.sh index 9e994309..164f9c5c 100755 --- a/install_ant-media-server.sh +++ b/install_ant-media-server.sh @@ -161,7 +161,7 @@ distro () { os_release="/etc/os-release" if [ -f "$os_release" ]; then . $os_release - msg="We are supporting Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04, Centos 8, Centos 9, RockyLinux 8, RockyLinux 9, AlmaLinux 8 and AlmaLinux 9" + msg="We are supporting Ubuntu 18.04, Ubuntu 20.04, Ubuntu 22.04, Ubuntu 24.04, Centos 8, Centos 9, RockyLinux 8, RockyLinux 9, AlmaLinux 8 and AlmaLinux 9" if [ "$OTHER_DISTRO" == "true" ]; then echo -e """\n- OpenJDK 11 (openjdk-11-jdk)\n- De-archiver (unzip)\n- Commons Daemon (jsvc)\n- Apache Portable Runtime Library (libapr1)\n- SSL Development Files (libssl-dev)\n- Video Acceleration (VA) API (libva-drm2)\n- Video Acceleration (VA) API - X11 runtime (libva-x11-2)\n- Video Decode and Presentation API Library (libvdpau-dev)\n- Crystal HD Video Decoder Library (libcrystalhd-dev)\n""" read -p 'Are you sure that the above packages are installed? Y/N ' CUSTOM_PACKAGES @@ -182,7 +182,7 @@ distro () { exit 1 fi - if [[ $VERSION_ID != 18.04 ]] && [[ $VERSION_ID != 20.04 ]] && [[ $VERSION_ID != 22.04 ]] && [[ $VERSION_ID != 8* ]] && [[ $VERSION_ID != 9* ]]; then + if [[ $VERSION_ID != 18.04 ]] && [[ $VERSION_ID != 20.04 ]] && [[ $VERSION_ID != 22.04 ]] && [[ $VERSION_ID != 24.04 ]] && [[ $VERSION_ID != 8* ]] && [[ $VERSION_ID != 9* ]]; then echo $msg exit 1 fi @@ -204,6 +204,31 @@ check_version() { fi } +check_enterprise_file() { + local retry_count=0 + local max_retries=3 + local remote_file + local local_file + + while [ $retry_count -lt $max_retries ]; do + + remote_file="$(curl -sL https://antmedia.io/download/latest-version.md5 | cut -d ' ' -f 1)" + local_file="$(md5sum "$ANT_MEDIA_SERVER_ZIP_FILE" | cut -d ' ' -f 1)" + + if [ "$local_file" != "$remote_file" ]; then + echo "Downloaded file MD5 checksum is different from remote file MD5 checksum. Retrying download. Attempt: $((retry_count+1))" + curl --progress-bar -o "$ANT_MEDIA_SERVER_ZIP_FILE" "$check_license" + ((retry_count++)) + else + echo "Downloaded file MD5 checksum matches remote file MD5 checksum." + return 0 + fi + done + + echo "Failed to download the file after $max_retries attempts. Please re-run script again or check the internet connection" + exit 1 +} + #Just checks if the latest ioperation is successfull check() { OUT=$? @@ -255,9 +280,11 @@ if [ -z "$ANT_MEDIA_SERVER_ZIP_FILE" ]; then echo "Invalid license key. Please check your license key." exit 1 else - echo "The license key is valid. Downloading the latest version of Ant Media Server Enterprise Edition." + VERSION_NAME=$(curl -s https://antmedia.io/download/latest-version.json | jq -r '.versionName') + echo "The license key is valid. Downloading the latest version ($VERSION_NAME) of Ant Media Server Enterprise Edition." curl --progress-bar -o ams_enterprise.zip "$check_license" ANT_MEDIA_SERVER_ZIP_FILE="ams_enterprise.zip" + check_enterprise_file fi fi fi diff --git a/kubernetes/ams-with-turn-server/ams-k8s-deployment-edge.yaml b/kubernetes/ams-with-turn-server/ams-k8s-deployment-edge.yaml index 972c03b6..9b6130b9 100644 --- a/kubernetes/ams-with-turn-server/ams-k8s-deployment-edge.yaml +++ b/kubernetes/ams-with-turn-server/ams-k8s-deployment-edge.yaml @@ -28,7 +28,7 @@ spec: containers: - name: ant-media-server imagePullPolicy: IfNotPresent # change this value accordingly. It can be Never, Always or IfNotPresent - image: muratugureminoglu/antmedia:2.4.3-coturn-1 #change this value according to your image. + image: antmedia/enterprise:latest #change this value according to your image. # By default, mongodb deployment is used. If you're using mongodb somewhere else, specify it with server url(-h) below. # You may also need to add -u and -p parameters for # specifying mongodb username and passwords respectively diff --git a/kubernetes/ams-with-turn-server/ams-k8s-deployment-origin.yaml b/kubernetes/ams-with-turn-server/ams-k8s-deployment-origin.yaml index cc503fe8..5146252e 100644 --- a/kubernetes/ams-with-turn-server/ams-k8s-deployment-origin.yaml +++ b/kubernetes/ams-with-turn-server/ams-k8s-deployment-origin.yaml @@ -28,7 +28,7 @@ spec: containers: - name: ant-media-server imagePullPolicy: IfNotPresent # change this value accordingly. It can be Never, Always or IfNotPresent - image: muratugureminoglu/antmedia:2.4.3-coturn-1 #change this value according to your image. + image: antmedia/enterprise:latest #change this value according to your image. # By default, mongodb deployment is used. If you're using mongodb somewhere else, specify it with server url(-h) below. # You may also need to add -u and -p parameters for # specifying mongodb username and passwords respectively