Launches the rails console in the Capistrano deployed application

I have deployed a Rails app for AWS using Capistrano and now I am trying to start the Rails console but cannot. If I go to home/user/app-name/current/

and try to run rails c

, I just get instructions on how to use the rails command.

Alternatively, I need to run a command, specifically the Searchkick command, ClassName.reindex

is there a way I can't do this without opening a console?

+3


source to share


2 answers


rails c

probably not working due to something missing in your deployed app bin/rails

. See this answer for a fix: Rails 4 doesn't detect app after capistrano deployed

Once you get it bin/rails

, you can run the command without using the console like this:

bundle exec rails runner ClassName.reindex

      



The runner

Rails team downloads your application and evaluates any Ruby code you supply.

Depending on how you did your deployment, you may need to explicitly specify the environment, for example:

bundle exec rails runner -e production ClassName.reindex

      

+4


source


Take a look at them and let me know if you find them useful.

https://github.com/ydkn/capistrano-rails-console



https://gist.github.com/benedikt/1115513

+1


source







All Articles