Amazon Elastic Beanstalk - Ruby (Rack) 应用程序无法启动

Posted

技术标签:

【中文标题】Amazon Elastic Beanstalk - Ruby (Rack) 应用程序无法启动【英文标题】:Amazon Elastic Beanstalk - Ruby (Rack) application could not be started 【发布时间】:2012-11-26 12:09:14 【问题描述】:

我想在 Amazon Elestic Beanstalk 上托管我的 rails 网站。我遵循了本指南:http://docs.amazonwebservices.com/elasticbeanstalk/latest/dg/create_deploy_Ruby_rails.html

现在,我遇到了这个错误:无法启动 Ruby (Rack) 应用程序

错误信息:

Could not find rake-10.0.2 in any of the sources (Bundler::GemNotFound) Exception class:

PhusionPassenger::UnknownError Application root:

/var/app/current

0 /usr/share/ruby/1.9/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/spec_set.rb 90 in `block in materialize'

1 /usr/share/ruby/1.9/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/spec_set.rb 83 in `map!'

2 /usr/share/ruby/1.9/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/spec_set.rb 83 in `materialize'

3 /usr/share/ruby/1.9/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/definition.rb 113 in `specs'

4 /usr/share/ruby/1.9/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/definition.rb 158 in `specs_for'

5 /usr/share/ruby/1.9/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/definition.rb 147 in `requested_specs'

6 /usr/share/ruby/1.9/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/environment.rb 23 in `requested_specs'

7 /usr/share/ruby/1.9/gems/1.9.1/gems/bundler-1.2.1/lib/bundler/runtime.rb 11 在“设置”中

8 /usr/share/ruby/1.9/gems/1.9.1/gems/bundler-1.2.1/lib/bundler.rb 116 in `setup'

9 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/utils.rb 326 in `prepare_app_process'

10 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/rack/application_spawner.rb 156 in `block in initialize_server'

11 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/utils.rb 563 in `report_app_init_status'

12 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/rack/application_spawner.rb 154 in `initialize_server'

13 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/abstract_server.rb 204 in `start_synchronously'

14 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/abstract_server.rb 180 in `start'

15 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/rack/application_spawner.rb 129 在“开始”中

16 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/spawn_manager_orig.rb 253 在 spawn_rack_application 的 `block (2 levels) '

17 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/abstract_server_collection.rb 132 in `lookup_or_add'

18 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/spawn_manager_orig.rb 246 in `block in spawn_rack_application'

19 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/abstract_server_collection.rb 82 in `block in synchronize'

20 prelude> 10:in `synchronize'

21 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/abstract_server_collection.rb 79 在“同步”中

“spawn_rack_application”中的 22 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/spawn_manager_orig.rb 244

23 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/spawn_manager_orig.rb 137 in `spawn_application'

24 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/spawn_manager.rb 16 in `spawn_application_with_env'

25 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/spawn_manager_orig.rb 275 in `handle_spawn_application'

26 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/abstract_server.rb 357 in `server_main_loop'

27 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/lib/phusion_passenger/abstract_server.rb 206 in `start_synchronously'

28 /var/lib/passenger-standalone/3.0.17-x86_64-ruby1.9.3-linux-gcc4.4.6-1002/support/helper-scripts/passenger-spawn-server 99 in `'

我的源代码中没有任何痕迹。我没有在互联网上找到任何东西。您可以在这里找到应用程序的源代码:https://github.com/GCorbel/comment-my-projects。

【问题讨论】:

【参考方案1】:

我正在经历这种情况,并发现这与 rake 本身无关。发生这种情况可能是因为您的其中一个 gem 没有安装。在我的例子中,它是 pg 没有被安装,因为它需要 pg_config 可执行文件。

所以,就我而言,为了解决这个问题,我将以下部分添加到 .ebextensions/default.config

packages:
  yum:
    git: []
    postgresql-devel: []

# Run rake tasks before an application deployment
container_commands:
  01bundler-pg:
    command: bundle config build.pg --with-pg-config=/usr/bin/pg_config

即使您不使用 pg,请检查您的任何 gem 是否需要安装开发头文件或可执行文件。

参考:https://forums.aws.amazon.com/thread.jspa?messageID=400055

【讨论】:

以上是关于Amazon Elastic Beanstalk - Ruby (Rack) 应用程序无法启动的主要内容,如果未能解决你的问题,请参考以下文章

在 Amazon Elastic Beanstalk 上安装 Anaconda

Amazon Elastic Beanstalk 腻子

Amazon Elastic Beanstalk 如何采用自定义 python 命令?

如何卸载 Amazon Elastic Beanstalk 命令行界面?

Elastic Beanstalk 是不是支持 Amazon 的 Aurora DB?

使用 RabbitMQ 的 Amazon Elastic Beanstalk 上的芹菜超时异常