Esri / arcgis-cookbook

Chef cookbooks for ArcGIS
Apache License 2.0
300 stars 116 forks source link

ArcGIS Enterprise Server Authorisation Failing #269

Closed MattoHopkins closed 3 years ago

MattoHopkins commented 3 years ago

Hey guys,

Was told to open a ticket here, but the silent install done for authorising the arcgis-enterprise::server cookbook is failing.

I've had the license triple checked, and thats confirmed to be correct. This will only work if I manually run through the GUI brought up when double clicking the license, after the first run has failed. Error detailed below.

  * arcgis_enterprise_server[Authorize ArcGIS Server] action authorize

  * arcgis_enterprise_server[Stop ArcGIS Server] action stop

  * file[Cache server authorization file] action create (skipped due to only_if)
  * file[Cache server authorization file] action nothing (skipped due to action :nothing)
  * template[F:\ArcGIS\Server/framework/etc/hostname.properties] action create (up to date)
  * arcgis_enterprise_server[Stop ArcGIS Server] action nothing (skipped due to action :nothing)
  * arcgis_enterprise_server[Start ArcGIS Server] action start

  * directory[F:\arcgisserver] action create (up to date)
  * directory[F:\arcgisserver\logs] action create (up to date)
  * arcgis_enterprise_server[Create ArcGIS Server site] action create_site[2021-03-11T12:21:44+13:00] ERROR: Failed to create ArcGIS Server site. Failed to create the site. The machine does not have a valid license. Please authorize using the Software Authorization for ArcGIS Server wizard.
[2021-03-11T12:22:15+13:00] ERROR: Failed to create ArcGIS Server site. Failed to create the site. The machine does not have a valid license. Please authorize using the Software Authorization for ArcGIS Server wizard.
[2021-03-11T12:22:45+13:00] ERROR: Failed to create ArcGIS Server site. Failed to create the site. The machine does not have a valid license. Please authorize using the Software Authorization for ArcGIS Server wizard.
[2021-03-11T13:11:09+13:00] ERROR: Failed to create ArcGIS Server site. Failed to create the site. The machine does not have a valid license. Please authorize using the Software Authorization for ArcGIS Server wizard.
[2021-03-11T13:11:39+13:00] ERROR: Failed to create ArcGIS Server site. Failed to create the site. The machine does not have a valid license. Please authorize using the Software Authorization for ArcGIS Server wizard.
[2021-03-11T13:12:09+13:00] ERROR: Failed to create ArcGIS Server site. Failed to create the site. The machine does not have a valid license. Please authorize using the Software Authorization for ArcGIS Server wizard.

    ================================================================================
    Error executing action `create_site` on resource 'arcgis_enterprise_server[Create ArcGIS Server site]'
    ================================================================================

    RuntimeError
    ------------
    Failed to create the site. The machine does not have a valid license. Please authorize using the Software Authorization for ArcGIS Server wizard.

    Cookbook Trace: (most recent call first)
    ----------------------------------------
    C:/Users/adm_matthew/.chef/local-mode-cache/cache/cookbooks/arcgis-enterprise/libraries/server_admin_client.rb:1058:in `validate_response'
    C:/Users/adm_matthew/.chef/local-mode-cache/cache/cookbooks/arcgis-enterprise/libraries/server_admin_client.rb:232:in `create_site'
    C:/Users/adm_matthew/.chef/local-mode-cache/cache/cookbooks/arcgis-enterprise/providers/server.rb:259:in `block in class_from_file'

    Resource Declaration:
    ---------------------
    # In C:/Users/adm_matthew/.chef/local-mode-cache/cache/cookbooks/arcgis-enterprise/recipes/server.rb

     89: arcgis_enterprise_server 'Create ArcGIS Server site' do
     90:   server_url node['arcgis']['server']['url']
     91:   username node['arcgis']['server']['admin_username']
     92:   password node['arcgis']['server']['admin_password']
     93:   server_directories_root node['arcgis']['server']['directories_root']
     94:   system_properties node['arcgis']['server']['system_properties']
     95:   log_level node['arcgis']['server']['log_level']
     96:   log_dir node['arcgis']['server']['log_dir']
     97:   max_log_file_age node['arcgis']['server']['max_log_file_age']
     98:   config_store_connection_string node['arcgis']['server']['config_store_connection_string']
     99:   config_store_connection_secret node['arcgis']['server']['config_store_connection_secret']
    100:   config_store_type node['arcgis']['server']['config_store_type']
    101:   retries 5
    102:   retry_delay 30
    103:   action :create_site
    104: end
    105:

    Compiled Resource:
    ------------------
    # Declared in C:/Users/adm_matthew/.chef/local-mode-cache/cache/cookbooks/arcgis-enterprise/recipes/server.rb:89:in `from_file'

    arcgis_enterprise_server("Create ArcGIS Server site") do
      action [:create_site]
      default_guard_interpreter :default
      declared_type :arcgis_enterprise_server
      cookbook_name "arcgis-enterprise"
      recipe_name "server"
      retries 5
      retry_delay 30
      server_url "https://xxxxxxx/arcgis"
      username "xxxxx"
      password "xxxx"
      server_directories_root "F:\\arcgisserver"
      system_properties {}
      log_level "WARNING"
      log_dir "F:\\arcgisserver\\logs"
      max_log_file_age 90
      config_store_connection_string "F:\\arcgisserver\\config-store"
      config_store_connection_secret ""
      config_store_type "FILESYSTEM"
    end

    System Info:
    ------------
    chef_version=16.6.14
    platform=windows
    platform_version=10.0.17763
    ruby=ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x64-mingw32]
    program_name=C:/opscode/chef/bin/chef-client
    executable=C:/opscode/chef/bin/chef-client
cameronkroeker commented 3 years ago

Hi @MattoHopkins,

* arcgis_enterprise_server[Authorize ArcGIS Server] action authorize indicates that the authorization didn't fail.

What type of ArcGIS Server authorization file are you using (.prvc)? What version is ArcGIS Server?

Do you see a `keycodes' file in the following two locations:

If the keycodes file is present in both locations, open it with a text editor, does the contents match your license file (expiration date ecp# etc). Check to ensure it doesn't have multiple versions within the keycodes file and doesn't contain expired licenses.

Are there more than one C:\Program Files\ESRI\License10.x folders? (for example: C:\Program Files\ESRI\License10.7\sysgen and C:\Program Files\ESRI\License10.8\sysgen)?

Try removing or renaming the keycodes file from both locations, re-run chef and if it fails send chef logs, along with your json file (can scrub out any sensitive info like machine names passwords etc).

Thanks, Cameron K.

MattoHopkins commented 3 years ago

Hey @cameronkroeker,

I want to say this has been resolved. I have run into another issue, in which the :install action is run, this GUI pops up:

image

Not sure if its better to open another ticket, or if I've just missed something? It doesn't seem that the /qn command that gets passed when trying to install, actually passes anything to the Setup.exe, as even after extracting the files, the GUI for the server install pops up. Have hit this issue with the normal GIS Server setup as well.

Appreciate the help, not overly sure how the full install works as this is my first time trying to deploy with the chef cookbooks

Edit: I'm actually getting this for all of the Setup calls (Portal/GeoEvent/Server)

Versions of setup files: Portal: Portal_for_ArcGIS_Windows_1081_175214 Server: ArcGIS_Server_Windows_1081_175203 GeoEvent: ArcGIS_GeoEvent_Server_1081_175242

Using most recent cookbooks as well

cameronkroeker commented 3 years ago

Hi @MattoHopkins,

Glad to here the authorization/create site issue is resolved.

For the second issue regarding the setup GUI popup, if you are using the setup archive file (Portal_for_ArcGIS_Windows_1081_175214.exe, ArcGIS_Server_Windows_1081_175203.exe, ArcGIS_GeoEvent_Server_1081_175242.exe) then you will either want to use the node['arcgis']['server']['setup_archive'] attribute (not the node['arcgis']['server']['setup'] attribute) or place these in a local dir (or file share) and use the node['arcgis']['repository']['archives'] attribute.

Examples using the setup_archive attibutes:

{
  "arcgis": {
     "version": "10.8.1",
     "server": {
       "setup_archive": "C:\\Software\\Archives\\ArcGIS_Server_Windows_1081_175203.exe",
       "install_dir": "C:\\Program Files\\ArcGIS\\Server"
     },
     "portal": {
        "setup_archive": "C:\\Software\\Archives\\Portal_for_ArcGIS_Windows_1081_175214.exe",
        "install_dir": "C:\\Program Files\\ArcGIS\\Portal"
     },
     "geoevent": {
        "setup_archive": "C:\\Software\\Archives\\ArcGIS_GeoEvent_Server_1081_175242.exe"
     }
}

Example using arcgis repository:

{
  "arcgis": {
     "version": "10.8.1",
     "repository": {
        "archives": "C:\\Software\\Archives"
     },
     "server": {
        "install_dir": "C:\\Program Files\\ArcGIS\\Server"
     },
     "portal": {
        "install_dir": "C:\\Program Files\\ArcGIS\\Portal"
     },
     "geoevent": {

     }
}

https://github.com/Esri/arcgis-cookbook/blob/master/cookbooks/arcgis-enterprise/attributes/server.rb#L125-L126

The node['arcgis']['server']['setup'] is used if you have already manually extracted the setup archive file (C:\Users\adm_matthew\Documents\ArcGIS 10.8.1\ArcGISServer\Setup.exe).

{
  "arcgis": {
     "version": "10.8.1",
     "server": {
       "setup": "C:\\Users\\adm_matthew\\Documents\\ArcGIS 10.8.1\\ArcGISServer\\Setup.exe",
       "install_dir": "C:\\Program Files\\ArcGIS\\Server"
     },
     "portal": {
        "setup": "C:\\Users\\adm_matthew\\Documents\\ArcGIS 10.8.1\\PortalForArcGIS\\Setup.exe",
        "install_dir": "C:\\Program Files\\ArcGIS\\Portal"
     },
     "geoevent": {
        "setup": "C:\\Users\\adm_matthew\\Documents\\ArcGIS 10.8.1\\ArcGISGeoEventServer\\Setup.exe"
     }
}

Thanks, Cameron K.

MattoHopkins commented 3 years ago

Hey @cameronkroeker,

Thanks for all this, I can say that I've been successful in installing the software as a whole. There is a requirement for us to have multiple WebAdapters on our IIS machine which has enterprise:server and enterprise:portal and the WA's attached to that. Is there a way to add more than those two? We're trying to attach our Geoevent server via a third webadaptor but I'm unfamiliar with the process.

Appreciate your time

cameronkroeker commented 3 years ago

Hey @cameronkroeker,

Thanks for all this, I can say that I've been successful in installing the software as a whole. There is a requirement for us to have multiple WebAdapters on our IIS machine which has enterprise:server and enterprise:portal and the WA's attached to that. Is there a way to add more than those two? We're trying to attach our Geoevent server via a third webadaptor but I'm unfamiliar with the process.

Appreciate your time

Hi @MattoHopkins,

Currently, the cookbook only supports installing 2 web adaptors per node on Windows. To workaround this you can try modifying the following:

https://github.com/Esri/arcgis-cookbook/blob/ae704a00cef52d34057569e36214f8669d539266/cookbooks/arcgis-enterprise/attributes/webadaptor.rb#L40-L41

https://github.com/Esri/arcgis-cookbook/blob/ae704a00cef52d34057569e36214f8669d539266/cookbooks/arcgis-enterprise/recipes/install_server_wa.rb#L27-L29

https://github.com/Esri/arcgis-cookbook/blob/ae704a00cef52d34057569e36214f8669d539266/cookbooks/arcgis-enterprise/recipes/install_server_wa.rb#L44-L47

Keep in mind though this will impact uninstall, upgrades, and idempotentcy.

Product codes used to uninstall ArcGIS Web Adaptor. The list includes the first two product codes form each supported ArcGIS version:

https://github.com/Esri/arcgis-cookbook/blob/ae704a00cef52d34057569e36214f8669d539266/cookbooks/arcgis-enterprise/attributes/webadaptor.rb#L101-L120

Here is a link that contains all possible product codes for web adaptor at each version:

https://enterprise.arcgis.com/en/web-adaptor/latest/install/iis/uninstall-arcgis-web-adaptor-server.htm#ESRI_SECTION1_326BB299180643D7B57482343B9E4D39

Hope this helps!

Thanks, Cameron K.

MattoHopkins commented 3 years ago

@cameronkroeker

Cheers mate, that's sorted out the need for additional WebAdaptors and we've got a requirement for a few more later on and I'll be using the same methodology to add those in.

I think this is the last thing I'll bug you about, and I really appreciate your time once again.

For context, I've got a server with a few different ArcGIS recipes running (server,portal, WA's are the main ones) and a second server with server and geoevent running. I'm trying to federate the geoevent server back to that portal and I'm hitting a wall on the RunTimeError "internal server error" when running the cookbook.

Error: image

Attributes: image

Runlist for 'main' server: image

Runlist for 'geoevent' server: image

Hopefully that's enough info, and I really appreciate your help once again

cameronkroeker commented 3 years ago

Hi @MattoHopkins ,

I suspect the issue is with the server_admin_url. The federation recipe will use the node['arcgis']['server']['private_url'] attribute for the server_admin_url:

https://github.com/Esri/arcgis-cookbook/blob/ae704a00cef52d34057569e36214f8669d539266/cookbooks/arcgis-enterprise/recipes/federation.rb#L25

From the screen capture provided, it looks like ['arcgis']['server']['private_url'] was set to https://mahere-sbx.sbx-at.local, which is missing the port and context.

Example using internal 6443 url (include the port and context):

"server": {
   "private_url": "https://mahere-sbx.sbx-at.local:6443/arcgis"
}

Example using a webadaptor or loadbalancer/reverseproxy (note that Administrative access will need to be enabled on the web adaptor):

"server": {
   "private_url": "https://mahere-sbx.sbx-at.local/server"
}

Also note, if node['arcgis']['server']['private_url'] is not defined in your json file then the cookbook will default to using:

https://github.com/Esri/arcgis-cookbook/blob/ae704a00cef52d34057569e36214f8669d539266/cookbooks/arcgis-enterprise/attributes/server.rb#L46

Happy Automating, Cameron K.

MattoHopkins commented 3 years ago

Thanks man.

I had someone walk me through doing it manually and came to the same conclusion you did. Seems like I had gotten the url links messed up, and sorting that out to point to the WebAdaptor URL, and from the 2nd machine resolved it.

Been doing this pretty blind, so your helps been huge over the past month!

cameronkroeker commented 3 years ago

Thanks man.

I had someone walk me through doing it manually and came to the same conclusion you did. Seems like I had gotten the url links messed up, and sorting that out to point to the WebAdaptor URL, and from the 2nd machine resolved it.

Been doing this pretty blind, so your helps been huge over the past month!

You're welcome, and glad all the issues have been sorted out! I'm going to go ahead and close this thread, but if there are additional questions or issues please feel free to open a new one.

Thanks, Cameron K.