Heroku Port 5000 not connecting - ruby-on-rails

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?

Related

Error accessing Heroku Logs from Nitrous.io

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.

How can you see your rails server running on heroku, so you can see full output while sending REST requests?

Typically if you use your localhost, you can just run
rails s
from terminal and then when you hit your webserver, you can see the output.
However, when I run
heroku run rails s
and then I hit my webserver up on heroku, I don't get any output like I do when I "rails s" with localhost.
Is there anyway to achieve this?
If you want to see the live server logs, use this command
heroku logs -t
There are many more options available, look at this answer heroku - how to see all the logs
You can use heroku logs command in terminal to see the log just like you see using rails s command.

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.

check 500 internal server error in production mode in rails 3.2

I have my app in production mode in my linode account and I get in one page a 500 internal server error the message:
We're sorry, but something went wrong.
However in my development environment works fine this page.
How can I debug this error?
How can I see the error origin in my production mode?
I want that rails show errors in production mode.
How can I do it?
Thank you!
If you have access to ssh, log in to your server via ssh and go to your rails log directory, which is inside your rails directory.
Once you are there run the command tail production.log . If this doesn't give you enough information you can also do a tail -n100 production.log (gives you last hundred lines of the production log).
If you have deployed via heroku, then you can access the logs by running heroku logs in your local console. (more information here https://devcenter.heroku.com/articles/logging)
I also find it helpful to use the exception_notification gem https://github.com/rails/exception_notification when running in production, as it emails you a stacktrace when an error occurs. Plenty of others also use Hoptoad (http://hoptoadapp.com/) or Exceptional (http://www.exceptional.io/) however i prefer the simple exception_notification gem.
Also, in some rare occasions when i can't trace the error as a final measure i sometimes open up port 3000 temporarily on the remote server firewall and cd to the rails project and run rails server production with the log level set to debug in config/environments/production.rb so i can see the error in the console, and then close off the port when i have finished.
Hope that helps.
tail -n100 production.log
will only show the last 100 lines of the log file. Just in case you want to see the log running in real time.
use this
tail -1000f log/production.log

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

Resources