jeudi 29 mai 2014

Ruby - application de rails déployée à élastique haricot magique ne connet à RDS - Stack Overflow


I'm trying to deploy my app to Elastic Beanstalk by following this tutorial.


The app works if I use splite3, but I can't connect the app to RDS.


I added group :production do gem 'mysql2' end in Gemfile, and this code to config/database.yml.


production:
adapter: mysql2
encoding: utf8
database: <%= ENV['RDS_DB_NAME'] %>
username: <%= ENV['RDS_USERNAME'] %>
password: <%= ENV['RDS_PASSWORD'] %>
host: <%= ENV['RDS_HOSTNAME'] %>
port: <%= ENV['RDS_PORT'] %>

I added RDS in Elastic Beanstalk console.


But production.log shows error, that indicates DB connection fails.


-------------------------------------
/var/app/support/logs/production.log
-------------------------------------
I, [2014-02-09T16:01:56.520967 #29379] INFO -- : Started GET "/" for xxx.xxx.xxx.xxx at 2014-02-09 16:01:56 +0000
I, [2014-02-09T16:01:56.620738 #29379] INFO -- : Processing by PostsController#index as HTML
E, [2014-02-09T16:01:56.629835 #29379] ERROR -- : Mysql2::Error: Table 'ebdb.posts' doesn't exist: SELECT `posts`.* FROM `posts`
I, [2014-02-09T16:01:56.630802 #29379] INFO -- : Rendered posts/index.html.erb within layouts/application (4.3ms)
I, [2014-02-09T16:01:56.631068 #29379] INFO -- : Completed 500 Internal Server Error in 10ms
F, [2014-02-09T16:01:56.633962 #29379] FATAL -- :
ActionView::Template::Error (Mysql2::Error: Table 'ebdb.posts' doesn't exist: SELECT `posts`.* FROM `posts`):

eb status shows like this.


URL     : myAppURL
Status : Ready
Health : Green

RDS Database: AWSEBRDSDatabase | myDatabaseURL:port

Probably I miss something very basic. What should I do to fix this problem?



I'm trying to deploy my app to Elastic Beanstalk by following this tutorial.


The app works if I use splite3, but I can't connect the app to RDS.


I added group :production do gem 'mysql2' end in Gemfile, and this code to config/database.yml.


production:
adapter: mysql2
encoding: utf8
database: <%= ENV['RDS_DB_NAME'] %>
username: <%= ENV['RDS_USERNAME'] %>
password: <%= ENV['RDS_PASSWORD'] %>
host: <%= ENV['RDS_HOSTNAME'] %>
port: <%= ENV['RDS_PORT'] %>

I added RDS in Elastic Beanstalk console.


But production.log shows error, that indicates DB connection fails.


-------------------------------------
/var/app/support/logs/production.log
-------------------------------------
I, [2014-02-09T16:01:56.520967 #29379] INFO -- : Started GET "/" for xxx.xxx.xxx.xxx at 2014-02-09 16:01:56 +0000
I, [2014-02-09T16:01:56.620738 #29379] INFO -- : Processing by PostsController#index as HTML
E, [2014-02-09T16:01:56.629835 #29379] ERROR -- : Mysql2::Error: Table 'ebdb.posts' doesn't exist: SELECT `posts`.* FROM `posts`
I, [2014-02-09T16:01:56.630802 #29379] INFO -- : Rendered posts/index.html.erb within layouts/application (4.3ms)
I, [2014-02-09T16:01:56.631068 #29379] INFO -- : Completed 500 Internal Server Error in 10ms
F, [2014-02-09T16:01:56.633962 #29379] FATAL -- :
ActionView::Template::Error (Mysql2::Error: Table 'ebdb.posts' doesn't exist: SELECT `posts`.* FROM `posts`):

eb status shows like this.


URL     : myAppURL
Status : Ready
Health : Green

RDS Database: AWSEBRDSDatabase | myDatabaseURL:port

Probably I miss something very basic. What should I do to fix this problem?


0 commentaires:

Enregistrer un commentaire