Esri / arcgis-cookbook

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

recipe[esri-tomcat] attempts to download remote_file despite apache-tomcat-9.0.48.tar.gz existing #357

Closed franchyze923 closed 1 year ago

franchyze923 commented 1 year ago

Trying to run https://github.com/Esri/arcgis-cookbook/tree/main/templates/arcgis-enterprise-base/11.1 on Linux.

I'm in an offline environment, so no internet access. I copied all the installers to the location defined in arcgis-enterprise-primary.json. It appears the Chef script fails to find the Tomcat installer and tries to download it from the internet, then fails.

In the code below from cookbooks\esri-tomcat\recipes\install.rb -

tomcat_install instance_name do
  version node['tomcat']['version']
  install_path node['tomcat']['install_path']
  tarball_path node['tomcat']['tarball_path']
  verify_checksum node['tomcat']['verify_checksum']
  tomcat_user node['tomcat']['user']
  tomcat_group node['tomcat']['group']
  create_user node['tomcat']['create_user']
  create_group node['tomcat']['create_group']
  tomcat_user_shell node['tomcat']['tomcat_user_shell']  
  create_symlink node['tomcat']['create_symlink']  
  symlink_path node['tomcat']['symlink_path'] 
  exclude_manager true
  exclude_hostmanager true 
  not_if { ::File.exist?(::File.join(node['tomcat']['install_path'], 'LICENSE')) }
end

I notice not_if { ::File.exist?(::File.join(node['tomcat']['install_path'], 'LICENSE')) } seems to be looking for the tomcat installer with "LICENSE" at the end of it? I believe this might be why it fails to find the file. I removed "LICENSE", and it progresses further but fails for other reasons. What isnot_if { ::File.exist?(::File.join(node['tomcat']['install_path'], 'LICENSE')) } supposed to be doing?

Thanks

pbobov commented 1 year ago

The tomcat_install resource in esri-tomcat::install recipe checks if LICENSE file exists in the tomcat install_path folder to determine if tomcat is already installed. If the file does exist, then the tomcat installation is skipped.

cameronkroeker commented 1 year ago

Hi @franchyze923,

I suspect even though the file exists locally, it is attempting to verify the checksum of the local file over the internet.

https://github.com/sous-chefs/tomcat/blob/57817bb56372191f30966b093df4dfadfd847dec/resources/install.rb#L77-L83

action :create_if_missing unless new_resource.verify_checksum

By default this is set to true:

https://github.com/Esri/arcgis-cookbook/tree/main/cookbooks/esri-tomcat#general

node['tomcat']['verify_checksum'] = Verify checksum of downloaded Tomcat tarball. Default value is true.

Trying adding the verify_checksum attribute to your arcgis-enterprise-primary.json file and set it to false. For example:

"tomcat": {
        "version": "9.0.48",
        "tarball_path": "/opt/software/archives/apache-tomcat-9.0.48.tar.gz",
        "install_path": "/opt/tomcat_arcgis_9.0.48",
        "verify_checksum": false
    },

Thanks, Cameron K.

franchyze923 commented 1 year ago

@cameronkroeker Thank you! Setting "verify_checksum": false allows it to progress.

df-sloughton commented 9 months ago

Im getting this when connected to the Internet, for ArcGIS Ent 10.9.1, using ArcGIS Cookbook 4.0.0 on Ubuntu 20.04, building with Packer. I can set it to false to probably make it work. But I think the root cause is the http request is now being 301 redirected to https, which makes the script fall over: i.e. http://archive.apache.org/dist/tomcat/tomcat-9/v9.0.48/bin/apache-tomcat-9.0.48.tar.gz.sha512 -> https://...

log:

remote_file[apache 9.0.48 tarball] action create[2024-02-19T05:28:03+00:00] FATAL: Fetching the Tomcat tarball checksum at http://archive.apache.org/dist/tomcat/tomcat-9/v9.0.48/bin/apache-tomcat-9.0.48.tar.gz.sha512 resulted in an error 301 2024-02-19T14:58:03+09:30: 1_arcgis_ubuntu.amazon-ebs.arcgis_server_ubuntu: [2024-02-19T05:28:03+00:00] FATAL: Could not fetch the checksum due to an error: 2024-02-19T14:58:03+09:30: 1_arcgis_ubuntu.amazon-ebs.arcgis_server_ubuntu: 2024-02-19T14:58:03+09:30: 1_arcgis_ubuntu.amazon-ebs.arcgis_server_ubuntu: 2024-02-19T14:58:03+09:30: 1_arcgis_ubuntu.amazon-ebs.arcgis_server_ubuntu: ================================================================================ 2024-02-19T14:58:03+09:30: 1_arcgis_ubuntu.amazon-ebs.arcgis_server_ubuntu: Error executing action create on resource 'remote_file[apache 9.0.48 tarball]' 2024-02-19T14:58:03+09:30: 1_arcgis_ubuntu.amazon-ebs.arcgis_server_ubuntu: ================================================================================ 2024-02-19T14:58:03+09:30: 1_arcgis_ubuntu.amazon-ebs.arcgis_server_ubuntu: 2024-02-19T14:58:03+09:30: 1_arcgis_ubuntu.amazon-ebs.arcgis_server_ubuntu: RuntimeError 2024-02-19T14:58:03+09:30: 1_arcgis_ubuntu.amazon-ebs.arcgis_server_ubuntu: ------------ 2024-02-19T14:58:03+09:30: 1_arcgis_ubuntu.amazon-ebs.arcgis_server_ubuntu: ...

cameronkroeker commented 9 months ago

Im getting this when connected to the Internet, for ArcGIS Ent 10.9.1, using ArcGIS Cookbook 4.0.0 on Ubuntu 20.04, building with Packer. I can set it to false to probably make it work. But I think the root cause is the http request is now being 301 redirected to https, which makes the script fall over: i.e. http://archive.apache.org/dist/tomcat/tomcat-9/v9.0.48/bin/apache-tomcat-9.0.48.tar.gz.sha512 -> https://...

Hi @df-sloughton I have posted 2 different workarounds here:

https://github.com/Esri/arcgis-cookbook/issues/380

Thanks, Cameron K.