我很久沒有使用Heroku,所以即使有點生疏。 我創建了一個運行棘輪IOServer的小型PHP應用程序。它監聽端口5000.如果我運行heroku local
並連接telnet localhost 5000
一切似乎工作。我嘗試了幾種讓PHP進程運行並接受連接的方法。Websocket在本地工作,但不在Heroku上 - PHP應用程序
我的Procfile看起來像這樣;
web: php bin/console bot:start
運行heroku local
Downloading forego-0.16.1 to /Users/roje/.heroku... done
forego | starting web.1 on port 8080
web.1 | It works!
web.1 | New connection! (97)
web.1 | Connection 97 sending message "sdfdfs"
當我再部署服務器的Heroku這是行不通的。 當我嘗試遠程登錄到盒子上的端口5000
我得到
telnet myapplication.herokuapp.com 5000
Trying 46.137.127.234...
telnet: connect to address 46.137.127.234: Connection refused
telnet: Unable to connect to remote host
日誌顯示更多的信息。
2016-03-19T16:08:27.258081+00:00 heroku[web.1]: State changed from crashed to starting
2016-03-19T16:08:29.754688+00:00 heroku[web.1]: Starting process with command `php bin/console bot:start`
2016-03-19T16:08:31.659074+00:00 app[web.1]: It works!
2016-03-19T16:09:29.999903+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-03-19T16:09:29.999903+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-03-19T16:09:30.638659+00:00 heroku[web.1]: Process exited with status 137
2016-03-19T16:09:30.660710+00:00 heroku[web.1]: State changed from starting to crashed
2016-03-19T16:18:51.610894+00:00 heroku[web.1]: State changed from crashed to starting
2016-03-19T16:18:55.208396+00:00 heroku[web.1]: Starting process with command `php bin/console bot:start`
2016-03-19T16:18:56.648708+00:00 app[web.1]: It works!
2016-03-19T16:19:55.569256+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-03-19T16:19:55.569256+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-03-19T16:19:56.252235+00:00 heroku[web.1]: Process exited with status 137
2016-03-19T16:19:56.264205+00:00 heroku[web.1]: State changed from starting to crashed
有什麼建議嗎?
編輯#1
我剛剛看了一下Heroku的一部分分配動態端口Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)
我試過端口上偵聽,而不是,但我仍然無法通過連接。遠程登錄。雖然我確實得到了一些有趣的日誌。也許你們中的一些人正在嘗試IP地址?
2016-03-19T16:38:35.577130+00:00 app[web.1]: It works!
2016-03-19T16:38:35.827466+00:00 app[web.1]: New connection! (97)
2016-03-19T16:38:35.827531+00:00 app[web.1]: Connection 97 has disconnected
2016-03-19T16:38:35.832097+00:00 app[web.1]: New connection! (107)
2016-03-19T16:38:35.832160+00:00 app[web.1]: Connection 107 has disconnected
2016-03-19T16:38:49.891455+00:00 app[web.1]: New connection! (108)
2016-03-19T16:38:49.891506+00:00 app[web.1]: Connection 108 has disconnected
2016-03-19T16:40:54.694321+00:00 app[web.1]: New connection! (109)
2016-03-19T16:40:54.694368+00:00 app[web.1]: Connection 109 has disconnected
雖然我仍然得到相同的錯誤。
Trying 176.34.255.126...
telnet: connect to address 176.34.255.126: Connection refused
telnet: Unable to connect to remote host
我不相信Heroku可以讓你從外部連接到80或443以外的任何東西。請參閱http://stackoverflow.com/questions/8107748/can-a-heroku-app-use-different-multiple-ports - 您的端口5000只在實例內,但Heroku的路由器不會在外部路由它。 – ceejayoz
我試着在環境變量中由Heroku動態定義的端口上啓動IOServer。在這種情況下,端口被分配爲「40220」。仍然沒有運氣。 –