Loggin an Heroku app through heroku run rails console - ruby-on-rails

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

Related

Connecting to rails console through Railway

Hi I have a railway project set up which has a ruby on rails app running as one of its services.
When I try to run railway run rails db:seed, it throws an error that the executable is not found, which I assume means I need to connect to the service through the CLI first before running it, but I can't find any documentation on how to do that. Anyone knows how I can achieve this? Thanks!
Tried running railway run rails db:seed but got the error exec: "rails db:seed": executable file not found in $PATH.
Was expecting to connect to the rails instance of the service and be able to run rails commands.
Realised after looking at the logs they were looking for the executable so I just had to run railway run bin/rails db:seed and it worked.

rails: heroku run console giving error "bash: console: command not found"

Using the cedar-14 stack on Heroku. Just noticed that I can no longer run heroku run console because I get the error:
bash: console: command not found
I can still get to the console by calling:
heroku run bundle exec rails console
But I'm wondering what might have caused this change. I only noticed the issue after several days of commits so I can pinpoint the issue.
You need to use
heroku run rails console
The Basics for Heroku are explained under Heroku Devcenter.
Try
heroku run /app/bin/rails console
I happened to see this problem for a preview apps. For regular apps heroku console works.
I run into the same problem but I have resolved it by removing heroku/metrics build pack.
I have followed the configuration given for Ruby Language Metrics https://devcenter.heroku.com/articles/language-runtime-metrics-ruby and then tried to run the command heroku run console and it was triggering command not found error then I have reverted my changes and it started working.
Hope this will be helpful!

how can I access my postgresql database on heroku and offline?

I am learning ruby on rails and heroku.
I have some questions.
Could somebody help me?
After running heroku create, the terminal is somehow connected to the repository/project in heroku. After that the developer can see logs, access database, ect. But, how can I access via terminal my completed project,which is online already, in heroku without creating the same apps and upload it again to heroku?
How can access my pg database in heroku or offline?
I saw this and try to run heroku pg:psql. it gives me hidden-atoll-4790::DATABASE=> help I try \? to see pg command but I cannot use it.
I saw this link to see pg db offline. But why cannot I access /var/lib/postgresql/9.3/main directory ? it is said that I don't have permission eventhough my account is administrator account.
1.Run heroku run rails console
Run
$ heroku apps # to see all apps created by your account
$ heroku open # to open you current project in browser (run it form root of your project)
$ heroku pg:psql DATABASE_URL # to gain access to heroku postgresql terminal, here you can run SQL queries
Refer to
CLI and Heroku PG for more info

Rails console into Docker on Heroku

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

Heroku rails error trying to bring up console - sh: rails: not found

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

Resources