diff --git a/src/terraform/examples/e2e/0.global/variables.tf b/src/terraform/examples/e2e/0.global/variables.tf index 8ffff867..22e7c0a6 100644 --- a/src/terraform/examples/e2e/0.global/variables.tf +++ b/src/terraform/examples/e2e/0.global/variables.tf @@ -6,6 +6,10 @@ variable "regionName" { default = "WestUS2" # Set to the target Azure region name (az account list-locations --query [].name) } +variable "renderManager" { + default = "Deadline" # RoyalRender or Deadline +} + variable "securityResourceGroupName" { default = "ArtistAnywhere" # Alphanumeric, underscores, hyphens, periods and parenthesis are allowed } @@ -53,6 +57,10 @@ output "regionName" { value = var.regionName } +output "renderManager" { + value = var.renderManager +} + output "securityResourceGroupName" { value = var.securityResourceGroupName } diff --git a/src/terraform/examples/e2e/5.compute.image/config.auto.tfvars b/src/terraform/examples/e2e/5.compute.image/config.auto.tfvars index 3ae47012..0e754db9 100644 --- a/src/terraform/examples/e2e/5.compute.image/config.auto.tfvars +++ b/src/terraform/examples/e2e/5.compute.image/config.auto.tfvars @@ -62,7 +62,6 @@ imageTemplates = [ osDiskSizeGB = 0 timeoutMinutes = 120 outputVersion = "0.0.0" - renderManager = "Deadline" # RoyalRender or Deadline renderEngines = [] } }, @@ -81,7 +80,6 @@ imageTemplates = [ osDiskSizeGB = 480 timeoutMinutes = 240 outputVersion = "1.0.0" - renderManager = "Deadline" # RoyalRender or Deadline renderEngines = [ "Blender", "PBRT" @@ -103,7 +101,6 @@ imageTemplates = [ osDiskSizeGB = 480 timeoutMinutes = 240 outputVersion = "1.1.0" - renderManager = "Deadline" # RoyalRender or Deadline renderEngines = [ "Blender", "PBRT", @@ -127,7 +124,6 @@ imageTemplates = [ osDiskSizeGB = 512 timeoutMinutes = 240 outputVersion = "2.0.0" - renderManager = "Deadline" # RoyalRender or Deadline renderEngines = [ "Blender", "PBRT" @@ -149,7 +145,6 @@ imageTemplates = [ osDiskSizeGB = 512 timeoutMinutes = 240 outputVersion = "2.1.0" - renderManager = "Deadline" # RoyalRender or Deadline renderEngines = [ "Blender", "PBRT", @@ -173,7 +168,6 @@ imageTemplates = [ osDiskSizeGB = 0 timeoutMinutes = 180 outputVersion = "0.0.0" - renderManager = "Deadline" # RoyalRender or Deadline renderEngines = [] } }, @@ -192,7 +186,6 @@ imageTemplates = [ osDiskSizeGB = 480 timeoutMinutes = 420 outputVersion = "1.0.0" - renderManager = "Deadline" # RoyalRender or Deadline renderEngines = [ "Blender", "PBRT" @@ -214,7 +207,6 @@ imageTemplates = [ osDiskSizeGB = 480 timeoutMinutes = 420 outputVersion = "1.1.0" - renderManager = "Deadline" # RoyalRender or Deadline renderEngines = [ "Blender", "PBRT", @@ -238,7 +230,6 @@ imageTemplates = [ osDiskSizeGB = 512 timeoutMinutes = 420 outputVersion = "2.0.0" - renderManager = "Deadline" # RoyalRender or Deadline renderEngines = [ "Blender", "PBRT" @@ -260,7 +251,6 @@ imageTemplates = [ osDiskSizeGB = 512 timeoutMinutes = 420 outputVersion = "2.1.0" - renderManager = "Deadline" # RoyalRender or Deadline renderEngines = [ "Blender", "PBRT", diff --git a/src/terraform/examples/e2e/5.compute.image/customize.ps1 b/src/terraform/examples/e2e/5.compute.image/customize.ps1 index a933568b..c195c8dc 100644 --- a/src/terraform/examples/e2e/5.compute.image/customize.ps1 +++ b/src/terraform/examples/e2e/5.compute.image/customize.ps1 @@ -114,7 +114,7 @@ if ($machineType -eq "Scheduler") { switch ($renderManager) { "RoyalRender" { - $schedulerVersion = "8.4.02" + $schedulerVersion = "8.4.03" } "Deadline" { $schedulerVersion = "10.2.0.9" @@ -161,8 +161,11 @@ switch ($renderManager) { Write-Host "Customize (End): Royal Render Installer" Set-Location -Path $rootDirectory + [System.Environment]::SetEnvironmentVariable("RR_ROOT", $pwd.Path) if ($machineType -eq "Scheduler") { Write-Host "Customize (Start): Royal Render Server" + # $installFile = "win__rrServerconsole.bat" + # Start-Process -FilePath .\$installFile -Wait -RedirectStandardOutput "rr-server.output.txt" -RedirectStandardError "rr-server.error.txt" Write-Host "Customize (End): Royal Render Server" } diff --git a/src/terraform/examples/e2e/5.compute.image/customize.sh b/src/terraform/examples/e2e/5.compute.image/customize.sh index 12320db1..eea767b2 100644 --- a/src/terraform/examples/e2e/5.compute.image/customize.sh +++ b/src/terraform/examples/e2e/5.compute.image/customize.sh @@ -148,7 +148,7 @@ fi case $renderManager in "RoyalRender") - schedulerVersion="8.4.02" + schedulerVersion="8.4.03" ;; "Deadline") schedulerVersion="10.2.0.9" @@ -198,8 +198,11 @@ case $renderManager in echo "Customize (End): Royal Render Installer" cd $rootDirectory + export RR_ROOT=$(pwd) if [ $machineType == "Scheduler" ]; then echo "Customize (Start): Royal Render Server" + # installFile="lx__rrServerconsole.sh" + # ./$installFile 1> "rr-server.output.txt" 2> "rr-server.error.txt" echo "Customize (End): Royal Render Server" fi diff --git a/src/terraform/examples/e2e/5.compute.image/main.tf b/src/terraform/examples/e2e/5.compute.image/main.tf index a8ee5a26..b4e6765c 100644 --- a/src/terraform/examples/e2e/5.compute.image/main.tf +++ b/src/terraform/examples/e2e/5.compute.image/main.tf @@ -68,7 +68,6 @@ variable "imageTemplates" { osDiskSizeGB = number timeoutMinutes = number outputVersion = string - renderManager = string renderEngines = list(string) } ) @@ -223,21 +222,24 @@ resource "azurerm_resource_group_template_deployment" "image_builder" { resource_group_name = azurerm_resource_group.image.name deployment_mode = "Incremental" parameters_content = jsonencode({ + "renderManager" = { + value = module.global.renderManager + } "managedIdentityName" = { value = module.global.managedIdentityName - }, + } "managedIdentityResourceGroupName" = { value = module.global.securityResourceGroupName - }, + } "imageGalleryName" = { value = var.imageGallery.name - }, + } "imageTemplates" = { value = var.imageTemplates - }, + } "imageScriptContainer" = { value = "https://${data.azurerm_storage_account.storage.name}.blob.core.windows.net/${azurerm_storage_container.container.name}/" - }, + } "keyVaultSecretAdminUsername" = { value = data.azurerm_key_vault_secret.admin_username.value } @@ -250,6 +252,9 @@ resource "azurerm_resource_group_template_deployment" "image_builder" { "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { + "renderManager": { + "type": "string" + }, "managedIdentityName": { "type": "string" }, @@ -296,6 +301,10 @@ resource "azurerm_resource_group_template_deployment" "image_builder" { "name": "scriptFilePath", "type": "string" }, + { + "name": "renderManager", + "type": "string" + }, { "name": "adminUsername", "type": "string" @@ -327,7 +336,7 @@ resource "azurerm_resource_group_template_deployment" "image_builder" { { "type": "Shell", "inline": [ - "[format('cat {0} | tr -d \r | {1} /bin/bash', concat(parameters('scriptFilePath'), parameters('imageTemplate').image.customizeScript), concat('buildConfigEncoded=', base64(string(union(parameters('imageTemplate').build, createObject('adminUsername', parameters('adminUsername')), createObject('adminPassword', parameters('adminPassword')))))))]" + "[format('cat {0} | tr -d \r | {1} /bin/bash', concat(parameters('scriptFilePath'), parameters('imageTemplate').image.customizeScript), concat('buildConfigEncoded=', base64(string(union(parameters('imageTemplate').build, createObject('renderManager', parameters('renderManager')), createObject('adminUsername', parameters('adminUsername')), createObject('adminPassword', parameters('adminPassword')))))))]" ] } ] @@ -346,6 +355,10 @@ resource "azurerm_resource_group_template_deployment" "image_builder" { { "name": "scriptFilePath", "type": "string" + }, + { + "name": "renderManager", + "type": "string" } ], "output": { @@ -373,9 +386,9 @@ resource "azurerm_resource_group_template_deployment" "image_builder" { { "type": "PowerShell", "inline": [ - "[format('{0} {1}', concat(parameters('scriptFilePath'), parameters('imageTemplate').image.customizeScript), concat('-buildConfigEncoded ', base64(string(parameters('imageTemplate').build))))]" + "[format('{0} {1}', concat(parameters('scriptFilePath'), parameters('imageTemplate').image.customizeScript), concat('-buildConfigEncoded ', base64(string(union(parameters('imageTemplate').build, createObject('renderManager', parameters('renderManager')))))))]" ], - "runElevated": "[if(and(equals(parameters('imageTemplate').build.renderManager, 'Deadline'), equals(parameters('imageTemplate').build.machineType, 'Scheduler')), true(), false())]" + "runElevated": "[if(and(equals(parameters('renderManager'), 'Deadline'), equals(parameters('imageTemplate').build.machineType, 'Scheduler')), true(), false())]" } ] } @@ -408,7 +421,7 @@ resource "azurerm_resource_group_template_deployment" "image_builder" { "sku": "[reference(resourceId('Microsoft.Compute/galleries/images', parameters('imageGalleryName'), parameters('imageTemplates')[copyIndex()].image.definitionName), variables('imageGalleryApiVersion')).identifier.sku]", "version": "[parameters('imageTemplates')[copyIndex()].image.inputVersion]" }, - "customize": "[if(equals(reference(resourceId('Microsoft.Compute/galleries/images', parameters('imageGalleryName'), parameters('imageTemplates')[copyIndex()].image.definitionName), variables('imageGalleryApiVersion')).osType, 'Windows'), fx.GetCustomizeCommandsWindows(parameters('imageScriptContainer'), parameters('imageTemplates')[copyIndex()], variables('localDownloadPathWindows')), fx.GetCustomizeCommandsLinux(parameters('imageScriptContainer'), parameters('imageTemplates')[copyIndex()], variables('localDownloadPathLinux'), parameters('keyVaultSecretAdminUsername'), parameters('keyVaultSecretAdminPassword')))]", + "customize": "[if(equals(reference(resourceId('Microsoft.Compute/galleries/images', parameters('imageGalleryName'), parameters('imageTemplates')[copyIndex()].image.definitionName), variables('imageGalleryApiVersion')).osType, 'Windows'), fx.GetCustomizeCommandsWindows(parameters('imageScriptContainer'), parameters('imageTemplates')[copyIndex()], variables('localDownloadPathWindows'), parameters('renderManager')), fx.GetCustomizeCommandsLinux(parameters('imageScriptContainer'), parameters('imageTemplates')[copyIndex()], variables('localDownloadPathLinux'), parameters('renderManager'), parameters('keyVaultSecretAdminUsername'), parameters('keyVaultSecretAdminPassword')))]", "buildTimeoutInMinutes": "[parameters('imageTemplates')[copyIndex()].build.timeoutMinutes]", "distribute": [ { diff --git a/src/terraform/examples/e2e/6.compute.scheduler/config.auto.tfvars b/src/terraform/examples/e2e/6.compute.scheduler/config.auto.tfvars index 7cc50171..f472a296 100644 --- a/src/terraform/examples/e2e/6.compute.scheduler/config.auto.tfvars +++ b/src/terraform/examples/e2e/6.compute.scheduler/config.auto.tfvars @@ -25,7 +25,13 @@ virtualMachines = [ enable = true fileName = "initialize.sh" parameters = { - fileSystemMounts = [ + fileSystemMountsStorage = [ + ] + fileSystemMountsStorageCache = [ + ] + fileSystemMountsRoyalRender = [ + ] + fileSystemMountsDeadline = [ "scheduler.artist.studio:/DeadlineRepository /mnt/scheduler nfs defaults 0 0" ] autoScale = { @@ -68,7 +74,13 @@ virtualMachines = [ enable = true fileName = "initialize.ps1" parameters = { - fileSystemMounts = [ + fileSystemMountsStorage = [ + ] + fileSystemMountsStorageCache = [ + ] + fileSystemMountsRoyalRender = [ + ] + fileSystemMountsDeadline = [ "mount -o anon \\\\scheduler.artist.studio\\DeadlineRepository S:" ] autoScale = { diff --git a/src/terraform/examples/e2e/6.compute.scheduler/initialize.ps1 b/src/terraform/examples/e2e/6.compute.scheduler/initialize.ps1 index bde52863..57e4da0e 100644 --- a/src/terraform/examples/e2e/6.compute.scheduler/initialize.ps1 +++ b/src/terraform/examples/e2e/6.compute.scheduler/initialize.ps1 @@ -35,13 +35,26 @@ if ("${autoScale.enable}" -ne "true") { $mountFile = "C:\Windows\Temp\mounts.bat" New-Item -ItemType File -Path $mountFile -%{ for fsMount in fileSystemMounts } +%{ for fsMount in fileSystemMountsStorage } Add-Content -Path $mountFile -Value "${fsMount}" %{ endfor } +%{ for fsMount in fileSystemMountsStorageCache } + Add-Content -Path $mountFile -Value "${fsMount}" +%{ endfor } +%{ if renderManager == "RoyalRender" } + %{ for fsMount in fileSystemMountsRoyalRender } + Add-Content -Path $mountFile -Value "${fsMount}" + %{ endfor } +%{ endif } +%{ if renderManager == "Deadline" } + %{ for fsMount in fileSystemMountsDeadline } + Add-Content -Path $mountFile -Value "${fsMount}" + %{ endfor } +%{ endif } -$taskName = "AAA Storage Mounts" +$taskName = "AAA File System Mounts" $taskAction = New-ScheduledTaskAction -Execute $mountFile $taskTrigger = New-ScheduledTaskTrigger -AtStartup Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -AsJob -User System -Force -Start-Process -FilePath $mountFile -Wait -RedirectStandardOutput "$mountFile.output.txt" -RedirectStandardError "$mountFile.error.txt" +Start-Process -FilePath $mountFile -Wait -RedirectStandardOutput "fs-mounts.output.txt" -RedirectStandardError "fs-mounts.error.txt" diff --git a/src/terraform/examples/e2e/6.compute.scheduler/initialize.sh b/src/terraform/examples/e2e/6.compute.scheduler/initialize.sh index 26bed0ee..108877d9 100644 --- a/src/terraform/examples/e2e/6.compute.scheduler/initialize.sh +++ b/src/terraform/examples/e2e/6.compute.scheduler/initialize.sh @@ -35,11 +35,30 @@ if [ ${autoScale.enable} == true ]; then systemctl --now enable scale.timer fi -%{ for fsMount in fileSystemMounts } +%{ for fsMount in fileSystemMountsStorage } fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}") mkdir -p $fsMountPoint echo "${fsMount}" >> /etc/fstab %{ endfor } +%{ for fsMount in fileSystemMountsStorageCache } + fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}") + mkdir -p $fsMountPoint + echo "${fsMount}" >> /etc/fstab +%{ endfor } +%{ if renderManager == "RoyalRender" } + %{ for fsMount in fileSystemMountsRoyalRender } + fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}") + mkdir -p $fsMountPoint + echo "${fsMount}" >> /etc/fstab + %{ endfor } +%{ endif } +%{ if renderManager == "Deadline" } + %{ for fsMount in fileSystemMountsDeadline } + fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}") + mkdir -p $fsMountPoint + echo "${fsMount}" >> /etc/fstab + %{ endfor } +%{ endif } mount -a if [ ${cycleCloud.enable} == true ]; then diff --git a/src/terraform/examples/e2e/6.compute.scheduler/main.tf b/src/terraform/examples/e2e/6.compute.scheduler/main.tf index 61c58bf3..7e3dcaca 100644 --- a/src/terraform/examples/e2e/6.compute.scheduler/main.tf +++ b/src/terraform/examples/e2e/6.compute.scheduler/main.tf @@ -66,7 +66,10 @@ variable "virtualMachines" { fileName = string parameters = object( { - fileSystemMounts = list(string) + fileSystemMountsStorage = list(string) + fileSystemMountsStorageCache = list(string) + fileSystemMountsRoyalRender = list(string) + fileSystemMountsDeadline = list(string) autoScale = object( { enable = bool @@ -305,6 +308,7 @@ resource "azurerm_virtual_machine_extension" "custom_linux" { { tenantId = data.azurerm_client_config.current.tenant_id }, { subscriptionId = data.azurerm_client_config.current.subscription_id }, { regionName = module.global.regionName }, + { renderManager = module.global.renderManager }, { networkResourceGroupName = data.azurerm_virtual_network.compute.resource_group_name }, { networkName = data.azurerm_virtual_network.compute.name }, { networkSubnetName = data.azurerm_subnet.farm.name }, @@ -389,7 +393,9 @@ resource "azurerm_virtual_machine_extension" "custom_windows" { virtual_machine_id = "${azurerm_resource_group.scheduler.id}/providers/Microsoft.Compute/virtualMachines/${each.value.name}" settings = jsonencode({ "commandToExecute": "PowerShell -ExecutionPolicy Unrestricted -EncodedCommand ${textencodebase64( - templatefile(each.value.customExtension.fileName, each.value.customExtension.parameters), "UTF-16LE" + templatefile(each.value.customExtension.fileName, merge(each.value.customExtension.parameters, + { renderManager = module.global.renderManager } + )), "UTF-16LE" )}" }) depends_on = [ diff --git a/src/terraform/examples/e2e/7.compute.farm/config.auto.tfvars b/src/terraform/examples/e2e/7.compute.farm/config.auto.tfvars index c8b6879f..9a2cc113 100644 --- a/src/terraform/examples/e2e/7.compute.farm/config.auto.tfvars +++ b/src/terraform/examples/e2e/7.compute.farm/config.auto.tfvars @@ -32,11 +32,17 @@ virtualMachineScaleSets = [ enable = true fileName = "initialize.sh" parameters = { - fileSystemMounts = [ - "scheduler.artist.studio:/DeadlineRepository /mnt/scheduler nfs defaults 0 0", - "azrender1.blob.core.windows.net:/azrender1/show /mnt/show/write nfs sec=sys,vers=3,proto=tcp,nolock 0 0", + fileSystemMountsStorage = [ + "azrender1.blob.core.windows.net:/azrender1/show /mnt/show/write nfs sec=sys,vers=3,proto=tcp,nolock 0 0" + ] + fileSystemMountsStorageCache = [ # "cache.artist.studio:/mnt/show /mnt/show/read nfs hard,proto=tcp,mountproto=tcp,retry=30,nolock 0 0" ] + fileSystemMountsRoyalRender = [ + ] + fileSystemMountsDeadline = [ + "scheduler.artist.studio:/DeadlineRepository /mnt/scheduler nfs defaults 0 0" + ] fileSystemPermissions = [ "chmod 777 /mnt/show/write" ] @@ -89,11 +95,17 @@ virtualMachineScaleSets = [ enable = true fileName = "initialize.ps1" parameters = { - fileSystemMounts = [ - "mount -o anon \\\\scheduler.artist.studio\\DeadlineRepository S:", - "mount -o anon nolock \\\\azrender1.blob.core.windows.net\\azrender1\\show W:", + fileSystemMountsStorage = [ + "mount -o anon nolock \\\\azrender1.blob.core.windows.net\\azrender1\\show W:" + ] + fileSystemMountsStorageCache = [ # "mount -o anon nolock \\\\cache.artist.studio\\mnt\\show R:" ] + fileSystemMountsRoyalRender = [ + ] + fileSystemMountsDeadline = [ + "mount -o anon \\\\scheduler.artist.studio\\DeadlineRepository S:" + ] fileSystemPermissions = [ "icacls W: /grant Everyone:F" ] diff --git a/src/terraform/examples/e2e/7.compute.farm/initialize.ps1 b/src/terraform/examples/e2e/7.compute.farm/initialize.ps1 index faa73ab4..75e1a7da 100644 --- a/src/terraform/examples/e2e/7.compute.farm/initialize.ps1 +++ b/src/terraform/examples/e2e/7.compute.farm/initialize.ps1 @@ -10,20 +10,31 @@ for ($i = 0; $i -lt 12; $i++) { Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -AsJob -User System -Force } -%{ if length(fileSystemMounts) > 0 } - $mountFile = "C:\Windows\Temp\mounts.bat" - New-Item -ItemType File -Path $mountFile - %{ for fsMount in fileSystemMounts } +$mountFile = "C:\Windows\Temp\mounts.bat" +New-Item -ItemType File -Path $mountFile +%{ for fsMount in fileSystemMountsStorage } + Add-Content -Path $mountFile -Value "${fsMount}" +%{ endfor } +%{ for fsMount in fileSystemMountsStorageCache } + Add-Content -Path $mountFile -Value "${fsMount}" +%{ endfor } +%{ if renderManager == "RoyalRender" } + %{ for fsMount in fileSystemMountsRoyalRender } Add-Content -Path $mountFile -Value "${fsMount}" %{ endfor } - - $taskName = "AAA Storage Mounts" - $taskAction = New-ScheduledTaskAction -Execute $mountFile - $taskTrigger = New-ScheduledTaskTrigger -AtStartup - Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -AsJob -User System -Force - - Start-Process -FilePath $mountFile -Wait -RedirectStandardOutput "$mountFile.output.txt" -RedirectStandardError "$mountFile.error.txt" - %{ for fsPermission in fileSystemPermissions } - ${fsPermission} +%{ endif } +%{ if renderManager == "Deadline" } + %{ for fsMount in fileSystemMountsDeadline } + Add-Content -Path $mountFile -Value "${fsMount}" %{ endfor } %{ endif } + +$taskName = "AAA File System Mounts" +$taskAction = New-ScheduledTaskAction -Execute $mountFile +$taskTrigger = New-ScheduledTaskTrigger -AtStartup +Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -AsJob -User System -Force + +Start-Process -FilePath $mountFile -Wait -RedirectStandardOutput "fs-mounts.output.txt" -RedirectStandardError "fs-mounts.error.txt" +%{ for fsPermission in fileSystemPermissions } + ${fsPermission} +%{ endfor } diff --git a/src/terraform/examples/e2e/7.compute.farm/initialize.sh b/src/terraform/examples/e2e/7.compute.farm/initialize.sh index 4a8f7cc0..3864526b 100644 --- a/src/terraform/examples/e2e/7.compute.farm/initialize.sh +++ b/src/terraform/examples/e2e/7.compute.farm/initialize.sh @@ -23,14 +23,31 @@ echo "[Install]" >> $timerPath echo "WantedBy=timers.target" >> $timerPath systemctl --now enable terminate.timer -%{ if length(fileSystemMounts) > 0 } - %{ for fsMount in fileSystemMounts } +%{ for fsMount in fileSystemMountsStorage } + fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}") + mkdir -p $fsMountPoint + echo "${fsMount}" >> /etc/fstab +%{ endfor } +%{ for fsMount in fileSystemMountsStorageCache } + fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}") + mkdir -p $fsMountPoint + echo "${fsMount}" >> /etc/fstab +%{ endfor } +%{ if renderManager == "RoyalRender" } + %{ for fsMount in fileSystemMountsRoyalRender } fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}") mkdir -p $fsMountPoint echo "${fsMount}" >> /etc/fstab %{ endfor } - mount -a - %{ for fsPermission in fileSystemPermissions } - ${fsPermission} +%{ endif } +%{ if renderManager == "Deadline" } + %{ for fsMount in fileSystemMountsDeadline } + fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}") + mkdir -p $fsMountPoint + echo "${fsMount}" >> /etc/fstab %{ endfor } %{ endif } +mount -a +%{ for fsPermission in fileSystemPermissions } + ${fsPermission} +%{ endfor } diff --git a/src/terraform/examples/e2e/7.compute.farm/main.tf b/src/terraform/examples/e2e/7.compute.farm/main.tf index 827db965..9df02830 100644 --- a/src/terraform/examples/e2e/7.compute.farm/main.tf +++ b/src/terraform/examples/e2e/7.compute.farm/main.tf @@ -73,8 +73,11 @@ variable "virtualMachineScaleSets" { fileName = string parameters = object( { - fileSystemMounts = list(string) - fileSystemPermissions = list(string) + fileSystemMountsStorage = list(string) + fileSystemMountsStorageCache = list(string) + fileSystemMountsRoyalRender = list(string) + fileSystemMountsDeadline = list(string) + fileSystemPermissions = list(string) } ) } @@ -251,7 +254,9 @@ resource "azurerm_linux_virtual_machine_scale_set" "farm" { auto_upgrade_minor_version = true settings = jsonencode({ "script": "${base64encode( - templatefile(each.value.customExtension.fileName, each.value.customExtension.parameters) + templatefile(each.value.customExtension.fileName, merge(each.value.customExtension.parameters, + { renderManager = module.global.renderManager } + )) )}" }) } @@ -353,7 +358,9 @@ resource "azurerm_windows_virtual_machine_scale_set" "farm" { auto_upgrade_minor_version = true settings = jsonencode({ "commandToExecute": "PowerShell -ExecutionPolicy Unrestricted -EncodedCommand ${textencodebase64( - templatefile(each.value.customExtension.fileName, each.value.customExtension.parameters), "UTF-16LE" + templatefile(each.value.customExtension.fileName, merge(each.value.customExtension.parameters, + { renderManager = module.global.renderManager } + )), "UTF-16LE" )}" }) } diff --git a/src/terraform/examples/e2e/8.compute.workstation/config.auto.tfvars b/src/terraform/examples/e2e/8.compute.workstation/config.auto.tfvars index fe7fd607..a798619a 100644 --- a/src/terraform/examples/e2e/8.compute.workstation/config.auto.tfvars +++ b/src/terraform/examples/e2e/8.compute.workstation/config.auto.tfvars @@ -25,10 +25,16 @@ virtualMachines = [ enable = true fileName = "initialize.sh" parameters = { - fileSystemMounts = [ - "scheduler.artist.studio:/DeadlineRepository /mnt/scheduler nfs defaults 0 0", + fileSystemMountsStorage = [ "azrender1.blob.core.windows.net:/azrender1/show /mnt/show nfs sec=sys,vers=3,proto=tcp,nolock 0 0" ] + fileSystemMountsStorageCache = [ + ] + fileSystemMountsRoyalRender = [ + ] + fileSystemMountsDeadline = [ + "scheduler.artist.studio:/DeadlineRepository /mnt/scheduler nfs defaults 0 0" + ] teradiciLicenseKey = "" } } @@ -57,10 +63,16 @@ virtualMachines = [ enable = true fileName = "initialize.ps1" parameters = { - fileSystemMounts = [ - "mount -o anon \\\\scheduler.artist.studio\\DeadlineRepository S:", + fileSystemMountsStorage = [ "mount -o anon nolock \\\\azrender1.blob.core.windows.net\\azrender1\\show W:" ] + fileSystemMountsStorageCache = [ + ] + fileSystemMountsRoyalRender = [ + ] + fileSystemMountsDeadline = [ + "mount -o anon \\\\scheduler.artist.studio\\DeadlineRepository S:" + ] teradiciLicenseKey = "" } } diff --git a/src/terraform/examples/e2e/8.compute.workstation/initialize.ps1 b/src/terraform/examples/e2e/8.compute.workstation/initialize.ps1 index f509264e..56d84c04 100644 --- a/src/terraform/examples/e2e/8.compute.workstation/initialize.ps1 +++ b/src/terraform/examples/e2e/8.compute.workstation/initialize.ps1 @@ -5,17 +5,28 @@ $ErrorActionPreference = "Stop" Start-Process -FilePath "PowerShell.exe" -ArgumentList "-ExecutionPolicy Unrestricted -File ""$agentFile"" -RegistrationCode ${teradiciLicenseKey}" -Wait -RedirectStandardOutput "$agentFile.output.txt" -RedirectStandardError "$agentFile.error.txt" %{ endif } -%{ if length(fileSystemMounts) > 0 } - $mountFile = "C:\Windows\Temp\mounts.bat" - New-Item -ItemType File -Path $mountFile - %{ for fsMount in fileSystemMounts } +$mountFile = "C:\Windows\Temp\mounts.bat" +New-Item -ItemType File -Path $mountFile +%{ for fsMount in fileSystemMountsStorage } + Add-Content -Path $mountFile -Value "${fsMount}" +%{ endfor } +%{ for fsMount in fileSystemMountsStorageCache } + Add-Content -Path $mountFile -Value "${fsMount}" +%{ endfor } +%{ if renderManager == "RoyalRender" } + %{ for fsMount in fileSystemMountsRoyalRender } Add-Content -Path $mountFile -Value "${fsMount}" %{ endfor } - - $taskName = "AAA Storage Mounts" - $taskAction = New-ScheduledTaskAction -Execute $mountFile - $taskTrigger = New-ScheduledTaskTrigger -AtStartup - Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -AsJob -User System -Force - - Start-Process -FilePath $mountFile -Wait -RedirectStandardOutput "$mountFile.output.txt" -RedirectStandardError "$mountFile.error.txt" %{ endif } +%{ if renderManager == "Deadline" } + %{ for fsMount in fileSystemMountsDeadline } + Add-Content -Path $mountFile -Value "${fsMount}" + %{ endfor } +%{ endif } + +$taskName = "AAA File System Mounts" +$taskAction = New-ScheduledTaskAction -Execute $mountFile +$taskTrigger = New-ScheduledTaskTrigger -AtStartup +Register-ScheduledTask -TaskName $taskName -Action $taskAction -Trigger $taskTrigger -AsJob -User System -Force + +Start-Process -FilePath $mountFile -Wait -RedirectStandardOutput "fs-mounts.output.txt" -RedirectStandardError "fs-mounts.error.txt" diff --git a/src/terraform/examples/e2e/8.compute.workstation/initialize.sh b/src/terraform/examples/e2e/8.compute.workstation/initialize.sh index 99dec7ee..c126d920 100644 --- a/src/terraform/examples/e2e/8.compute.workstation/initialize.sh +++ b/src/terraform/examples/e2e/8.compute.workstation/initialize.sh @@ -6,11 +6,28 @@ source /etc/profile.d/aaa.sh # https://github.com/Azure/WALinuxAgent/issues/1561 pcoip-register-host --registration-code=${teradiciLicenseKey} %{ endif } -%{ if length(fileSystemMounts) > 0 } - %{ for fsMount in fileSystemMounts } +%{ for fsMount in fileSystemMountsStorage } + fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}") + mkdir -p $fsMountPoint + echo "${fsMount}" >> /etc/fstab +%{ endfor } +%{ for fsMount in fileSystemMountsStorageCache } + fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}") + mkdir -p $fsMountPoint + echo "${fsMount}" >> /etc/fstab +%{ endfor } +%{ if renderManager == "RoyalRender" } + %{ for fsMount in fileSystemMountsRoyalRender } fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}") mkdir -p $fsMountPoint echo "${fsMount}" >> /etc/fstab %{ endfor } - mount -a %{ endif } +%{ if renderManager == "Deadline" } + %{ for fsMount in fileSystemMountsDeadline } + fsMountPoint=$(cut -d ' ' -f 2 <<< "${fsMount}") + mkdir -p $fsMountPoint + echo "${fsMount}" >> /etc/fstab + %{ endfor } +%{ endif } +mount -a diff --git a/src/terraform/examples/e2e/8.compute.workstation/main.tf b/src/terraform/examples/e2e/8.compute.workstation/main.tf index 4af8ad59..f84b0cbf 100644 --- a/src/terraform/examples/e2e/8.compute.workstation/main.tf +++ b/src/terraform/examples/e2e/8.compute.workstation/main.tf @@ -62,8 +62,11 @@ variable "virtualMachines" { fileName = string parameters = object( { - fileSystemMounts = list(string) - teradiciLicenseKey = string + fileSystemMountsStorage = list(string) + fileSystemMountsStorageCache = list(string) + fileSystemMountsRoyalRender = list(string) + fileSystemMountsDeadline = list(string) + teradiciLicenseKey = string } ) } @@ -215,7 +218,9 @@ resource "azurerm_virtual_machine_extension" "custom_linux" { virtual_machine_id = "${azurerm_resource_group.workstation.id}/providers/Microsoft.Compute/virtualMachines/${each.value.name}" settings = jsonencode({ "script": "${base64encode( - templatefile(each.value.customExtension.fileName, each.value.customExtension.parameters) + templatefile(each.value.customExtension.fileName, merge(each.value.customExtension.parameters, + { renderManager = module.global.renderManager } + )) )}" }) depends_on = [ @@ -288,7 +293,9 @@ resource "azurerm_virtual_machine_extension" "custom_windows" { virtual_machine_id = "${azurerm_resource_group.workstation.id}/providers/Microsoft.Compute/virtualMachines/${each.value.name}" settings = jsonencode({ "commandToExecute": "PowerShell -ExecutionPolicy Unrestricted -EncodedCommand ${textencodebase64( - templatefile(each.value.customExtension.fileName, each.value.customExtension.parameters), "UTF-16LE" + templatefile(each.value.customExtension.fileName, merge(each.value.customExtension.parameters, + { renderManager = module.global.renderManager } + )), "UTF-16LE" )}" }) depends_on = [ diff --git a/src/terraform/examples/e2e/README.md b/src/terraform/examples/e2e/README.md index de004b3e..cad73938 100644 --- a/src/terraform/examples/e2e/README.md +++ b/src/terraform/examples/e2e/README.md @@ -182,8 +182,8 @@ New-Item -ItemType Directory -Path $localDirectory -Force 1. Review and edit the config values in `config.auto.tfvars` for your deployment. * Make sure you have sufficient compute (*Spot*) cores quota available in your Azure subscription. * Make sure the **imageId** config references the correct custom image in your Azure subscription. - * Make sure the **fileSystemMounts** config has the correct values (e.g., storage account name). - * If your config includes cache mounting, which is the default config, make sure [4 Storage Cache](#4-storage-cache) is deployed and *running* before deploying this module. + * Make sure the **fileSystemMounts*** configs have the correct values (e.g., storage account name). + * If your config has cache mounts, make sure [4 Storage Cache](#4-storage-cache) is deployed and *running* before deploying this module. * Make sure the **fileSystemPermissions** config has the appropriate value for your environment. 1. Run `terraform init -backend-config ../0.global/backend.config` to initialize the current local directory (append `-upgrade` if older providers are detected) 1. Run `terraform apply` to generate the Terraform deployment [Plan](https://www.terraform.io/docs/cli/run/index.html#planning) (append `-destroy` to delete Azure resources) @@ -197,8 +197,8 @@ New-Item -ItemType Directory -Path $localDirectory -Force 1. Review and edit the config values in `config.auto.tfvars` for your deployment. * Make sure you have sufficient compute cores quota available in your Azure subscription. * Make sure the **imageId** config references the correct custom image in your Azure subscription. - * Make sure the **fileSystemMounts** config has the correct values (e.g., storage cache mount). - * If your config includes cache mounting, which is the default config, make sure [4 Storage Cache](#4-storage-cache) is deployed and *running* before deploying this module. + * Make sure the **fileSystemMounts*** configs have the correct values (e.g., storage cache mount). + * If your config has cache mounts, make sure [4 Storage Cache](#4-storage-cache) is deployed and *running* before deploying this module. 1. Run `terraform init -backend-config ../0.global/backend.config` to initialize the current local directory (append `-upgrade` if older providers are detected) 1. Run `terraform apply` to generate the Terraform deployment [Plan](https://www.terraform.io/docs/cli/run/index.html#planning) (append `-destroy` to delete Azure resources) 1. Review and confirm the displayed Terraform deployment plan to add, change and/or destroy Azure resources