Can not run console on Heroku, or run any commands - ruby-on-rails

I'm unable to connect to Heroku's console as I could in the past using:
$ heroku run rails console
The result of that is:
Running `rails console` attached to terminal... up, run.4695
!
! Timeout awaiting process
Following a Heroku guide, I issued this command..
$ telnet rendezvous.runtime.heroku.com 5000
and the result was:
Trying 50.19.103.36...
telnet: connect to address 50.19.103.36: Operation timed out
telnet: Unable to connect to remote host
I switched to another ISP recently, and I have verified with their tech support that they don't block access to any ports (including 5000). So, I really don't know what's going on.
What else can I do? I sincerely need help.
Thanks in advance,
Kind Regards,

Related

cannot connect to Heroku Postgres - error "server closed the connection unexpectedly"

I am trying to use the Heroku CLI to connect a Postgres database in the cloud.
heroku pg:info shows the database information, but heroku pg:psql fails with the following error:
$ heroku pg:psql
--> Connecting to postgresql-<database-id>
psql: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
What's wrong?
Port 5432 must be unblocked for psql to work and I was unable to do that. Switching to a different network (e.g. Internet provider at home or mobile Internet) may help.
Might not be the issue for everyone, but if you have a computer set up to connect with mTLS by having a ~/.postgresql/postgresql.crt and ~/.postgresql/postgresql.key, psql will automatically send the key up to all databases you connect to, and you will break heroku pg:psql connections to other databases
So just
mv ~/.postgresql{,.bak}
and try again. If that's your issue, you'll want to put your mTLS certs in a different directory and manually pass them as arguments or via config vars
The location of the certificate and key files can be overridden by the
connection parameters sslcert and sslkey or the environment variables
PGSSLCERT and PGSSLKEY

ENOTFOUND: getaddrinfo ENOTFOUND api.heroku.com api.heroku.com:443 Error for heroku create

My steps are below:
Download the heroku-osx.pkg, and installed it.
$ heroku login with my account and password
cloned the ruby-getting-started: $ git clone https://github.com/heroku/ruby-getting-started.git
But when I run $ heroku create in my Terminal.
Reports the error:
Creating app... !
▸ ENOTFOUND: getaddrinfo ENOTFOUND api.heroku.com api.heroku.com:443
I have find the related question in SO:
I got error while using "git push heroku master"
Hibernate unable to create schema automatically on Heroku postgres
But they are not when execute $ heroku create comes out the error.
The same was happening to me on Mac OS X 10.12.6 in iTerm2 3.1.5
Restarting iTerm solved the issue for me.
Carelessly, I don't know why, I tried several times of :
$ heroku create
It create succeed, with the logs:
Creating app... done, ⬢ still-harbor-32209
https://still-harbor-32209.herokuapp.com/ |
https://git.heroku.com/still-harbor-32209.git
So, I think try several times will solve it.
It means that the connection between api.heroku.com with a port of 443 and to your PC failed and results to shutdown. Thus retrying the command will succeeds.
You may not be connected to the internet. Make sure to check your connection as it is required to complete this command.
I experienced the same issue recently.
To debug this:
1) I tried restarting my terminal entirely CMD+Q, but still hit the timeout issue
2) I ran a whois on my-heroku-app.com and that command also timed out, even though I could connect to it through my browser
3) I disconnected my VPN and ran a whois command. This fixed the issue
After reconnecting my VPN, everything worked smoothly. Not sure what caused the hiccup, but I hope these steps help for anyone trying to debug this.
This happened to me when the internet temporarily cut out for a few seconds while I was trying to run a heroku command.
The Heroku CLI returned Error: getaddrinfo ENOTFOUND api.heroku.com
As soon as the internet connection was restored, everything was back to normal
I had a similar issue. my OS is windows, I solve this problem by restarting my command line and running the command all over and everything worked fine
The problem for me was network connection, by checking and re-establishing connection, it worked perfectly fine
I was getting the same , Because I was connected to VPN and I think network was blocking the same . So disconnect VPN and try once.

How to connect rails application(locally run on zeus) in another machine using IP?

I am using two rails applications, running both with rails s and zeus s -p3001 locally. When I am trying to run my application in another machine, the server started with webbrick is running fine on another system but couldnot run zeus. PLease help me out.
I just gave the url in browser 192.168.1.111:3000 (running). And
`192.168.1.111:3001` (server not found).
I tried zeus s -b 192.168.1.111:3001 but didn't help me.
The problem is, that the zeus bind to the local address (127.0.0.1) prohibiting connections from remove hosts. The proper solution would be to setup the reverse proxy using apache2 or nginx.
http://glasz.org/2013/10/25/reverse-proxy-a-rails-app.html
https://www.digitalocean.com/community/tutorials/how-to-deploy-rails-apps-using-unicorn-and-nginx-on-centos-6-5
Alternatively you may also want to use firewall to redirect requests.
http://forum.slicehost.com/index.php?p=/discussion/2497/iptables-redirect-port-80-to-port-8080/p1
But a quick and dirty solution is to use SSH port forwarding like this:
Start zeus on remote machine on port 3000
On local machine
local-machine$ ssh -L 3001:localhost:3000 remote-machine
On local machine: Connect to localhost:3001 instead of to remote-machine:3000
http://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html

cannot connect heroku - when writing heroku update - ruby on rails

i am trying to connect heroku
i downloaded heroku toolbelt and installed it .
then from the command prompt i type :
heriku login
althogh i type the right credentials (i checked!!) i get
! Unable to connect to Heroku API, please check internet connectivity and
try again.
I wanted to be sure its not something with authentication
so i typed :
heroku update
just to set up a connection that doesn't need a password.
i get the message:
! Unable to connect to Heroku API, please check internet connectivity and
try again.
i saw some answers that talked about the remote option so i did that:
heroku git:remote -a my-app-name
and i got the same response.
the internet connection is ok because the git program is able to push to github.
even when i run
heroku install:something
it works.
so I tried to debug:
i downloaded a git bash so i can operate in unix through SSH
and I followed this stack question comments and tried it:
ssh git#heroku.com -T
and got :
warning permanently added the RSA host key for ip address '50.19.85.132' to the list of
known hosts.
permission denied (publickey)
then I tried to check DNS response:
ssh host heroku.com
and got :
ssh: host: no address associated with the name.
so i guess that my connection get blocked regardless of SSH .
i run netstat -a and it seems that port: 22 , 443 , 5000 that heroku uses are free.
i turned the firewall off and still no conection
what should i do?
Try heroku login first. It authenticates you.

How to allow multiple rails apps access to local postgreSQL database

I am new to Ruby/Rails and PostgreSQL. Is it possible to have to multiple rails apps access a psql local database at the same, if not how do you switch between applications?
Currently RailsApp1 is interacting with my psql db as expected, however RailsApp2 cannot connect and rake commands abort.
Running on: OSX Mountain Lion, ruby 1.9.3p194, rails 3.2.8, psql 9.2.1.
~/RailsApp2 #: rake db:migrate
rake aborted!
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Thank you in advance for the help.
PostgreSQL uses a client-server model, so the fact is you just connect to the server and multiple applications can make it work. Your specific problem sounds like the server isn't running or isn't accepting connections. Steps to try in order:
ps -A | grep post looking for postgres or postmaster processes. If not found start the server using the pg_ctl program.
Assuming it is running try setting the PGHOST environment variable to "localhost" so that it forces rake, psql, etc. to connect over TCP/IP. This would help if the UNIX socket is missing or just not where the client apps expect it to be.
If those two fail, find your postgresql logs (sometimes called serverlog, and sometimes in a pg_log directory) and post error messages.

Resources