简体   繁体   中英

Why can't I connect to my Heroku rails app when I run the server manually?

In trying to debug another problem, I've tried starting up my Heroku Rails app from the command line using heroku run rails server . The output seems fine, as follows, but attempts to connect to it from the browser fail. If I don't specify a port number, I get the generic "application error" page from Heroku. If I try to connect on port 3000, the browser tells me it cannot connect.

Here's the output to the console after starting up the server:

Running `rails server` attached to terminal... up, run.9912
=> Booting WEBrick
=> Rails 4.0.1 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2013-11-18 01:52:55] INFO  WEBrick 1.3.1
[2013-11-18 01:52:55] INFO  ruby 2.0.0 (2013-06-27) [x86_64-linux]
[2013-11-18 01:52:55] INFO  WEBrick::HTTPServer#start: pid=2 port=3000

I did note the all zeros IP address.

I am unaware of any ability to run Heroku in the fashion you describe. In my experience, you deploy when you push your code the the Git remote on Heroku, and the code runs according to the Procfile you provide in the codebase. Then Heroku configures all kinds of environment settings to enable your app to run properly.

Once there, you can also do a heroku restart for whatever reason.

Incidentally, you probably would be better off ditching WEBrick for Unicorn or Thin.

If seems you're running your app like a localhost process from Heroku...If I'm not mistaken.

Why don't you just run through

heroku run ps:scale web=1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM