openvidu-deployment: azure - CUID for elastic and ha deployments and adjustments to those .bicep to support the new CUID
This commit is contained in:
parent
0b017b2abb
commit
915a4598b1
@ -39,7 +39,7 @@
|
||||
},
|
||||
{
|
||||
"name": "parameters SSL",
|
||||
"label": "Parameters for Domain and SSL certificate configuration",
|
||||
"label": "Domain and SSL certificate configuration",
|
||||
"elements": [
|
||||
{
|
||||
"name": "certificateType",
|
||||
@ -176,7 +176,7 @@
|
||||
},
|
||||
{
|
||||
"name": "parameters INSTANCE",
|
||||
"label": "Parameters for OpenVidu instance configuration",
|
||||
"label": "OpenVidu instance configuration",
|
||||
"elements": [
|
||||
{
|
||||
"name": "instanceType",
|
||||
@ -249,7 +249,7 @@
|
||||
},
|
||||
{
|
||||
"name": "parameters STORAGE",
|
||||
"label": "Parameters for Storage Account configuration",
|
||||
"label": "Storage Account configuration",
|
||||
"elements": [
|
||||
{
|
||||
"name": "storageAccountName",
|
||||
@ -287,7 +287,7 @@
|
||||
},
|
||||
{
|
||||
"name": "parameters TURN",
|
||||
"label": "(Optional) Parameters for TURN server configuration with TLS",
|
||||
"label": "(Optional) TURN server configuration with TLS",
|
||||
"elements": [
|
||||
{
|
||||
"name": "turnDomainName",
|
||||
|
||||
@ -16,10 +16,7 @@ and an Elastic IP, you can use this option to generate a Let's Encrypt certifica
|
||||
param certificateType string = 'selfsigned'
|
||||
|
||||
@description('Previously created Public IP address for the OpenVidu Deployment. Blank will generate a public IP')
|
||||
param publicIpAddress string = ''
|
||||
|
||||
@description('Name of the PublicIPAddress resource in your azure if you have a resource of publicIPAddress')
|
||||
param publicIpAddressResourceName string = ''
|
||||
param publicIpAddressObject object
|
||||
|
||||
@description('Domain name for the OpenVidu Deployment. Blank will generate default domain')
|
||||
param domainName string = ''
|
||||
@ -282,7 +279,7 @@ param adminUsername string
|
||||
|
||||
@description('SSH Key or password for the Virtual Machine')
|
||||
@secure()
|
||||
param adminSshKey string
|
||||
param adminSshKey object
|
||||
|
||||
@description('Number of initial media nodes to deploy')
|
||||
param initialNumberOfMediaNodes int = 1
|
||||
@ -298,29 +295,12 @@ param scaleTargetCPU int = 50
|
||||
|
||||
/*------------------------------------------- VARIABLES AND VALIDATIONS -------------------------------------------*/
|
||||
|
||||
var isEmptyIp = publicIpAddress == ''
|
||||
var ipSegments = split(publicIpAddress, '.')
|
||||
var isFourSegments = length(ipSegments) == 4
|
||||
var seg1valid = isEmptyIp ? true : int(ipSegments[0]) >= 0 && int(ipSegments[0]) <= 255
|
||||
var seg2valid = isEmptyIp ? true : int(ipSegments[1]) >= 0 && int(ipSegments[1]) <= 255
|
||||
var seg3valid = isEmptyIp ? true : int(ipSegments[2]) >= 0 && int(ipSegments[2]) <= 255
|
||||
var seg4valid = isEmptyIp ? true : int(ipSegments[3]) >= 0 && int(ipSegments[3]) <= 255
|
||||
var isValidIP = !isEmptyIp && isFourSegments && seg1valid && seg2valid && seg3valid && seg4valid
|
||||
var isEmptyIp = publicIpAddressObject.newOrExistingOrNone == 'none'
|
||||
|
||||
var isEmptyDomain = domainName == ''
|
||||
var domainParts = split(domainName, '.')
|
||||
var validNumberParts = length(domainParts) >= 2
|
||||
var allPartsValid = [
|
||||
for part in domainParts: length(part) >= 1 && length(part) <= 63 && !empty(part) && part == toLower(part) && !contains(
|
||||
part,
|
||||
'--'
|
||||
) && empty(replace(part, '[a-z0-9-]', ''))
|
||||
]
|
||||
|
||||
var isDomainValid = !isEmptyDomain && validNumberParts && !contains(allPartsValid, false)
|
||||
|
||||
var masterNodeVMSettings = {
|
||||
vmName: '${stackName}-VN-MasterNode'
|
||||
vmName: '${stackName}-VM-MasterNode'
|
||||
osDiskType: 'StandardSSD_LRS'
|
||||
ubuntuOSVersion: {
|
||||
publisher: 'Canonical'
|
||||
@ -334,7 +314,7 @@ var masterNodeVMSettings = {
|
||||
publicKeys: [
|
||||
{
|
||||
path: '/home/${adminUsername}/.ssh/authorized_keys'
|
||||
keyData: adminSshKey
|
||||
keyData: adminSshKey.sshPublicKey
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -356,7 +336,7 @@ var mediaNodeVMSettings = {
|
||||
publicKeys: [
|
||||
{
|
||||
path: '/home/${adminUsername}/.ssh/authorized_keys'
|
||||
keyData: adminSshKey
|
||||
keyData: adminSshKey.sshPublicKey
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1079,7 +1059,6 @@ resource openviduMasterNode 'Microsoft.Compute/virtualMachines@2023-09-01' = {
|
||||
osProfile: {
|
||||
computerName: masterNodeVMSettings.vmName
|
||||
adminUsername: adminUsername
|
||||
adminPassword: adminSshKey
|
||||
linuxConfiguration: masterNodeVMSettings.linuxConfiguration
|
||||
}
|
||||
userData: base64(userDataMasterNode)
|
||||
@ -1315,7 +1294,6 @@ resource openviduScaleSetMediaNode 'Microsoft.Compute/virtualMachineScaleSets@20
|
||||
osProfile: {
|
||||
computerNamePrefix: mediaNodeVMSettings.vmName
|
||||
adminUsername: adminUsername
|
||||
adminPassword: adminSshKey
|
||||
linuxConfiguration: mediaNodeVMSettings.linuxConfiguration
|
||||
}
|
||||
networkProfile: {
|
||||
@ -1541,8 +1519,16 @@ resource publicIP_OV 'Microsoft.Network/publicIPAddresses@2023-11-01' = if (isEm
|
||||
}
|
||||
}
|
||||
|
||||
resource publicIP_OV_ifNotEmpty 'Microsoft.Network/publicIPAddresses@2023-11-01' existing = if (!isEmptyIp == true) {
|
||||
name: publicIpAddressResourceName
|
||||
var ipExists = publicIpAddressObject.newOrExistingOrNone == 'existing'
|
||||
|
||||
resource publicIP_OV_ifExisting 'Microsoft.Network/publicIPAddresses@2023-11-01' existing = if (ipExists == true) {
|
||||
name: publicIpAddressObject.name
|
||||
}
|
||||
|
||||
var ipNew = publicIpAddressObject.newOrExistingOrNone == 'new'
|
||||
|
||||
resource publicIP_OV_ifNew 'Microsoft.Network/publicIPAddresses@2023-11-01' existing = if (ipNew == true) {
|
||||
name: publicIpAddressObject.name
|
||||
}
|
||||
|
||||
resource vnet_OV 'Microsoft.Network/virtualNetworks@2023-11-01' = {
|
||||
@ -1598,7 +1584,7 @@ resource netInterfaceMasterNode 'Microsoft.Network/networkInterfaces@2023-11-01'
|
||||
}
|
||||
]
|
||||
publicIPAddress: {
|
||||
id: isEmptyIp ? publicIP_OV.id : publicIP_OV_ifNotEmpty.id
|
||||
id: isEmptyIp ? publicIP_OV.id : ipNew ? publicIP_OV_ifNew.id : publicIP_OV_ifExisting.id
|
||||
properties: {
|
||||
deleteOption: 'Delete'
|
||||
}
|
||||
@ -2070,16 +2056,3 @@ resource blobContainer 'Microsoft.Storage/storageAccounts/blobServices/container
|
||||
publicAccess: 'None'
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------- OUTPUTS -------------------------------------------*/
|
||||
|
||||
output ipValidationStatus string = isValidIP ? 'IP address is valid' : 'IP address not valid'
|
||||
|
||||
output domainValidationStatus string = isDomainValid ? 'Domain is valid' : 'Domain is not valid'
|
||||
|
||||
output ownCertValidationStatus string = (certificateType == 'owncert' && ownPrivateCertificate != '' && ownPublicCertificate != '')
|
||||
? 'owncert selected and valid'
|
||||
: 'You need to fill \'Own Public Certificate\' and \'Own Private Certificate\''
|
||||
output letsEncryptValidationStatus string = (certificateType == 'letsencrypt' && letsEncryptEmail != '')
|
||||
? 'letsEncrypt selected and valid'
|
||||
: 'You need to fill \'Lets Encrypt Email\''
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,7 @@ param ownPrivateCertificate string = ''
|
||||
param letsEncryptEmail string = ''
|
||||
|
||||
@description('Name of the PublicIPAddress resource in Azure when using certificateType \'owncert\' or \'letsencrypt\'')
|
||||
param publicIpAddressResourceName string = ''
|
||||
param publicIpAddressObject object
|
||||
|
||||
@description('(Optional) Domain name for the TURN server with TLS. Only needed if your users are behind restrictive firewalls')
|
||||
param turnDomainName string = ''
|
||||
@ -40,7 +40,10 @@ param turnOwnPublicCertificate string = ''
|
||||
param turnOwnPrivateCertificate string = ''
|
||||
|
||||
@description('Name of the PublicIPAddress resource in Azure when using TURN server with TLS')
|
||||
param turnPublicIpAddressResourceName string = ''
|
||||
param turnPublicIpAddressObject object = {
|
||||
name: ''
|
||||
id: ''
|
||||
}
|
||||
|
||||
@description('Visit https://openvidu.io/account')
|
||||
@secure()
|
||||
@ -285,7 +288,7 @@ param adminUsername string
|
||||
|
||||
@description('SSH Key for the Virtual Machine.')
|
||||
@secure()
|
||||
param adminSshKey string
|
||||
param adminSshKey object
|
||||
|
||||
@description('Number of initial media nodes to deploy')
|
||||
param initialNumberOfMediaNodes int = 1
|
||||
@ -316,7 +319,7 @@ var masterNodeVMSettings = {
|
||||
publicKeys: [
|
||||
{
|
||||
path: '/home/${adminUsername}/.ssh/authorized_keys'
|
||||
keyData: adminSshKey
|
||||
keyData: adminSshKey.sshPublicKey
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -338,7 +341,7 @@ var mediaNodeVMSettings = {
|
||||
publicKeys: [
|
||||
{
|
||||
path: '/home/${adminUsername}/.ssh/authorized_keys'
|
||||
keyData: adminSshKey
|
||||
keyData: adminSshKey.sshPublicKey
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1264,7 +1267,6 @@ resource openviduMasterNode1 'Microsoft.Compute/virtualMachines@2023-09-01' = {
|
||||
osProfile: {
|
||||
computerName: '${stackName}-VM-MasterNode1'
|
||||
adminUsername: adminUsername
|
||||
adminPassword: adminSshKey
|
||||
linuxConfiguration: masterNodeVMSettings.linuxConfiguration
|
||||
}
|
||||
userData: base64(userDataMasterNode1)
|
||||
@ -1299,7 +1301,6 @@ resource openviduMasterNode2 'Microsoft.Compute/virtualMachines@2023-09-01' = {
|
||||
osProfile: {
|
||||
computerName: '${stackName}-VM-MasterNode2'
|
||||
adminUsername: adminUsername
|
||||
adminPassword: adminSshKey
|
||||
linuxConfiguration: masterNodeVMSettings.linuxConfiguration
|
||||
}
|
||||
userData: base64(userDataMasterNode2)
|
||||
@ -1335,7 +1336,6 @@ resource openviduMasterNode3 'Microsoft.Compute/virtualMachines@2023-09-01' = {
|
||||
osProfile: {
|
||||
computerName: '${stackName}-VM-MasterNode3'
|
||||
adminUsername: adminUsername
|
||||
adminPassword: adminSshKey
|
||||
linuxConfiguration: masterNodeVMSettings.linuxConfiguration
|
||||
}
|
||||
userData: base64(userDataMasterNode3)
|
||||
@ -1371,7 +1371,6 @@ resource openviduMasterNode4 'Microsoft.Compute/virtualMachines@2023-09-01' = {
|
||||
osProfile: {
|
||||
computerName: '${stackName}-VM-MasterNode4'
|
||||
adminUsername: adminUsername
|
||||
adminPassword: adminSshKey
|
||||
linuxConfiguration: masterNodeVMSettings.linuxConfiguration
|
||||
}
|
||||
userData: base64(userDataMasterNode4)
|
||||
@ -1613,7 +1612,6 @@ resource openviduScaleSetMediaNode 'Microsoft.Compute/virtualMachineScaleSets@20
|
||||
osProfile: {
|
||||
computerNamePrefix: mediaNodeVMSettings.vmName
|
||||
adminUsername: adminUsername
|
||||
adminPassword: adminSshKey
|
||||
linuxConfiguration: mediaNodeVMSettings.linuxConfiguration
|
||||
}
|
||||
networkProfile: {
|
||||
@ -1822,8 +1820,8 @@ resource scaleInActivityLogRule 'Microsoft.Insights/activityLogAlerts@2020-10-01
|
||||
|
||||
/*------------------------------------------- NETWORK -------------------------------------------*/
|
||||
|
||||
var isEmptyIp = publicIpAddressResourceName == ''
|
||||
var turnIsEmptyIp = turnPublicIpAddressResourceName == ''
|
||||
var isEmptyIp = publicIpAddressObject.newOrExistingOrNone == ''
|
||||
var turnIsEmptyIp = turnPublicIpAddressObject.newOrExistingOrNone == ''
|
||||
var lbName = '${stackName}-loadBalancer'
|
||||
var lbFrontEndName = 'LoadBalancerFrontEnd'
|
||||
var lbBackendPoolNameMasterNode = 'LoadBalancerBackEndMasterNode'
|
||||
@ -1840,8 +1838,16 @@ resource publicIPAddressLoadBalancer 'Microsoft.Network/publicIPAddresses@2024-0
|
||||
}
|
||||
}
|
||||
|
||||
resource publicIP_LoadBalancer_ifNotEmpty 'Microsoft.Network/publicIPAddresses@2023-11-01' existing = if (!isEmptyIp == true) {
|
||||
name: publicIpAddressResourceName
|
||||
var ipExists = publicIpAddressObject.newOrExistingOrNone == 'existing'
|
||||
|
||||
resource publicIP_LoadBalancer_ifExisting 'Microsoft.Network/publicIPAddresses@2023-11-01' existing = if (ipExists == true) {
|
||||
name: publicIpAddressObject.name
|
||||
}
|
||||
|
||||
var ipNew = publicIpAddressObject.newOrExistingOrNone == 'new'
|
||||
|
||||
resource publicIP_LoadBalancer_ifNew 'Microsoft.Network/publicIPAddresses@2023-11-01' existing = if (ipNew == true) {
|
||||
name: publicIpAddressObject.name
|
||||
}
|
||||
|
||||
resource publicIPAddressTurnTLSLoadBalancer 'Microsoft.Network/publicIPAddresses@2024-05-01' = if (turnTLSIsEnabled == true) {
|
||||
@ -1856,8 +1862,16 @@ resource publicIPAddressTurnTLSLoadBalancer 'Microsoft.Network/publicIPAddresses
|
||||
}
|
||||
}
|
||||
|
||||
resource publicIP_TurnTLSLoadBalancer_ifNotEmpty 'Microsoft.Network/publicIPAddresses@2023-11-01' existing = if (!turnIsEmptyIp && turnTLSIsEnabled == true) {
|
||||
name: publicIpAddressResourceName
|
||||
var ipTURNExists = publicIpAddressObject.newOrExistingOrNone == 'existing'
|
||||
|
||||
resource publicIP_TurnTLSLoadBalancer_ifExisting 'Microsoft.Network/publicIPAddresses@2023-11-01' existing = if (ipTURNExists && turnTLSIsEnabled == true) {
|
||||
name: publicIpAddressObject.name
|
||||
}
|
||||
|
||||
var ipTURNNew = publicIpAddressObject.newOrExistingOrNone == 'new'
|
||||
|
||||
resource publicIP_TurnTLSLoadBalancer_ifNew 'Microsoft.Network/publicIPAddresses@2023-11-01' existing = if (ipTURNNew && turnTLSIsEnabled == true) {
|
||||
name: publicIpAddressObject.name
|
||||
}
|
||||
|
||||
resource LoadBalancer 'Microsoft.Network/loadBalancers@2024-05-01' = {
|
||||
@ -1872,7 +1886,9 @@ resource LoadBalancer 'Microsoft.Network/loadBalancers@2024-05-01' = {
|
||||
name: lbFrontEndName
|
||||
properties: {
|
||||
publicIPAddress: {
|
||||
id: isEmptyIp ? publicIPAddressLoadBalancer.id : publicIP_LoadBalancer_ifNotEmpty.id
|
||||
id: isEmptyIp
|
||||
? publicIPAddressLoadBalancer.id
|
||||
: ipNew ? publicIP_LoadBalancer_ifNew.id : publicIP_LoadBalancer_ifExisting.id
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1990,7 +2006,9 @@ resource TurnTLSLoadbalancer 'Microsoft.Network/loadBalancers@2024-05-01' = if (
|
||||
privateIPAllocationMethod: 'Dynamic'
|
||||
privateIPAddressVersion: 'IPv4'
|
||||
publicIPAddress: {
|
||||
id: turnIsEmptyIp ? publicIPAddressLoadBalancer.id : publicIP_TurnTLSLoadBalancer_ifNotEmpty.id
|
||||
id: turnIsEmptyIp
|
||||
? publicIPAddressTurnTLSLoadBalancer.id
|
||||
: ipTURNNew ? publicIP_TurnTLSLoadBalancer_ifNew.id : publicIP_TurnTLSLoadBalancer_ifExisting.id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user