I've got a Rails app on a Docker image deployed to Heroku using heroku docker:release. I normally use heroku run rails console to access the console, but I am getting bash: /app/user/bin/rails: Permission denied. How do I access the Rails console via the Heroku-CLI command line?
Try this
docker-compose run web rails c
heroku run bundle exec rails console
Related
I want to get more detailed logs of my company app.
To do this I have read I can use "heroku run rails console" command.
When I launch it pointing to my remote app, I get:
/bin/bash: rails: command not found
Do I need to install something on my remote app?
Thank you for the help
When running rails server on cloud9, I get: No application seems to be running here! I tried removing the workspace, cloning it from a repository on github, and nothing works.
The solution that works for me is:
to start the server, do not simply type
rails s
but instead
rails s -b $IP -p $PORT
I have an issue with running the rails console at heroku (cedar-stack). Each of the following commands heroku run console, heroku run rails console, heroku run bundle exec rails console results in the following error-message:
Running bundle exec rails console attached to terminal... up, run.8155
Abort testing: Your Rails environment is running in production mode!
This error-message is a little bit confused. What kind of test tries heroku to start? I just want to fire up the console, which had worked fine 4 weeks ago.
For Cedar Stack and later:
heroku run rails console --app <app name>
Previous stacks could use this command:
heroku run console --app <app name>
If you have multiple environments (staging / production / etc) you need this command:
heroku run -a app-name console
If you only have a single environment and never setup staging or other environments you can just run:
heroku run console
https://github.com/nemrow/rails_app_cheatsheet/blob/master/heroku.rdoc
For some reason you need to explicitly define the console process in the Procfile:
# Procfile
web: script/rails server -p $PORT
console: script/rails console
This blog post has more details: http://platypus.belighted.com/blog/2013/01/21/ruby-2-rails-4-heroku/
I was with the same problem and I decided to do this and it worked
$ heroku run bash
$ cd bin
~/bin $ ruby rails console
You should just use heroku run console as others have answered.
Heroku only runs in one environment at a time, which is configured by the RAILS_ENV and RACK_ENV environments variables.
When you connect, the console will use the correct environment automatically.
Trying to run the Heroku console but I am getting this following:
heroku run console
Running console attached to terminal... up, run.1
sh: console: not found
$ heroku run bash works but I seem to get a (green) bash prompt - "~ $" not a rails console! Can I get into the console from here?
fyi
git push heroku v311
Everything up-to-date
The first error is thrown simply because the console command doesn't exist. I personally have never meet a command called console in my life.
The syntax is heroku run the_command_i_want_to_run. For example: heroku run irb or heroku run bash.
The second error: There's no Rakefile in your project root. Since heroku run rails console say that Rails wasn't found, my guess is that your project wasn't (well) deployed.
Make sure you've done git push heroku.
You may also need to check the logs: heroku logs.
a guess:
heroku run rails console
If you're on the Bamboo stack (older stack than Cedar), try:
heroku run script/rails console
This works for me and is the command recommended in Heroku docs.
I got confused by this too.
It's just
$ heroku run console
Do this
heroku run -a my-app script/rails console
Reference: https://devcenter.heroku.com/articles/console-bamboo
I deployed my application on ec2 using rubber and it works fine, however when i try to run the console (typed rails console) it didn't work. It didn't recognize the scipt at first and when i tried to run it from the script directory I got a "couldn't find ruby.exe" message.
Any ideas?
Run it with:
bundle exec rails c