RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.61k stars 10.61k forks source link

Rocketchat on Heroku fails to bind to port within 60 seconds #8051

Open mayeaux opened 7 years ago

mayeaux commented 7 years ago

I've had a Rocketchat that I've been using for a couple weeks

Now, when I'm on Heroku, it begins restoring things from cache, but it doesn't boot a server with a port that Heroku can bind to within 60s, and the app crashes.

Any good way around this on Heroku? Thanks

mayeaux commented 6 years ago

Bump, any help with this guys?

luco commented 6 years ago

+1 on this

turicas commented 6 years ago

I'm having the same issue. Looks like we need to change the start command to do not install dependencies, like is said in this troubleshooting article. I'll test this approach and report here.

turicas commented 6 years ago

I first deployed RocketChat to Heroku using the deploy button and had a lot of alerts because of the boot time (sometimes the app cannot starts in less than 60 secs). Then, I've cloned the repo, added a fix commit to remove meteor npm i from the start script (fc81a9209addfea20c41de861171f3d6e3454a44) and pushed to my app's git repository on Heroku. It took 20m3.692s to deploy (built everything from scracth, wow NodeJS) and said the total image size can affect boot time:

remote:  !     Warning: Your slug size exceeds our soft limit (384 MB) which may affect boot time.

I've restarted the app many times after this deployment and it's still very slow (Heroku kills the app in most tries, since it exceeds 60secs to boot), so all the things being executed by the meteor command (before listening in the HTTP port) are very slow. Is there anything we can do so some actions are not executed during boot (or execute in an async way)?

stowball commented 6 years ago

I just tried to setup RocketChat on Heroku and got the same issue

aangelinsf commented 5 years ago

Doesn't work for me, either (November 29, 2018).

guilherme1guy commented 5 years ago

I'm with the same problem. It ran fine after the first deploy, but after the dyno got shutdown it won't boot anymore.

kulkarniamit commented 5 years ago

Same issue. Logs:

2019-05-02T18:06:05.177032+00:00 app[web.1]: LocalStore: store created at
2019-05-02T18:06:05.204023+00:00 app[web.1]: LocalStore: store created at
2019-05-02T18:06:05.204928+00:00 app[web.1]: LocalStore: store created at
2019-05-02T18:06:05.642139+00:00 app[web.1]: Setting default file store to GridFS
2019-05-02T18:06:09.980528+00:00 app[web.1]: Warning: connect.session() MemoryStore is not
2019-05-02T18:06:09.980540+00:00 app[web.1]: designed for a production environment, as it will leak
2019-05-02T18:06:09.980542+00:00 app[web.1]: memory, and will not scale past a single process.
2019-05-02T18:06:20.976307+00:00 heroku[web.1]: State changed from starting to crashed
2019-05-02T18:06:20.855851+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-05-02T18:06:20.855976+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-05-02T18:06:20.958894+00:00 heroku[web.1]: Process exited with status 137
2019-05-02T18:35:37.434579+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=my-app.herokuapp.com request_id=bd94be61-3036-4659-a35f-5def7c27e9ac fwd="66.211.105.2" dyno= connect= service= status=503 bytes= protocol=https
2019-05-02T18:35:38.210126+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=my-app.herokuapp.com request_id=1b15034e-4b3a-4dbe-aece-b2cce08a36f4 fwd="66.211.105.2" dyno= connect= service= status=503 bytes= protocol=https
2019-05-02T18:36:36.668170+00:00 heroku[web.1]: State changed from crashed to starting
2019-05-02T18:37:22.144925+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node $NODEJS_PARAMS .meteor/heroku_build/app/main.js`
2019-05-02T18:38:10.765116+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=my-app.herokuapp.com request_id=94004311-09f6-4962-8176-040d9c33c8cd fwd="66.211.105.2" dyno= connect= service= status=503 bytes= protocol=https
2019-05-02T18:38:15.955983+00:00 app[web.1]: Setting default file store to GridFS
2019-05-02T18:38:16.019015+00:00 app[web.1]: LocalStore: store created at
2019-05-02T18:38:16.021756+00:00 app[web.1]: LocalStore: store created at
2019-05-02T18:38:16.022282+00:00 app[web.1]: LocalStore: store created at
2019-05-02T18:38:22.578379+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-05-02T18:38:22.578537+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-05-02T18:38:22.942620+00:00 heroku[web.1]: State changed from starting to crashed
2019-05-02T18:38:22.949283+00:00 heroku[web.1]: State changed from crashed to starting
2019-05-02T18:38:22.908510+00:00 heroku[web.1]: Process exited with status 137
2019-05-02T18:39:11.238236+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=my-app.herokuapp.com request_id=88f40548-52e7-4027-a81c-5ba068490f0a fwd="66.211.105.2" dyno= connect= service= status=503 bytes= protocol=https
2019-05-02T18:39:11.982358+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node $NODEJS_PARAMS .meteor/heroku_build/app/main.js`
2019-05-02T18:39:50.294685+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=my-app.herokuapp.com request_id=6713977b-9eb4-4046-beaa-c1f2dc5a7cfc fwd="66.211.105.2" dyno= connect= service= status=503 bytes= protocol=https
2019-05-02T18:40:01.481287+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=my-app.herokuapp.com request_id=3f855193-0439-4b59-ad97-fae9c2739739 fwd="66.211.105.2" dyno= connect= service= status=503 bytes= protocol=https
2019-05-02T18:40:09.307336+00:00 app[web.1]: LocalStore: store created at
2019-05-02T18:40:09.335884+00:00 app[web.1]: LocalStore: store created at
2019-05-02T18:40:09.336370+00:00 app[web.1]: LocalStore: store created at
2019-05-02T18:40:09.941732+00:00 app[web.1]: Setting default file store to GridFS
2019-05-02T18:40:12.374525+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2019-05-02T18:40:12.374525+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-05-02T18:40:12.539726+00:00 heroku[web.1]: State changed from starting to crashed
2019-05-02T18:40:12.521077+00:00 heroku[web.1]: Process exited with status 137
2019-05-02T18:41:29.439525+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=my-app.herokuapp.com request_id=48c72d44-720a-4ba1-b26e-5f0f4e2a3750 fwd="66.211.105.2" dyno= connect= service= status=503 bytes= protocol=https
2019-05-02T18:41:30.208512+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=my-app.herokuapp.com request_id=e71dbbe2-a98e-42f8-80af-c674f550193e fwd="66.211.105.2" dyno= connect= service= status=503 bytes= protocol=https
2019-05-02T18:41:44.314065+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=my-app.herokuapp.com request_id=d8c9c723-785b-4bef-9f53-c6080e6e61c9 fwd="66.211.105.2" dyno= connect= service= status=503 bytes= protocol=https
2019-05-02T18:41:45.078595+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=my-app.herokuapp.com request_id=4ddfb6fe-3e47-4a31-970d-36a004f3296b fwd="66.211.105.2" dyno= connect= service= status=503 bytes= protocol=https
aditya-mitra commented 3 years ago

Heroku works like cloud function (for ex- AWS lambda). It does a cold start when your app if offline for a longer time. It does not cache or store the node_modules.

Now, when you again to that url (where you deployed it) after some time, heroku will grab all the dependencies of your project and reinstall all the dependencies and build the project. This process usually takes time considering the size of the dependencies and other build factors. If you could somehow cache the dependencies, then this process could be faster.

In conclusion, using a Serverless service such as heroku will always take longer to start a Rocket.Chat app compared to using a server solution such as Amazon EC2.

@mayeaux If this helps you, please considering closing this issue.