Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Navigation

    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    SOLVED Question about packaging express.js node apps

    App Packaging & Development
    3
    6
    48
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • atrilahiji
      atrilahiji App Dev last edited by

      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?

      Screen Shot 2020-11-01 at 1.33.28 AM.png

      Funny enough, it works if I go into recovery mode, go to the terminal, and start the server in there manually.

      1 Reply Last reply Reply Quote 0
      • nebulon
        nebulon Staff last edited by

        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.

        atrilahiji 2 Replies Last reply Reply Quote 1
        • atrilahiji
          atrilahiji App Dev @nebulon last edited by

          @nebulon oh whoops! Makes sense. I’ll add that route. Thanks 🙏

          1 Reply Last reply Reply Quote 0
          • atrilahiji
            atrilahiji App Dev @nebulon last edited by atrilahiji

            @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.

            M 1 Reply Last reply Reply Quote 0
            • M
              murgero App Dev @atrilahiji last edited by

              @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.

              atrilahiji 1 Reply Last reply Reply Quote 2
              • atrilahiji
                atrilahiji App Dev @murgero last edited by

                @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! 🙂

                1 Reply Last reply Reply Quote 3
                • First post
                  Last post