Esri / arcgis-powershell-dsc

This repository contains scripts, code and samples for automating the install and configuration of ArcGIS (Enterprise and Desktop) using Microsoft Windows PowerShell DSC (Desired State Configuration).
Apache License 2.0
120 stars 62 forks source link

Notebook Server install forces Join Site in single machine install #570

Closed skunz42 closed 2 weeks ago

skunz42 commented 1 month ago

Community Note

Module Version

Affected Resource(s)

Configuration Files

{
    "AllNodes": [
        {
            "NodeName": "< notebook server machine fqdn >",
            "Role": ["Server"],
            "SslCertificates": [
                {
                    "Path": "C:\\CERTS\\< pfx file >",
                    "Password": "< cert password >",
                    "CNameFQDN": "< notebook server machine fqdn >",
                    "Target": [
                        "Server"
                    ],
                    "SslRootOrIntermediate": [
                        {
                            "Alias": "< Root CA >",
                            "Path": "C:\\CERTS\\< crt file >"
                        }
                    ]
                }
            ]
        },
        {
            "NodeName": "< web adaptor machine fqdn >",
            "Role": ["WebAdaptor"],
            "WebAdaptorConfig": [
                {
                    "Role": "Server"
                }
            ],
            "SslCertificates": [
                {
                    "Path": "C:\\CERTS\\< pfx file >",
                    "Password": "< password >",
                                        "CNameFQDN": "< web adaptor machine fqdn >",
                    "Target": [
                        "WebAdaptor"
                    ]
                }
            ]
        }
    ],
    "ConfigData": {
        "Version": "11.3",
        "ServerRole": "NotebookServer",
        "ServerContext": "notebook",
        "Credentials": {
            "ServiceAccount": {
                "Password": "< password >",
                "UserName": "< username >",
                "IsDomainAccount": false,
                "IsMSAAccount": false
            }
        },
        "Server": {
            "LicenseFilePath": "< license file >",
            "Installer": {
                "Path": "C:\\iac\\powershell-dsc\\installers\\ArcGIS_Notebook_Server_Windows_113_190268.exe",
                "IsSelfExtracting": true,
                "InstallDir": "C:\\ArcGIS\\NotebookServer",
                "InstallDirPython": "C:\\Python3"
            },
            "ServerDirectoriesRootLocation": "C:\\arcgisnotebookserver\\directories",
            "ConfigStoreLocation": "C:\\arcgisnotebookserver\\config-store",
            "ContainerImagePaths": [
                "C:\\iac\\powershell-dsc\\installers\\ArcGIS_Notebook_Windows_Container_Image_113_190271.tar.gz"
            ],
            "ServerDirectories": [
                {
                    "name": "arcgisworkspace",
                    "path": "C:\\arcgisnotebookserver\\arcgisworkspace",
                    "type": "WORKSPACE"
                },
                {
                    "name": "arcgisoutput",
                    "path": "C:\\arcgisnotebookserver\\arcgisoutput",
                    "type": "OUTPUT"
                },
                {
                    "name": "arcgissystem",
                    "path": "C:\\arcgisnotebookserver\\arcgissystem",
                    "type": "SYSTEM"
                },
                {
                    "name": "arcgisjobs",
                    "path": "C:\\arcgisnotebookserver\\arcgisjobs",
                    "type": "JOBS"
                }
            ],
            "ServerLogsLocation": "C:\\arcgisnotebookserver\\logs",
            "PrimarySiteAdmin": {
                "UserName": "< username >",
                "Password": "< password >"
            }
        },
        "WebAdaptor": {
            "AdminAccessEnabled": true,
            "Installer": {
                "Path": "C:\\iac\\powershell-dsc\\installers\\ArcGIS_Web_Adaptor_for_Microsoft_IIS_113_190234.exe"
            }
        },
        "Federation": {
            "PortalHostName": "< web adaptor machine fqdn >",
            "PortalPort": "443",
            "PortalContext": "portal",
            "PortalAdministrator": {
                "UserName": "< username >",
                "Password": "< password >"
            }
        }
    }
}

Expected Behavior

When performing a single machine install of Notebook Server, the script will run the CreateSite command to generate the server site.

Actual Behavior

When performing a single machine fresh install of Notebook Server, a JoinSite operation is attempted instead of CreateSite, causing the script to fail as there is no site to join.

Steps to Reproduce

Run InstallLicenseConfigure using the example above. The Portal/Hosting server reside on Machine A (can provide config if needed), the Notebook Server on Machine B, and the Web Adaptors on Machine C.

Important Factoids

I believe the problem line of code is here: https://github.com/Esri/arcgis-powershell-dsc/blob/4e1ea910cf3c237c378dfcfc1130a296de3c4bcb/Modules/ArcGIS/Configurations-OnPrem/ArcGISNotebookServer.ps1#L138

In my testing, the value of $Node.NodeName was $null. Additionally, this appears to be the first reference to the variable $Node in the file, which leads me to believe that $Node.NodeName will always be $null. If I set $Join to $false, the script continues on and everything behaves as expected.

cameronkroeker commented 1 month ago

@skunz42 Great find. This will be addressed in the next release of the ArcGIS Module. For now, here is a workaround:

Move this line: https://github.com/Esri/arcgis-powershell-dsc/blob/4e1ea910cf3c237c378dfcfc1130a296de3c4bcb/Modules/ArcGIS/Configurations-OnPrem/ArcGISNotebookServer.ps1#L138

To after Line 198: https://github.com/Esri/arcgis-powershell-dsc/blob/4e1ea910cf3c237c378dfcfc1130a296de3c4bcb/Modules/ArcGIS/Configurations-OnPrem/ArcGISNotebookServer.ps1#L197-L201

For example:

Node $AllNodes.NodeName
    {
        $Join = if($Node.NodeName -ine $PrimaryServerMachine) { $true } else { $false }

        if($Node.Thumbprint){
            LocalConfigurationManager
            {

Thanks, Cameron K.

tigerwoulds commented 3 weeks ago

@cameronkroeker I ran into this with ArcGIS Mission Server 11.1 as well. Single machine deployment, on premise, version 4.3.0. DSC was trying to join a site that doesn't exist rather than creating a new site. Made the same change in ArcGISMisionServer.ps1. Moved line 129 to the Node $AllNodes.NodeName section on line 186 and that resolved my issue.

cameronkroeker commented 2 weeks ago

@cameronkroeker I ran into this with ArcGIS Mission Server 11.1 as well. Single machine deployment, on premise, version 4.3.0. DSC was trying to join a site that doesn't exist rather than creating a new site. Made the same change in ArcGISMisionServer.ps1. Moved line 129 to the Node $AllNodes.NodeName section on line 186 and that resolved my issue.

Thanks @tigerwoulds. This will be addressed for both Notebook Server and Mission Server in the next release (coming soon).

cameronkroeker commented 2 weeks ago

This has been fixed for both Notebook Server and Mission Server in DSC ArcGIS Module v4.4.0:

https://github.com/Esri/arcgis-powershell-dsc/releases/tag/v4.4.0