Solved Question about packaging express.js node apps
I have an app I built that I am trying to package for Cloudron and it doesn't seem to run the health check once the server runs. Anyone else run into this?
Funny enough, it works if I go into recovery mode, go to the terminal, and start the server in there manually.
You express server has to have a route handler for the healthcheck route mentioned in the CloudronManifest.json which responds with any 2** status code on a GET request.
As an example the surfer app is also an express.js based one and it looks like this: https://git.cloudron.io/cloudron/surfer/-/blob/master/server.js#L87
Don't forget to update the CloudronManifest.json to mention the /healthcheck route path you settle on.
@nebulon oh whoops! Makes sense. I’ll add that route. Thanks
A Former User last edited by A Former User
@nebulon Sorry just a followup. So I have the health check passing now but it seems to fail to properly serve the static files until I put it in recovery mode and manually run "node server.js" from the web terminal
I suspect this may have something to do with permissions used to run node or permissions for the static files.
@atrilahiji In the start.sh - you gotta use the full path to node or open a bash shell I think. I had a similar issue as well a long time ago.
@murgero HAH! Oddly enough making my script specifically cd into the backend directory and running the server.js there instead of running server.js from outside that directory did it. Unsure why. Works now and I have 0.1.1 of my app released and 0.1.0 of the cloudron integration. Thanks guys!