Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rake db:migrate runs in development AWS Beanstalk

I'm new to Beanstalk. I've created a Rails application and set the database production configuration to use the environment variables hopefully provided by AWS. I'm using Mysql (mysql2 gem), and want to use RDS and Passenger (I have no preference there).

On my development environment I can run the rails application with my local Mysql (it is just a basic application I've created for experimentation). I have added the passenger gem to Gemfile and bundled, but I'm using WEBBrick in development still.

The only thing I did not do by the book is that I did not use 'eb' but rather tried from the console. My application/environment failed to run as while "rake db:migrate" it still thinks I wanted it to connect to the local Mysql (I guess from the logs that it is not aware of RACK_ENV and hence uses 'development').

Any tip? I can of course try next the 'eb', yet would prefer to work with the console.

Regards, Oren

like image 918
Oren Avatar asked Sep 27 '22 18:09

Oren


1 Answers

In Elastic Beanstalk (both the web console and the cli), you can pass environnement variables. If you pass the RAKE_ENV variable, you will change your environnement.

After that you still need to pass your database parameters (db password, name, ...) which should not be hardcoded into the code.

like image 110
smad Avatar answered Oct 18 '22 13:10

smad