Error deploying Rails 5 application with Sinatra 2.0.0beta2 on Amazon Linux AMI

I came across an exception from Sinatra 2.0.0 beta 2 with Rails 5 deploying to Amazon Linux AMI v 2.1. 6. I posted the question in the Sinatra Github repro, but was asked to post it here.

Edit: I came across this with Elastic Beanstalk, but as @neal reports that this also happens with the deployment of Capistrano in EC2.

Following are the steps to reproduce the problem:

  • Make a new Rails 5 app in a clean directory

    $ gem install rails $ rails --version (confirm Rails 5.0.0.1) $ rails new test-app 

Add this line to the gemfile:

 gem 'sinatra', '2.0.0.beta2' 
  1. Create a new Elastic Beanstalk web environment such as "64-bit Amazon Linux 2016.03 v2.1.6 running Ruby 2.3 (Puma)," a web server. Use all the defaults except resizing the instance on t2.small (thereโ€™s not enough memory to deploy for something less)

  2. Add two new environment variables to the Elastic Beanstalk environment using the web console SECRET_KEY_BASE = (set the value for this) RAILS_ENV = production

  3. Deploy the application in this new environment, for example, using the eb command-line tools.

  4. Deploy it again
  5. Tail logs through the Elastic Beanstalk console.

RESULT:

 ------------------------------------- /var/log/puma/puma.log ------------------------------------- === puma startup: 2016-08-26 02:39:12 +0000 === === puma startup: 2016-08-26 02:39:12 +0000 === [15926] - Worker 0 (pid: 15929) booted, phase: 0 [15926] - Gracefully shutting down workers... /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/sinatra-2.0.0.beta2/lib/sinatra/main.rb:11:in `expand_path': No such file or directory - getcwd (Errno::ENOENT) from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/sinatra-2.0.0.beta2/lib/sinatra/main.rb:11:in `block in <class:Application>' from (eval):1:in `run?' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/sinatra-2.0.0.beta2/lib/sinatra/main.rb:26:in `block in <module:Sinatra>' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/cluster.rb:120:in `fork' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/cluster.rb:120:in `block in spawn_workers' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/cluster.rb:116:in `times' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/cluster.rb:116:in `spawn_workers' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/cluster.rb:426:in `run' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/launcher.rb:172:in `run' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/lib/puma/cli.rb:74:in `run' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/puma-3.6.0/bin/puma:10:in `<top (required)>' from /opt/rubies/ruby-2.3.1/bin/puma:23:in `load' from /opt/rubies/ruby-2.3.1/bin/puma:23:in `<top (required)>' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.1/lib/bundler/cli/exec.rb:63:in `load' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.1/lib/bundler/cli/exec.rb:63:in `kernel_load' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.1/lib/bundler/cli/exec.rb:24:in `run' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.1/lib/bundler/cli.rb:304:in `exec' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.1/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.1/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.1/lib/bundler/cli.rb:11:in `start' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.1/exe/bundle:27:in `block in <top (required)>' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.1/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors' from /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.1/exe/bundle:19:in `<top (required)>' from /opt/rubies/ruby-2.3.1/bin/bundle:23:in `load' from /opt/rubies/ruby-2.3.1/bin/bundle:23:in `<main>' [15926] === puma shutdown: 2016-08-26 02:41:17 +0000 === [15926] - Goodbye! === puma startup: 2016-08-26 02:41:20 +0000 === === puma startup: 2016-08-26 02:41:20 +0000 === [16296] - Worker 0 (pid: 16299) booted, phase: 0 
+6
source share
1 answer

This is not just an elastic bean problem, I can confirm it also when deploying rails 5 application using capistrano / EC2 Ubuntu / nginx

0
source

All Articles