4

I'm trying to migrate an elastic beanstalk app from Puma to Phusion Passenger. However, Passenger fails at startup with the error:

  /opt/elasticbeanstalk/support/conf/nginx_config.erb:48:in `block in write_nginx_config_file': undefined local variable or method `location_config_filename' for #<PhusionPassenger::Standalone::StartCommand:0x007f1eb35d06f0> (NameError)
    from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/erb.rb:863:in `eval'
    from /opt/rubies/ruby-2.2.2/lib/ruby/2.2.0/erb.rb:863:in `result'
    from /opt/rubies/ruby-2.2.2/lib/ruby/gems/2.2.0/gems/passenger-5.0.15/lib/phusion_passenger/standalone/start_command/nginx_engine.rb:120:in `block in write_nginx_config_file'

The Amazon stack name is:

64bit Amazon Linux 2015.03 v2.0.0 running Ruby 2.2 (Passenger Standalone)

The same app runs locally and on Heroku using Passenger. (It also runs OK with Puma).

Is there a required configuration file or configuration option I've missed?

(I'm using eb_deployer for blue-green deployment rather than the AWS Console - so it might be a default somewhere).

6

I was having the same issue and after some digging I found that the version of passenger Amazon was using on

64bit Amazon Linux 2015.03 v2.0.0

is Passenger 4.0.59.

If you just have gem "passenger" in your gemfile without specifying the version your app is installing v5.0 or newer which conflicts with the EBS setup. Whatever changes they made between 4.0.59 and 5.0 seems to be messing up the deploy because when I set the version in my gemfile and redeployed it worked.

gem "passenger", '~> 4.0.59'

After you update your gemfile and push the code make sure you terminate the instance to get a fresh one. After the deploy check the eb-activity.log for the line

Using passenger 4.0.59

EDIT: As Chris pointed out below you don't need to include passenger in your gem file since it is already included. This will prevent the issue all together, no need to worry about versions.

gem "passenger ", group: :development
  • 1
    This worked for me. FWIW, I had to rebuild my environment after I made the change in order for it to take effect. – Jason Swett Sep 14 '15 at 17:57
  • 5
    If you are using Elastic Beanstalk, you probably don't need passenger in your Gemfile since it is natively installed on the default Ruby AMI for Elastic Beanstalk. You should probably just do gem "passenger ", group: :development – chris finne Oct 11 '15 at 13:52
  • Confirmed that this is still the case. Don't add passenger to your Gemfile if EB is installing it for you, and you must rebuild your environment if you remove passenger and then redeploy. – Aidan Miles Apr 9 '19 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.