在使用Rubber的EC2中部署rails应用程序后无法连接到服务器

时间:2013-03-06 19:18:55

标签: deployment amazon-ec2

我刚刚在EC2上部署了带有Rubber的rails应用程序。另外,为数据库创建了一个RDS实例。运行

$ cat /etc/host 

将生产中的橡胶配置设为enter image description here

但是当我浏览http://web01.musemebackend.com/admin/login时,我收到错误“504网关超时,服务器没有及时响应”

apache2中的错误日志显示:

[ pid=1813 thr=12161140 file=utils.rb:176 time=2013-03-06 20:49:28.175 ]: 
*** Exception PhusionPassenger::UnknownError in PhusionPassenger::Rack::ApplicationSpawner (Can't connect to MySQL server on 'musemedb.cfmz4gvshyts.us-east-1.rds.amazonaws.com' (110) (Mysql2::Error)) (process 1813, thread #<Thread:0x000000017320e8>):

我修改了config / database.yml:

production:
  adapter: mysql2
  encoding: utf8
  database: muse_me_backend_production
  username: app_admin
  password: MYPASSWORD
  host: musemedb.cfmz4gvshyts.us-east-1.rds.amazonaws.com
  port: 3306

将config / rubber / rubber-mysql.yml修改为:

# REQUIRED: The credentials for creating/accessong your app's database
#
db_user: app_admin
db_pass: MYPASSWORD
db_name: muse_me_backend_production
db_host: musemedb.cfmz4gvshyts.us-east-1.rds.amazonaws.com

和config / rubber / common / database.yml为

<%
  @path = "#{Rubber.root}/config/database.yml"
%>

<%= Rubber.env %>:
  adapter: <%= YAML::load(File.open("#{Rubber.root}/config/database.yml"))["production"]["adapter"] %>
  encoding: utf8
  database: <%= rubber_env.db_name %>
  username: <%= rubber_env.db_user %>
  password: <%= rubber_env.db_pass %>
  host: <%= rubber_env.db_host %>
  pool: 5

应该成功部署应用。数据库迁移也成功进行了迁移。有什么我错过连接服务器?我是否需要拥有musemebackend.com的域名?现在我不拥有它。我在教程中看到它只是foo.com。那有关系吗?

由于

1 个答案:

答案 0 :(得分:0)

问题是我没有将应用程序角色实例的安全组添加到数据库安全组。现在已经修好了。