Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to execute chef script from user_data #330

Open
Ayushyadav19 opened this issue Oct 7, 2022 · 5 comments
Open

Unable to execute chef script from user_data #330

Ayushyadav19 opened this issue Oct 7, 2022 · 5 comments

Comments

@Ayushyadav19
Copy link

Hi @cameronkroeker,

We are trying to install Portal for ArcGIS 10.9.1 on an AWS ec2 RHEL 7.9 instance. The deployment needs to be a "one-click" approach and hence we are using terraform to provision and configure the ec2 instance.

We prepare and configured the instance using a bash script under the user_data parameter. However. the ArcGIS Portal installation does not go through entirely. It seems as though it gets stuck at installing/configuring tomcat The chef script logs display the following message.
image

We confirmed that the firewalld is set up on the machine and the port numbers are also added as an exception. However, this still fails at the same stage.

Interestingly, if we do not run the command to execute the Chef Script from user_data, the installation goes through successfully. This tells me that there is no issue with the machine setup/system requirements.

Any thoughts/suggestions on how to achieve this Chef Script execution from user_data would be helpful.

Thank you
Ayush

@cameronkroeker
Copy link
Contributor

Hi @Ayushyadav19,

Looks like it is getting stuck here:

execute 'init firewalld' do
command node['tomcat']['firewalld']['init_cmd']
action :nothing
end

The default node['tomcat']['firewalld']['init_cmd'] attribute is set to execute:

firewall-cmd --zone=public --permanent --add-port=0-65535/tcp.

This opens all ports, which could be getting blocked since it's already setup. If you are configuring the firewalld rules and port forwarding prior then you can set node['tomcat']['forward_ports'] attribute to false so that it doesn't run the firewalld recipe.

node['tomcat']['forward_ports'] = If set to true, default recipe includes the 'firewalld' or 'iptables' recipe. Default value is true.

Thanks,
Cameron K.

@Ayushyadav19
Copy link
Author

Hi @cameronkroeker,

We have bypassed the issue with the steps that you suggested but, we are facing issues with the ArcGIS portal setup. The chef log file shows the following error -

FATAL: Mixlib::ShellOut::CommandTimeout: arcgis_enterprise_portal[Install Portal for ArcGIS] (arcgis-enterprise::install_portal line 53) had an error: Mixlib::ShellOut::CommandTimeout: Command timed out after 30s:
Command exceeded allowed execution time, process terminated
---- Begin output of su arcgisservice -c "/home/arcgisservice/arcgis/portal/stopportal.sh" ----
STDOUT: Stopping Portal for ArcGIS...
STDERR: Session terminated, killing shell... ...killed.
---- End output of su arcgisservice -c "/home/arcgisservice/arcgis/portal/stopportal.sh" ----

Attaching the log file for your reference.
We manually executed the chef script again from the terminal and it ran successfully.
Any suggestions/insights on bypassing the error will be truly appreciated.

Thanks
Ayush

BEDLinuxPortal.log

@cameronkroeker
Copy link
Contributor

Hi @Ayushyadav19,

The cookbooks use the built in stopportal.sh tool to stop the service after the setup completes, so that later it can start the portal service using systemd. Looks like the command to stop portal after installation timed out. However, I am not quite sure what would cause it to take longer than 30 seconds. Check to see if there are any clues within the portal logs.

If you manually run the command how long does it take for portal to stop?

su arcgisservice -c "/home/arcgisservice/arcgis/portal/stopportal.sh"

If the timeout needs to be increased, modify it here:

cmd = Mixlib::ShellOut.new("su #{node['arcgis']['run_as_user']} -c \"#{cmd}\"", {:timeout => 30})

@Ayushyadav19
Copy link
Author

Hi @cameronkroeker,

I increased the timeout from the 30s to the 300s and after that when we ran the chef script we encountered the following error.
image

I am writing down the following steps on how I increased the timeout in the portal.rb:-

  1. Download the latest cookbook 4.0.0 tar.gz file
  2. Unzip using 7zip
  3. Increased the timeout from the 30s to 300s in the cookbooks/arcgis-enterprise/providers/portal.rb file
  4. Again zip it using 7zip
  5. Copied to RHEL 7.9 ec2 instance
  6. Unzip again using user data in /opt/cinc directory
  7. Executed the cinc-client command

Let me know if you have any thoughts on the error that we are facing.

Thanks
Ayush

@cameronkroeker
Copy link
Contributor

Hi @Ayushyadav19,

For the 412 "Precondition Failed" error, could you provide the stacktrace.out? There could be useful or helpful information in there.

Thanks,
Cameron K.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants