aws / opsworks-cookbooks

Chef Cookbooks for the AWS OpsWorks Service
Other
1.05k stars 1.23k forks source link

No such file or directory - passenger-install-apache2-module #359

Closed zohaib-sarwar-confiz closed 8 years ago

zohaib-sarwar-confiz commented 8 years ago

I am using this cookbook for more than 6 months and suddenly I am getting this error message: My stack Setting said that i am using v3421 (Jun 11th 2015).

[2015-12-27T16:29:37+00:00] INFO: Processing package[libapr1-dev] action upgrade (passenger_apache2::default line 44) [2015-12-27T16:29:37+00:00] INFO: Processing package[libcurl4-openssl-dev] action install (passenger_apache2::default line 50) [2015-12-27T16:29:42+00:00] INFO: Processing ruby_block[ensure only our passenger version is installed by deinstalling any other version] action run (passenger_apache2::default line 54) [2015-12-27T16:29:42+00:00] INFO: Installing version 4.0.46 of Rubygem passenger ERROR: Error installing passenger: rack requires Ruby version >= 2.2.2. Successfully installed daemon_controller-1.2.0 [2015-12-27T16:29:50+00:00] INFO: ruby_block[ensure only our passenger version is installed by deinstalling any other version] called [2015-12-27T16:29:50+00:00] INFO: Processing execute[passenger_module] action run (passenger_apache2::default line 60)

Error executing action run on resource 'execute[passenger_module]'

Errno::ENOENT

No such file or directory - passenger-install-apache2-module

Resource Declaration:

In /var/lib/aws/opsworks/cache.stage2/cookbooks/passenger_apache2/recipes/default.rb

60: execute "passenger_module" do 61: command 'passenger-install-apache2-module -a' 62: creates node[:passenger][:module_path] 63: notifies :restart, "service[apache2]" 64: end

Compiled Resource:

Declared in /var/lib/aws/opsworks/cache.stage2/cookbooks/passenger_apache2/recipes/default.rb:60:in `from_file'

execute("passenger_module") do action "run" retries 0 retry_delay 2 command "passenger-install-apache2-module -a" backup 5 creates "/usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.46/buildout/apache2/mod_passenger.so" returns 0 cookbook_name "passenger_apache2" recipe_name "default" end

[2015-12-27T16:29:50+00:00] INFO: Running queued delayed notifications before re-raising exception [2015-12-27T16:29:50+00:00] INFO: template[apache2.conf] sending run action to bashlogdir_existence_and_restart_apache2 [2015-12-27T16:29:50+00:00] INFO: Processing bash[logdir_existence_and_restart_apache2] action run (apache2::default line 46) [2015-12-27T16:29:50+00:00] INFO: bash[logdir_existence_and_restart_apache2] ran successfully [2015-12-27T16:29:50+00:00] INFO: bash[logdir_existence_and_restart_apache2] not queuing delayed action restart on serviceapache2, as it's already been queued [2015-12-27T16:29:50+00:00] INFO: template[/etc/apache2/ports.conf] sending restart action to serviceapache2 [2015-12-27T16:29:50+00:00] INFO: Processing service[apache2] action restart (apache2::default line 32) [2015-12-27T16:29:54+00:00] INFO: service[apache2] restarted [2015-12-27T16:29:54+00:00] ERROR: Running exception handlers [2015-12-27T16:29:54+00:00] ERROR: Exception handlers complete [2015-12-27T16:29:54+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out [2015-12-27T16:29:54+00:00] ERROR: execute[passenger_module](passenger_apache2::default line 60) had an error: Errno::ENOENT: No such file or directory - passenger-install-apache2-module [2015-12-27T16:29:54+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

I am stuck.

wbingli commented 8 years ago

Recently rack gem updated to version 2.0.0 and requires ruby version at least 2.2.2. That's why you see the error message "rack requires Ruby version >= 2.2.2".

The latest agent version v3431 has fixed this issue. You may update your stack to this version.

zohaib-sarwar-confiz commented 8 years ago

Thanks for quick reply. I have add a new instance with agent version v3431 but now i am getting this error message:

2016-01-05T13:09:52+00:00] INFO: No monitoring-master node found. Skipping Ganglia client configuration. [2016-01-05T13:09:52+00:00] INFO: No db-master layer or MySQL RDS DB instance found. Skipping MySQL client package installation. [2016-01-05T13:09:52+00:00] INFO: Updating agent TARGET_VERSION to 3431-20151222151215 [2016-01-05T13:09:52+00:00] INFO: Userspace Ruby version is up-to-date (2.0.0 patch p648 release 1)

Recipe Compile Error in /var/lib/aws/opsworks/cache.stage2/cookbooks/rails/recipes/configure.rb

Chef::Exceptions::CookbookNotFound

Cookbook opsworks_postgresql not found. If you're loading opsworks_postgresql from another cookbook, make sure you configure the dependency in your metadata

Cookbook Trace:

/var/lib/aws/opsworks/cache.stage2/cookbooks/rails/recipes/configure.rb:19:in block in from_file' /var/lib/aws/opsworks/cache.stage2/cookbooks/rails/recipes/configure.rb:3:ineach' /var/lib/aws/opsworks/cache.stage2/cookbooks/rails/recipes/configure.rb:3:in `from_file'

Relevant File Content:

/var/lib/aws/opsworks/cache.stage2/cookbooks/rails/recipes/configure.rb:

12: node.default[:deploy][application][:database][:adapter] = OpsWorks::RailsConfiguration.determine_database_adapter(application, node[:deploy][application], "#{node[:deploy][application][:deploy_to]}/current", :force => node[:force_database_adapter_detection]) 13: deploy = node[:deploy][application] 14:
15: case node[:deploy][application][:database][:adapter] 16: when /mysql/ 17: include_recipe "mysql::client_install" 18: when "postgresql" 19>> include_recipe "opsworks_postgresql::client_install" 20: end 21:
22: template "#{deploy[:deploy_to]}/shared/config/database.yml" do 23: source "database.yml.erb" 24: cookbook 'rails' 25: mode "0660" 26: group deploy[:group] 27: owner deploy[:user] 28: variables(:database => deploy[:database], :environment => deploy[:rails_env])

[2016-01-05T13:09:52+00:00] ERROR: Running exception handlers [2016-01-05T13:09:52+00:00] ERROR: Exception handlers complete [2016-01-05T13:09:52+00:00] FATAL: Stacktrace dumped to /var/lib/aws/opsworks/cache.stage2/chef-stacktrace.out [2016-01-05T13:09:52+00:00] ERROR: Cookbook opsworks_postgresql not found. If you're loading opsworks_postgresql from another cookbook, make sure you configure the dependency in your metadata [2016-01-05T13:09:52+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

wbingli commented 8 years ago

The rails configure recipe works fine for me with postgresql. Do you have any custom cookbooks and is there any of them override the opsworks build-in cookbooks?

zohaib-sarwar-confiz commented 8 years ago

Your are right. I have a custom Layer in amazon opsworks stack.

13 built-in Chef recipes which are available by default and executes at custom layer are:

Custom Chef Recipes which are located at this repo https://github.com/zohaib-sarwar-confiz/custom-opsworks-cookbooks.git Note: where deploy folder and rails recipes were cloned from opsworks-cookbooks 6 months ago.

The following is list of recipes i execute at custom layer.

wbingli commented 8 years ago

The deploy and rails cookbooks which are cloned 6 months ago are out of sync with the latest agent cookbooks. The rails::configure requires a change in deploy cookbook, but it's overrided by your custom cookbook.

I would suggest you directly use built-in cookbooks or try to sync them again.

zohaib-sarwar-confiz commented 8 years ago

I had done exactly the same and it works. How can i prevent this happening again in future, for changes like rack gem updated to version 2.0.0 and requires ruby version at least 2.2.2.

wbingli commented 8 years ago

The problem is Passenger gem does not correctly pin their dependency rack gem. You can pin the rack gem version for passenger by installing rack gem before passenger. And this is how the latest agent fix this issue.