【问题标题】:Rails AWS: Main Welcome Page Won't Go AwayRails AWS:欢迎主页面不会消失
【发布时间】:2014-02-14 13:46:05
【问题描述】:

我有一个使用 postgresql 运行的基本 Rails 应用程序。在当地,它像蛤蜊一样快乐。我已经运行了 eb init、eb start 和 eb status,它们返回 url、状态就绪和健康绿色。在本地,我的更改显示在我的 rails 应用程序上(没有什么强烈的,只是某个不是 beanstalk 欢迎屏幕的根目录)。当我 git aws.push 它推送到正确的环境名称,愉快地按下并压缩对象,以“远程到”+长字符串+“HEAD -> master(强制更新)”结束。

我等到 git "eb status" 再次变为绿色(它表示最初正在更新,所以它显然会转到正确的位置),然后转到指定的 url...并且 beanstalk 问候仍然存在。

(不再相关;似乎此解决方案仅适用于早期版本的 rails;保留它以使评论清晰)此人 (Amazon Web Services Beanstalk, git aws.push appears to push, but doesn't change anything) 有类似的问题,但是当我键入“git rm public/index .html” 我得到“致命:pathspec 'public/index.html' 不匹配任何文件”。

我使用的是 Rails 4.0.1。有任何想法吗?

编辑:

我认为问题可能与未使用 RDS 有关;当我使用一个时,这个问题不存在。但是在这个应用程序上,我试图运行一个本地 Postgresql,类似于我在 Heroku 上的运行方式......

编辑:

我的路线文件

App::Application.routes.draw do
   resources :users

   root "users#show"
end

编辑:

看看 EC2,它在最近的活动中声明

Instance: i-9ebf03b0 Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on      instance. 
Return code: 1 Output: Error occurred during build: Command hooks failed. 

查看日志我看到了这个:

Installing pg (0.17.1) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /usr/bin/ruby1.9 extconf.rb 
    checking for pg_config... no
    No pg_config... trying anyway. If building fails, please try again with --with-pg-config=/path/to/pg_config
    checking for libpq-fe.h... no
    Can't find the 'libpq-fe.h header
    *** extconf.rb failed ***
    Could not create Makefile due to some reason, probably lack of
    necessary libraries and/or headers.  Check the mkmf.log file for more details.  You    
    may need configuration options

根据上述情况,研究和尝试各种事情;只是想保持帮助,询问人们更新:)

【问题讨论】:

  • public/index.html 已在 rails 4.0 中默认被删除,因此该文件将不可用。
  • 用你的配置/路由文件更新 qsn
  • 您能否对 qsn 和 config/routes 文件更具体一点?我不知道 qsn 代表什么...
  • 可以使用您的 rails 应用程序中的 config/routes 文件更新您的问题
  • 有问题的解决方案指向使用 rails 3.2.4 的应用程序。此版本在创建 rails 应用程序时创建 public/index.html。当 Morgan 使用不包含 public/index.html 文件的 rails 4 时。

标签: ruby-on-rails amazon-web-services amazon-elastic-beanstalk


【解决方案1】:

您可能希望将其添加到配置中以便扩展:

$ cat .ebextensions/postgres.config
packages:
  yum:
    postgresql-devel: []

【讨论】:

    【解决方案2】:

    解决了!

    如果我转到处理 Rails 应用程序的 EC2 实例并键入以下内容,它可以解决问题。

    sudo yum install postgresql postgresql-server postgresql-devel postgresql-contrib postgresql-docs postgresql-libs

    回想起来,我希望我已经一一输入上述内容,看看究竟是哪个解决了问题,但都一样。

    【讨论】:

    • 我将根据自己使用 Rails+Beanstalk 的经验提供一些说明。默认情况下,beantalk 实例会在将实例添加到负载均衡器之前尝试“捆绑安装”。 mysql2 gem 安装没有问题,这意味着 Amazon 提供的实例已经具有编译该 gem 的依赖项,但是(从 Morgan 的错误消息推断)它没有 Postgres 标头/库。默认情况下它当然不会运行 Postgres 服务器,但那将是一个单独的错误。
    猜你喜欢
    • 2020-07-23
    • 2012-09-04
    • 2019-10-19
    • 2019-03-28
    • 2018-01-24
    • 2020-11-02
    • 2015-07-10
    • 2022-01-23
    • 2019-11-13
    相关资源
    最近更新 更多