gotzmann / comet

Modern PHP framework for building blazing fast REST APIs and microservices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deploy comet on Heroku get error

baksosapi opened this issue · comments

Trying deploy comet on heroku but unsuccessfully display hello message, using Procfile worker: php app.php start
and get 404:

2021-09-19T01:11:42.728966+00:00 heroku[web.1]: State changed from crashed to starting
2021-09-19T01:11:43.678266+00:00 heroku[web.1]: Starting process with command heroku-php-apache2
2021-09-19T01:11:46.240735+00:00 app[web.1]: Detected 536870912 Bytes of RAM
2021-09-19T01:11:46.270256+00:00 app[web.1]: PHP memory_limit is 128M Bytes
2021-09-19T01:11:46.276889+00:00 app[web.1]: Starting php-fpm with 4 workers...
2021-09-19T01:11:46.341334+00:00 app[web.1]: Starting httpd...
2021-09-19T01:11:46.943079+00:00 heroku[web.1]: State changed from starting to up
2021-09-19T01:12:10.831225+00:00 heroku[router]: at=info method=GET path="/hello" host=immense-peak-00785.herokuapp.com request_id=3c6b4bb7-d72e-4765-a11c-a15c3e66e5c6 fwd="175.158.38.125" dyno=web.1 connect=0ms service=1ms status=404 bytes=360 protocol=https
2021-09-19T01:12:10.832719+00:00 app[web.1]: 10.1.22.86 - - [19/Sep/2021:01:12:10 +0000] "GET /hello HTTP/1.1" 404 196 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36

and then using Procfile:
web: php app.php start
given error

2021-09-19T01:04:55.618066+00:00 heroku[web.1]: State changed from crashed to starting
2021-09-19T01:04:56.566507+00:00 heroku[web.1]: Starting process with command php app.php start
2021-09-19T01:04:57.539709+00:00 app[web.1]: Comet v2.0.1 [32 workers] ready on http://0.0.0.0:80
2021-09-19T01:04:57.541251+00:00 app[web.1]: Workerman[app.php] start in DEBUG mode
2021-09-19T01:04:57.541784+00:00 app[web.1]: stream_socket_server(): unable to connect to tcp://0.0.0.0:80 (Permission denied) in file /app/vendor/workerman/workerman/Worker.php on line 2255
2021-09-19T01:04:57.541825+00:00 app[web.1]: PHP Fatal error: Uncaught Exception: Permission denied in /app/vendor/workerman/workerman/Worker.php:2257
2021-09-19T01:04:57.541826+00:00 app[web.1]: Stack trace:
2021-09-19T01:04:57.541826+00:00 app[web.1]: #0 /app/vendor/workerman/workerman/Worker.php(679): Workerman\Worker->listen()
2021-09-19T01:04:57.541827+00:00 app[web.1]: #1 /app/vendor/workerman/workerman/Worker.php(538): Workerman\Worker::initWorkers()
2021-09-19T01:04:57.541827+00:00 app[web.1]: #2 /app/vendor/gotzmann/comet/src/Comet.php(358): Workerman\Worker::runAll()
2021-09-19T01:04:57.541827+00:00 app[web.1]: #3 /app/app.php(45): Comet\Comet->run()
2021-09-19T01:04:57.541828+00:00 app[web.1]: #4 {main}
2021-09-19T01:04:57.541828+00:00 app[web.1]: thrown in /app/vendor/workerman/workerman/Worker.php on line 2257
2021-09-19T01:04:57.541830+00:00 app[web.1]:
2021-09-19T01:04:57.541830+00:00 app[web.1]: Fatal error: Uncaught Exception: Permission denied in /app/vendor/workerman/workerman/Worker.php:2257
2021-09-19T01:04:57.541830+00:00 app[web.1]: Stack trace:
2021-09-19T01:04:57.541831+00:00 app[web.1]: #0 /app/vendor/workerman/workerman/Worker.php(679): Workerman\Worker->listen()
2021-09-19T01:04:57.541831+00:00 app[web.1]: #1 /app/vendor/workerman/workerman/Worker.php(538): Workerman\Worker::initWorkers()
2021-09-19T01:04:57.541831+00:00 app[web.1]: #2 /app/vendor/gotzmann/comet/src/Comet.php(358): Workerman\Worker::runAll()
2021-09-19T01:04:57.541832+00:00 app[web.1]: #3 /app/app.php(45): Comet\Comet->run()
2021-09-19T01:04:57.541832+00:00 app[web.1]: #4 {main}
2021-09-19T01:04:57.541832+00:00 app[web.1]: thrown in /app/vendor/workerman/workerman/Worker.php on line 2257
2021-09-19T01:04:57.665303+00:00 heroku[web.1]: Process exited with status 255
2021-09-19T01:04:57.746373+00:00 heroku[web.1]: State changed from starting to crashed
2021-09-19T01:05:19.214768+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/hello" host=immense-peak-00785.herokuapp.com request_id=c052d808-12e9-48d1-8048-30c42a513294 fwd="175.158.38.125" dyno= connect= service= status=503 bytes= protocol=https`

Looking into logs, I see there httpd Apache daemon and suppose it listen the same 80 port as Comet. You should start Comet on some other port and use Apache as proxy redirecting requests, like Apache:80 <-> Comet:8080