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


    Cloudron Forum

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

    Solved Question about packaging express.js node apps

    App Packaging & Development
    3
    6
    197
    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.
    • ?
      A Former User 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.

        ? 2 Replies Last reply Reply Quote 0
        • ?
          A Former User @nebulon last edited by

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

          1 Reply Last reply Reply Quote 0
          • ?
            A Former User @nebulon 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.

            murgero 1 Reply Last reply Reply Quote 0
            • murgero
              murgero App Dev @Guest 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.

              --
              https://urgero.org
              ~ Professional Nerd. Freelance Programmer. ~
              Matrix: @murgero:urgero.org

              ? 1 Reply Last reply Reply Quote 1
              • ?
                A Former User @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
                Powered by NodeBB