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


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. App Packaging & Development
  3. Passing the Healthcheck on custom app

Passing the Healthcheck on custom app

Scheduled Pinned Locked Moved App Packaging & Development
18 Posts 3 Posters 2.1k Views 2 Watching
  • 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.
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine
    App Dev
    wrote on last edited by timconsidine
    #1

    In brief :
    I am attempting to package a custom app which initially is a processor app with no webpage interface. It waits for files in directories under /app/data and processes them.
    So there is nothing to return a 2xxx to the Healthcheck.
    So it never passes and the app never reaches Running status, although it does work to process files as required.

    Question :
    How can I 'frig' a 2xx response?
    I stuck a hello world index.html in app/data/public but seems this is not enough.

    A bit more detail :
    I write various documents like presentations & proposals in Markdown and then process this with pandoc and a bespoke eisvogel.latex layout template for a beautiful PDF (well, in my opinion anyway).
    Problem is I need to replicate this command line setup on every device I work on (2 laptops, 3 desktops, 3 locations, 2 countries) and it's a pain to share this setup as a production environment with others so they can produce their own docs in similar format.
    My plan is to set up a Cloudron app which has the pandoc setup. Then I and others just upload a doc like proposal.md to get a beautiful proposal.pdf.

    I guess the real answer to my question is to build a front-end providing a browser interface for uploading and downloading files. That should return the 2xx response needed. But I can't get my head around how to build that interface at the moment. So was hoping to build the app as 'alpha' without the front-end.
    Any advice to frig the 2xx response temporarily or how to find some example upload/download interface would be most appreciated.

    1 Reply Last reply
    1
    • H Offline
      H Offline
      hendrikvl
      wrote on last edited by
      #2

      I had the same issue with a custom app I created. My solution was to include a webserver that runs in parallel via supervisord, although my custom app would not require it for its own functioning.
      A sample of what this could look like is in the supervisor demo-app: https://git.cloudron.io/cloudron/tutorial-supervisor-app/
      The webserver in there only returns a static page with status code 200, which is all you need to pass the health-check.

      timconsidineT 2 Replies Last reply
      2
      • H hendrikvl

        I had the same issue with a custom app I created. My solution was to include a webserver that runs in parallel via supervisord, although my custom app would not require it for its own functioning.
        A sample of what this could look like is in the supervisor demo-app: https://git.cloudron.io/cloudron/tutorial-supervisor-app/
        The webserver in there only returns a static page with status code 200, which is all you need to pass the health-check.

        timconsidineT Offline
        timconsidineT Offline
        timconsidine
        App Dev
        wrote on last edited by
        #3

        @hendrikvl : brilliant thank you 👍
        I know nothing about supervisor.
        But I guess a good opportunity to learn 😊

        1 Reply Last reply
        0
        • H hendrikvl

          I had the same issue with a custom app I created. My solution was to include a webserver that runs in parallel via supervisord, although my custom app would not require it for its own functioning.
          A sample of what this could look like is in the supervisor demo-app: https://git.cloudron.io/cloudron/tutorial-supervisor-app/
          The webserver in there only returns a static page with status code 200, which is all you need to pass the health-check.

          timconsidineT Offline
          timconsidineT Offline
          timconsidine
          App Dev
          wrote on last edited by
          #4

          @hendrikvl : great, that works !
          Integrated the tutorial-supervisor app with the custom app.
          It now passes the healthcheck 🍾

          Now need to learn about supervisor and how to build an interface for source file upload and PDF download. I'm just a monkey see, monkey do hacker.

          Thanks again @hendrikvl !

          1 Reply Last reply
          1
          • nebulonN Offline
            nebulonN Offline
            nebulon
            Staff
            wrote on last edited by
            #5

            Yes what @hendrikvl suggested is correct. One reason also why Cloudron apps are essentially required to have something on http(s) is that the app will show up in the dashboard and when someone clicks on the app tile, it should go somewhere meaningful.

            I guess "worker" apps were simply not part of the current design and so far not really much asked for and it looks like even in your case, some rudimentary webinterface is wanted.

            timconsidineT 2 Replies Last reply
            1
            • nebulonN nebulon

              Yes what @hendrikvl suggested is correct. One reason also why Cloudron apps are essentially required to have something on http(s) is that the app will show up in the dashboard and when someone clicks on the app tile, it should go somewhere meaningful.

              I guess "worker" apps were simply not part of the current design and so far not really much asked for and it looks like even in your case, some rudimentary webinterface is wanted.

              timconsidineT Offline
              timconsidineT Offline
              timconsidine
              App Dev
              wrote on last edited by
              #6

              @nebulon yes indeed.
              Now I know what to do for basic response, all is cool.
              I'm not a programmer really, just know how to hack about.

              One thought, I'm kinda ok with PHP.
              Is there anything to prevent me installing pandoc into a LAMP app ? It's basically :

              RUN apt-get -qq update && \
                  apt-get -qq -y install wget texlive-latex-base texlive-fonts-recommended && \
                  apt-get -qq -y install texlive-fonts-extra texlive-latex-extra && \
                  apt-get -qq -y install lmodern && \
                  apt-get clean
              
              RUN wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-1-amd64.deb && \
                  dpkg -i pandoc* && \
                  rm pandoc* && \
                  apt-get clean
              

              I can do that manually maybe after installing LAMP and then build a web interface in PHP. Vaguely within my skill set !
              Or maybe I should just get modern and learn about nodejs.

              nebulonN 1 Reply Last reply
              0
              • timconsidineT timconsidine

                @nebulon yes indeed.
                Now I know what to do for basic response, all is cool.
                I'm not a programmer really, just know how to hack about.

                One thought, I'm kinda ok with PHP.
                Is there anything to prevent me installing pandoc into a LAMP app ? It's basically :

                RUN apt-get -qq update && \
                    apt-get -qq -y install wget texlive-latex-base texlive-fonts-recommended && \
                    apt-get -qq -y install texlive-fonts-extra texlive-latex-extra && \
                    apt-get -qq -y install lmodern && \
                    apt-get clean
                
                RUN wget https://github.com/jgm/pandoc/releases/download/${PANDOC_VERSION}/pandoc-${PANDOC_VERSION}-1-amd64.deb && \
                    dpkg -i pandoc* && \
                    rm pandoc* && \
                    apt-get clean
                

                I can do that manually maybe after installing LAMP and then build a web interface in PHP. Vaguely within my skill set !
                Or maybe I should just get modern and learn about nodejs.

                nebulonN Offline
                nebulonN Offline
                nebulon
                Staff
                wrote on last edited by
                #7

                @timconsidine the LAMP app package would not allow you to run apt-get and install further packages in a persistent manner, however you could essentially fork the LAMP app package and start from there.

                timconsidineT 1 Reply Last reply
                1
                • nebulonN nebulon

                  @timconsidine the LAMP app package would not allow you to run apt-get and install further packages in a persistent manner, however you could essentially fork the LAMP app package and start from there.

                  timconsidineT Offline
                  timconsidineT Offline
                  timconsidine
                  App Dev
                  wrote on last edited by
                  #8

                  @nebulon thank you

                  1 Reply Last reply
                  0
                  • nebulonN nebulon

                    Yes what @hendrikvl suggested is correct. One reason also why Cloudron apps are essentially required to have something on http(s) is that the app will show up in the dashboard and when someone clicks on the app tile, it should go somewhere meaningful.

                    I guess "worker" apps were simply not part of the current design and so far not really much asked for and it looks like even in your case, some rudimentary webinterface is wanted.

                    timconsidineT Offline
                    timconsidineT Offline
                    timconsidine
                    App Dev
                    wrote on last edited by
                    #9

                    @nebulon I decided to bite bullet and learn some basic node.js to build a basic web front-end.
                    Works fine on my local machine using node server.js.
                    But hangs when I build and install the image to Cloudron.
                    Obviously down to me to debug what it doesn't like.
                    I'm looking through some other Cloudron apps on https://git.cloudron.io/explore for clues and stuff to borrow.
                    But a lot there.

                    1. Wondering if anyone has a suggestion for Cloudron app which has a more sophisticated, but not too sophisticated, example!!

                    2. My basic example uses :
                      // var url = require('url');
                      // var fs = require('fs');
                      // var formidable = require('formidable');
                      They're listed in package.json or package-lock.json.
                      Might those be causing a problem with the Cloudron install?

                    nebulonN 1 Reply Last reply
                    1
                    • timconsidineT timconsidine

                      @nebulon I decided to bite bullet and learn some basic node.js to build a basic web front-end.
                      Works fine on my local machine using node server.js.
                      But hangs when I build and install the image to Cloudron.
                      Obviously down to me to debug what it doesn't like.
                      I'm looking through some other Cloudron apps on https://git.cloudron.io/explore for clues and stuff to borrow.
                      But a lot there.

                      1. Wondering if anyone has a suggestion for Cloudron app which has a more sophisticated, but not too sophisticated, example!!

                      2. My basic example uses :
                        // var url = require('url');
                        // var fs = require('fs');
                        // var formidable = require('formidable');
                        They're listed in package.json or package-lock.json.
                        Might those be causing a problem with the Cloudron install?

                      nebulonN Offline
                      nebulonN Offline
                      nebulon
                      Staff
                      wrote on last edited by
                      #10

                      @timconsidine might be easier, if you push your current code to some public repository or so, to better guide you.

                      timconsidineT 2 Replies Last reply
                      1
                      • nebulonN nebulon

                        @timconsidine might be easier, if you push your current code to some public repository or so, to better guide you.

                        timconsidineT Offline
                        timconsidineT Offline
                        timconsidine
                        App Dev
                        wrote on last edited by
                        #11

                        @nebulon will do, good idea.

                        nebulonN 1 Reply Last reply
                        0
                        • timconsidineT timconsidine

                          @nebulon will do, good idea.

                          nebulonN Offline
                          nebulonN Offline
                          nebulon
                          Staff
                          wrote on last edited by
                          #12

                          @timconsidine may not be required, but the expressjs framework is usually a solid option to be used. Cloudron itself and also surfer and the likes use that.

                          timconsidineT 1 Reply Last reply
                          1
                          • nebulonN nebulon

                            @timconsidine may not be required, but the expressjs framework is usually a solid option to be used. Cloudron itself and also surfer and the likes use that.

                            timconsidineT Offline
                            timconsidineT Offline
                            timconsidine
                            App Dev
                            wrote on last edited by timconsidine
                            #13

                            @nebulon said in Passing the Healthcheck on custom app:

                            the expressjs framework is usually a solid option to be used

                            Express looks good but I will learn this another day. I had already gone down a "manual code" direction, and didn't want to re-do it. I will probably produce a new version with Express later.

                            1 Reply Last reply
                            0
                            • nebulonN nebulon

                              @timconsidine might be easier, if you push your current code to some public repository or so, to better guide you.

                              timconsidineT Offline
                              timconsidineT Offline
                              timconsidine
                              App Dev
                              wrote on last edited by
                              #14

                              @nebulon said in Passing the Healthcheck on custom app:

                              if you push your current code to some public repository

                              I have solved the problems I was encountering. Phew.
                              Now in a basic working state. Not pretty but functional.

                              I will share in case it can be useful to others or there is advice on how to do it better.

                              I tried to create a project on https://git.cloudron.io to upload
                              But I got invalid namespace
                              Is creating projects on git.cloudron.io restricted ?

                              timconsidineT nebulonN 2 Replies Last reply
                              0
                              • timconsidineT timconsidine

                                @nebulon said in Passing the Healthcheck on custom app:

                                if you push your current code to some public repository

                                I have solved the problems I was encountering. Phew.
                                Now in a basic working state. Not pretty but functional.

                                I will share in case it can be useful to others or there is advice on how to do it better.

                                I tried to create a project on https://git.cloudron.io to upload
                                But I got invalid namespace
                                Is creating projects on git.cloudron.io restricted ?

                                timconsidineT Offline
                                timconsidineT Offline
                                timconsidine
                                App Dev
                                wrote on last edited by timconsidine
                                #15

                                @timconsidine I have created a public repository at ~~https://git.firstoption.com/timconsidine/Cloudron-Pandoc-PDF-Builder~~

                                https://git.cloudron.io/timconsidine/cloudron-pandoc-pdf-builder/

                                Feel free to use.
                                Let me know any errors or issues.

                                I will look into making it a node express project later.

                                timconsidineT 1 Reply Last reply
                                1
                                • timconsidineT timconsidine

                                  @timconsidine I have created a public repository at ~~https://git.firstoption.com/timconsidine/Cloudron-Pandoc-PDF-Builder~~

                                  https://git.cloudron.io/timconsidine/cloudron-pandoc-pdf-builder/

                                  Feel free to use.
                                  Let me know any errors or issues.

                                  I will look into making it a node express project later.

                                  timconsidineT Offline
                                  timconsidineT Offline
                                  timconsidine
                                  App Dev
                                  wrote on last edited by timconsidine
                                  #16

                                  @timconsidine oooops, appears to be an issue when downloading.
                                  Will fix that and advise
                                  EDIT : there appears to be a problem downloading on first run. But it works on subsequent runs. For now, just press back in browser, return home, and run again if error screen appears. Will investigate further, but basically working with this work-around. May be an issue if processing a large document, may need some some onFinish type statements somewhere.

                                  1 Reply Last reply
                                  0
                                  • timconsidineT timconsidine

                                    @nebulon said in Passing the Healthcheck on custom app:

                                    if you push your current code to some public repository

                                    I have solved the problems I was encountering. Phew.
                                    Now in a basic working state. Not pretty but functional.

                                    I will share in case it can be useful to others or there is advice on how to do it better.

                                    I tried to create a project on https://git.cloudron.io to upload
                                    But I got invalid namespace
                                    Is creating projects on git.cloudron.io restricted ?

                                    nebulonN Offline
                                    nebulonN Offline
                                    nebulon
                                    Staff
                                    wrote on last edited by
                                    #17

                                    @timconsidine said in Passing the Healthcheck on custom app:

                                    Is creating projects on git.cloudron.io restricted ?

                                    yes by default we limit new accounts to avoid spam. I have granted your gitlab account now more privileges to create projects.

                                    timconsidineT 1 Reply Last reply
                                    1
                                    • nebulonN nebulon

                                      @timconsidine said in Passing the Healthcheck on custom app:

                                      Is creating projects on git.cloudron.io restricted ?

                                      yes by default we limit new accounts to avoid spam. I have granted your gitlab account now more privileges to create projects.

                                      timconsidineT Offline
                                      timconsidineT Offline
                                      timconsidine
                                      App Dev
                                      wrote on last edited by timconsidine
                                      #18

                                      @nebulon thank you, will move the repo over

                                      1 Reply Last reply
                                      0
                                      Reply
                                      • Reply as topic
                                      Log in to reply
                                      • Oldest to Newest
                                      • Newest to Oldest
                                      • Most Votes


                                      • Login

                                      • Don't have an account? Register

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular
                                      • Bookmarks
                                      • Search