Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Rails rake task in Elastic Beanstalk environment

Does anyone know the easiest way to run a rake task for a Rails app on an Elastic Beanstalk environment?

I have some data that I want to reset every once in a while (timeline TBD). I've seen other posts talking about creating a cron task, but I just want to be able to execute the task on a one-off basis for now.

like image 973
Dennis Avatar asked Dec 25 '22 12:12

Dennis


2 Answers

You'd need to login to the box in order to run a rake task.
simply run eb ssh <env-name>
your app is at /var/app/current

like image 161
Tal Avatar answered Dec 27 '22 02:12

Tal


Figured out a way.

  • SSH into your EC2 instance using the following instructions: SSH Instructions (I used option 3)
  • Navigate to the /var/app/current directory once you're logged in
  • Run your rake task (rake db:migrate or whatever task you're trying to run)
like image 41
Dennis Avatar answered Dec 27 '22 01:12

Dennis