Error accessing Heroku Logs from Nitrous.io - ruby-on-rails

I am trying to access the log from a small Rails app that I have deployed to Heroku, from Nitrous.io.
When I run 'heroku logs' I get the following:
Unable to connect to api.heroku.com
I am guessing that I don't have something setup correctly, but have no idea what.
Can someone point me in the right direction?
Thanks,
Jim

Assuming you've already run heroku login, Try adding your Nitrous project's SSH keys to heroku. When you're in the Web IDE in your project, type in the command line:
$ heroku keys:add
Then try running heroku logs again.

Related

Syncing Heroku and localhost databases

Hey so I am following the One Month Rails guide to learning Ruby and I have hit a wall on one of the lessons. I have just finished uploading an image with Paperclip, and as I finished my work on my localhost and checked it on Heroku, something went wrong. The pin/image appears to have been pushed to my Heroku account, the only problem is that the username and password that works for my localhost:3000 won't work for my Heroku account. The same password should work for both, but for some reason something is wrong. I wish I could give you the action that is going on in my terminal, but the ruby rails is the only thing that has a continuous status flow. The problem may have been when I switched my password after not using my account on localhost for a few weeks, but i thought that once i "git pushed" that to heroku master, it would've synced. I have tried heroku run rake db:setup which didn't seem to do too much as well as wrestled by way through "Importing a Heroku Postgres Database with PG Backups", but I had some trouble working through that. Any ideas? Thanks for the help.
Your 'database.yml' should not be sent to Heroku, they take care of that, creating a new database.yml config file with the proper DB access details.
Try logging into your Heroku instance and deleting the file.
Edit: nevermind, assumed you were not able to connect to the DB, not to login into the website.
So if I'm understanding you correctly, you've deployed your application to Heroku and the login (to your application) that was working locally doesn't work on Heroku.
Deploying your application doesn't deploy data. Assuming you've run heroku run rake db:migrate then your database schemas will at least match.
At this point, you've got a couple of options.
Use a seeds.rb file which you can load with heroku run db:seed to setup some 'seed' data so that you can login.
Push your local database to Heroku - either via heroku db:push or using heroku pg:transfer provided by https://github.com/ddollar/heroku-pg-transfer
Use heroku run console to create your user account via the command line
User.create(email: 'someemail.com', password: 'somepassword', password_confirmation: 'somepassword')
I'd be inclined to go with the later option.
How did the user get in their in the first place? Perhaps going back to that step in the tutorial - just remember, if you are using rails console locally to use heroku run console on Heroku.

app works on Heroku, but server error accessing DB through console

I have a Rails app on Heroku that works fine when I access it through a browser. It's also displaying data from the database correctly. However, when I try to update the database through the console, I'm getting an internal server error message. The model's name is Total.rb (table's name is "totals") I'm doing this to get the first entry
t = Total.first
! Internal server error
Since the app's working through the browser, I'm not sure if this is a problem I'm causing or if it's heroku's fault. It's been a while since I updated through the console, so I'm not sure if I'm doing it right, but that seems pretty straightforward.
I had always accessed the console with 'heroku console' now it's telling me to use 'heroku run console' but when I did that, it told me that the heroku gem has been deprecated and I need to install the Toolbelt. I installed the Toolbelt, authenticated, and tried to run a console session but same result.
Here's my Heroku info
Addons: heroku-postgresql:dev
pgbackups:plus
zerigo_dns:basic
Dynos: 1
Git URL: git#heroku.com:blahblah
Owner Email: blahblah#gmail.com
Repo Size: 19M
Slug Size: 4M
Stack: bamboo-mri-1.9.2
Web URL: http://blahblah.com
Workers: 0
Update
If I try to run the console after installing the Heroku toolbelt, I get
heroku run console
Running `console` attached to terminal... up, run.3213
bash: console: command not found
I was having the same problem there is some internal issue going on with the heroku CLI client that I don't understand.
The solution posted in this stackoverflow thread solved it for me:
Here is the link
Could Total be a reserved word? You could try renaming the table or creating a temp one, then testing the same query with that. If nothing else it will eliminate one possible problem area.

Heroku Port 5000 not connecting

I am doing a Saas course from edx.org,using ruby on rails.
The course needs to deploy my app running in virtual box to heroku.
My host and guest machine are Ubutu 12.04
The problem is , this command does not work .
heroku run rails db:migrate
Even tried with troubleshooting on Heroku site ,which points the same above issue
https://devcenter.heroku.com/articles/oneoff-admin-ps#troubleshooting
But even this command did not work
telnet rendezvous.runtime.heroku.com 5000
It is clear port issue , I am unable to breakthrough.
Any help ?
If this is the error message:
$ heroku run console
Running `console` attached to terminal... up, run.2077
!
! Error connecting to process
$
Try this: heroku run:detached ls
If it says:
Running `ls` detached... up, run.8825
Use `heroku logs -p run.8825` to view the output.
$ heroku logs -p run.8825 2013-04-11T21:30:50.137946+00:00 heroku[run.8825]: Starting process with command `ls`
2013-04-11T21:30:50.805694+00:00 app[run.8825]: app
2013-04-11T21:30:50.805694+00:00 app[run.8825]: bin
2013-04-11T21:30:50.805694+00:00 app[run.8825]: config
.
.
.
Then it's firewall-related but only because Heroku points the finger elsewhere.
https://devcenter.heroku.com/articles/one-off-dynos
This is a Heroku issue for many users because they are demanding a connection to port 5000. In many enterprise environments where only ports 443/80/22 are usable, this leaves a large fraction of customers with lots of money out in the cold. Heroku should take ownership and just help users make it work. There is no technical reason they can't, and any argument as such would be to justify laziness.
Hackarounds like https://github.com/nzoschke/SSHeroku and charging for Proximo are non-starters, requiring more even more work diffused upon users and aren't scalable.
Heroku development servers appear to be down right now for me. Type the following code in the command line to output your log:
heroku logs
Right now I am getting error code h99 which they say on their website:
This indicates an internal error in the Heroku platform. Unlike all of the other errors which will require action from you to correct, this one does not require action from you. Try again in a minute, or check the status site.
The status site (status.heroku.com) says everything is okay... but my logs indicate there is something wrong on their end.
What does heroku logs output for you?

Why are certain aspects of my Rails app throwing an exception publicly when I deploy to Heroku?

I am working my way through Michael Hartl's Ruby on Rails Tutorial (on Mac OSX 10.7.2/Ruby 1.9.2/Rails 3.1.1) and just finished Chapter 2, which concludes with deploying a demo twitter app to Heroku.
Everything appears to be working properly when I run the app locally AND I was able to successfully deploy the app to Heroku in some capacity because it is available here: http://rich-twitter-baby.heroku.com/
However, what I can't figure out is why the /users and /microposts pages aren't showing up publicly (with lists of users and microposts respectively) as they do locally. I migrated my database to Heroku and pushed the info up there and everything seemed to work properly, but I get this error message when I try to view the pages publicly.
I've tried running "heroku console" but get this error:
Unable to attach to a dyno to open a console session.
Your application may have crashed.
Check the output of "heroku ps" and "heroku logs" for more information.
And the logs say error H13, while the ps looks like this:
Process State Command
------------ ------------------ ------------------------------
web.1 idle for 1h thin -p $PORT -e $RACK_ENV -R $HER..
Let me know if anyone has any ideas or if more info would help.
Thanks!
I would contact Heroku support on this. Dynos can crash and become 'zombiefied' which means they just sit there idle.
Normally these will clear themselves out within a few hours, but it shouldn't happen that often if at all.
Doing a new deploy will also normally restart everything back to clean.
If it's consistently happening, have you tried spinning up the application locally in production mode to try and reproduce the problem
rails server -e production
, or adding something like the Airbrake add-on to your app to capture the error.
Check your log using
$> heroku logs
At the command line of your development system that you used to push to heroku.
Post the log here if you can't figure it out from that.
I contacted Heroku Support about this issue and it turns out that the answer had to do with which stack my app was being deployed to. I did their workaround and everything is now up and running. Here's the full info from them:
It looks like the problem is that you're using Rails 3.1 and our Bamboo stack; we have full >asset pipeline support on our Cedar stack[1]. Since this is just a demo app, an easy >workaround is to precompile locally and commit the files:
rake assets:precompile
git add -A
git commit -m "precompiling assets"
git push heroku master
To get full asset pipeline support, you need to create your app on the Cedar stack and then >repeat the process you did to get your Bamboo app to work.
[1]: http://devcenter.heroku.com/articles/rails31_heroku_cedar

Why doesn't Heroku show the default Rails page?

Following chapter (1) of the Ruby on Rails tutorial, I was able to successfuly push the application to "Heroku" using:
git push heroku master
But, when I open the website, I get a page with the following:
App crashed
This application is temporarily offline.
If you're the administrator of this app, please check your heroku logs for the backtrace.
Why is that? And, why don't I see the default Rails page?
Thanks.
In any situation where heroku gives you an error message in production, type heroku logs into your terminal. This will usually point you in the right direction.
http://docs.heroku.com/logs-exceptions
Also check your localhost and make sure you have migrated the database if one exists.
Are you able navigate to default local rails website at http://localhost:3000 and see the defaut site?

Resources