All I'm trying to do is deploy my Rails app on Heroku with a db instance on RDS, which seems like it should be straightforward.
I'm using the mysql2 adapter in my database.yml
and have pushed to heroku and added my db instance per this answer. I've basically followed it to a T, and I don't get a missing gem
error. But this is what the heroku logs
reveal:
/app/vendor/bundle/ruby/1.9.1/bundler/gems/mysql2-e5992664a7bc/lib/mysql2/client.rb:56:in connect': Can't connect to MySQL server on 'nickcoxrails.cud3e2tma07q.us-east-1.rds.amazonaws.com' (110) (Mysql2::Error)
Also notice that my RDS instance is in us-east, which I heard is an issue here.
In my gemfile, I have:
gem 'mysql2', :git => 'git://github.com/brianmario/mysql2.git'
for my mysql2 gem because it was the only way I could get it working locally (because using the version < 0.3 per that first answer gave me an error on my local rails server because I'm on Rails 3.2.6), having tried a number of things (I really had trouble getting mysql running on my local machine).
I have definitely added the security groups per this answer and have added the mysql2 database per this answer. I have also added the RDS add-on in my heroku account. I ran rake db:create
and rake db:schema:load
and rake db:migrate
and everything, but since I exported my local db to my RDS instance (I need to keep that data intact), none of that does anything new. And I can connect to my RDS instance through Sequel Pro, so I know its not a credentials issue.
This is my first Rails app deployment, so don't be afraid to dumb down your answers and give me the equivalent of the "Is it plugged in?" tech support questions for heroku/Rails/RDS/etc.
heroku conifig:get DATABASE_URL
, it echoes my RDS database, so I assume that's set up correctly. Is that a reasonable assumption? – nickcoxdotmeDATABASE_URL
is set your RDS instance, that suggests it was set up correctly. Did you runrds-authorize-db-security-group-ingress
as mentioned after installing the addon? The error message suggests this might be the issue. – Michael Mior