在Open shift中部署RoR Mysql的问题

时间:2014-06-03 09:10:10

标签: mysql ruby-on-rails openshift

我正在尝试在openshift中部署一个简单的RoR。我正在使用Ruby-1.9和mysql-5.1,该应用程序在本地部署中运行良好,并且它在openshift中不起作用。以前我有同样的问题,并且有一个openhift中的乘客融合开放的bug有任何一个修复此问题或者这仍然是一个问题。如果有任何工作请告诉我。 我在这里发布我的数据库yml配置。

mysql: &mysql
adapter: mysql2
database: "<%=ENV['OPENSHIFT_APP_NAME']%>"
username: "<%=ENV['OPENSHIFT_MYSQL_DB_USERNAME']%>"
password: "<%=ENV['OPENSHIFT_MYSQL_DB_PASSWORD']%>"
host:     <%=ENV['OPENSHIFT_MYSQL_DB_HOST']%>
port:     <%=ENV['OPENSHIFT_MYSQL_DB_PORT']%>
enter code here

我的rhc尾输出如下

==> app-root/logs/ruby.log <==
10.80.227.1 - - [03/Jun/2014:01:11:48 -0400] "HEAD / HTTP/1.1" 200 - "-" "Ruby"
10.80.227.1 - - [03/Jun/2014:01:11:48 -0400] "HEAD / HTTP/1.1" 200 - "-" "Ruby"
10.80.227.1 - - [03/Jun/2014:02:11:28 -0400] "HEAD / HTTP/1.1" 200 - "-" "Ruby"
10.80.227.1 - - [03/Jun/2014:02:11:28 -0400] "HEAD / HTTP/1.1" 200 - "-" "Ruby"
10.80.227.1 - - [03/Jun/2014:03:11:37 -0400] "HEAD / HTTP/1.1" 200 - "-" "Ruby"
10.80.227.1 - - [03/Jun/2014:03:11:37 -0400] "HEAD / HTTP/1.1" 200 - "-" "Ruby"
10.80.227.1 - - [03/Jun/2014:04:13:34 -0400] "HEAD / HTTP/1.1" 200 - "-" "Ruby"
10.80.227.1 - - [03/Jun/2014:04:13:34 -0400] "HEAD / HTTP/1.1" 200 - "-" "Ruby"
==> app-root/logs/mysql.log <==

    140602 21:52:59 mysqld_safe Logging to        '/var/lib/openshift/538ce6295973caef290000fd/mysql//stdout.err'.
140602 21:52:59 mysqld_safe Starting mysqld daemon with databases from /var/lib/openshift/538ce6295973caef290000fd/mysql/data/
140602 21:52:59 mysqld_safe Starting mysqld daemon with databases from /var/lib/openshift/538ce6295973caef290000fd/mysql/data/
140602 21:52:59  InnoDB: Initializing buffer pool, size = 32.0M
140602 21:52:59  InnoDB: Completed initialization of buffer pool
140602 21:53:00  InnoDB: Started; log sequence number 0 44233
140602 21:53:01 [Note] Event Scheduler: Loaded 0 events
140602 21:53:01 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.73'  socket: '/var/lib/openshift/538ce6295973caef290000fd/mysql//socket/mysql.sock'  port: 3306  Source distribution

出于测试目的,我在rails中有一个欢迎控制器和索引页面,可以与本地机器一起使用。 任何人都可以指出我正确的资源或帮助它对我有很大的帮助。

1 个答案:

答案 0 :(得分:1)

您的database.yml文件中有mysql: &mysql。试试这个

production:
  adapter: mysql2
  encoding: utf8
  database: <%=ENV['OPENSHIFT_APP_NAME']%>
  pool: 30
  timeout: 30000
  checkout_timeout: 30000
  host: <%=ENV['OPENSHIFT_MYSQL_DB_HOST']%>
  port: <%=ENV['OPENSHIFT_MYSQL_DB_PORT']%>
  username: <%=ENV['OPENSHIFT_MYSQL_DB_USERNAME']%>
  password: <%=ENV['OPENSHIFT_MYSQL_DB_PASSWORD']%>