Retrieve Heroku Logs for Specific Remote - ruby-on-rails

I have a Rails 4 app that I push to Heroku from Git. I have a staging remote and a production remote on Heroku. When I run:
$ heroku logs
I get the staging logs. How can I get the production logs?
$ git remote -v
origin some/github/path (fetch)
origin some/github/path (push)
staging git#heroku.com:some-heroku-app.git (fetch)
staging git#heroku.com:some-heroku-app.git (push)
production git#heroku.com:some-other-heroku-app.git (fetch)
production git#heroku.com:some-other-heroku-app.git (push)
Attempts include:
$ heroku logs -s staging

Replace -s with -r. heroku logs -r staging (or production or whatever).

Use the Heroku app name
heroku logs --app my-production-app

Related

"heroku run NNN" when there're several "remote" git repos

I have almost identical web apps on Heroku. It's a single folder, it's just that there're 2 remote repos at heroku: "prod" and "staging"
$ git remote -v
staging https://git.heroku.com/my_app-staging.git (fetch)
staging https://git.heroku.com/my_app-staging.git (push)
prod https://git.heroku.com/my_app-prod.git (fetch)
prod https://git.heroku.com/my_app-prod.git (push)
When running a command via heroku such "heroku run rails c", how can I specify which app - staging or prod - it should run on?
You can use
heroku run rails c --remote prod
or
heroku run rails c --remote staging

Database entry not showing up on Heroku

I am developing my first Rails app, and I have made some database entries that are showing up in the development environment, but not in the production environment (Heroku). I have run
git add
git commit
git push origin master
git push heroku master
rake db:migrate
in the terminal.
$ heroku create
$ git push heroku master
After running these commands, to get the application’s database to work, you’ll also have to migrate the production database:
$ heroku run rake db:migrate
$ heroku open
if this doesn't work please show your logs.
you just need to run
heroku run rake db:migrate

Why deploy my rails app on heroku does not work?

I am new on Ruby/Rails application development. I already love Ruby/Rails because it's easy to learn. I've built an Rails application and i try to deploy on Heroku.
When i type :
heroku create
Creating app... done, stack is cedar-14
https://aqueous-plateau-17182.herokuapp.com/ | https://git.heroku.com/aqueous-plateau-17182.git
I don't have the following message :
Git remote heroku added
I think there is a problem with my remote :
git remote -v
heroku git#bitbucket.org:pracede/hubapp.git (fetch)
heroku git#bitbucket.org:pracede/hubapp.git (push)
origin git#bitbucket.org:pracede/hubapp.git (fetch)
origin git#bitbucket.org:pracede/hubapp.git (push)
git config --list | grep heroku
remote.heroku.url=git#bitbucket.org:pracede/hubapp.git
remote.heroku.fetch=+refs/heads/*:refs/remotes/heroku/*
1.There are remote but heroku refers to bitbucket. Is it correct ?
If no correct, how to do, please ?
I cannot deploy. I have the following message :
git push heroku master
Everything up-to-date
My rails application is not alive. Is someone could explain me, please ?
Thanks
First delete the current remote heroku reference(i.e pointing to bitbucket remote ) with -
git remote rm heroku
Add then add heroku remote to your repo -
git remote add heroku git#heroku.com:aqueous-plateau-17182.git
Hope this helps!

'You do not have access to the app' when trying to access heroku console

I recently started collaborating in a project on Heroku using Ruby on Rails. I was added as a collaborator and added the remote to my environment. After some development, I pushed some changes and had no problems:
$ git push staging
Where staging is the name of my remote.
Later, when trying to run "rake test" on Heroku, I recieved an error:
$heroku run rake test --app staging
Running `rake test` attached to terminal... failed
! You do not have access to the app staging.
Which is odd, as I was perfectly able to push my own changes. I checked the Heroku dashboard and saw that my push was logged there. I then tried to view the logs using the console, and the same problem occured.
$ heroku logs --app staging
! You do not have access to the app staging.
Finally, I tried to access the console, but it failed as well.
$ heroku run rails console --app staging
Running `rails console` attached to terminal... failed
! You do not have access to the app staging.
At this point I updated my Heroku toolbelt installation, and used "heroku auth" to verify that my email was showing up, but the error persists. I'm currently contacting Heroku support but I'm hoping someone with a similar issue could aid me in parallel.
Thanks!
So just in case anyone is having a similar problem, this occurs because I was mixing the name of my Heroku Apps with the name of my git remotes. So when I was calling --app staging (the name of my remote), I should have been using the actual name of the app, as found in Heroku.
Be sure to run heroku login before using Heroku toolbelt commands for the first time. It will not tell you that you have not signed in before.
This happen also when you haven't added heroku git remote repository.
You can add it with this command:
git remote add heroku https://git.heroku.com/<your project>.git
You can also type
heroku git:remote -a AppName
I had the same problem because I had created multiple remotes on heroku (e.g. a remote called "staging" for staging, and the default remote "heroku" for prod).
Solution
Use these two options to let heroku know which app and remote you're referring to:
-a your_app_name, and
--remote name_of_remote
Examples
For example, for the remote called staging:
heroku run env -a your_app_name --remote staging
or like this for the production remote:
heroku run env -a your_app_name --remote heroku
Extra Info
The above code runs the simple command env, but you can replace that with whatever commands you want to run on heroku.
Replace the name of the remote. By default, heroku creates one remote called heroku, which is typically the production remote. You can get your remotes with the command: git remote.
This was caused of your ssh key is no more permited to access. Make sure your ssh key is same. You can also regenarate your ssh key and add this to heroku.
You can also run:
heroku run rake test --remote staging
Not sure what happens under the hood, but locally the CLI tool figures out which app you mean based on your git remote.
I had the same problem in my case I was not pushing from master so I had to use this:
git push heroku :main
I had the same problem. It was cause I was not login in Heroku.
First I type:
heroku login
then i type:
heroku git:remote -a restserver-node-jngs
and it works.
I hope it be helpfull for someone.

Heroku rails help to push app

My git console:
Home#PC /c/rails/konkurranceportalen (master)
$ git push heroku master
Enter passphrase for key '/c/Users/Home/.ssh/id_rsa':
! No such app as warm-spring-423
fatal: The remote end hung up unexpectedly
Home#PC /c/rails/konkurranceportalen (master)
I have created a app named "vinderhimlen" that I want to push my rails app to
you need to change your remote heroku (if you typed git remote -v youd still see warm-spring-423) try something like this:
git remote rm heroku
git remote add heroku git#heroku.com:vinderhimlen.git

Resources