Passing the Healthcheck on custom app
-
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 withpandoc
and a bespokeeisvogel.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 likeproposal.md
to get a beautifulproposal.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. -
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. -
@hendrikvl : brilliant thank you
I know nothing about supervisor.
But I guess a good opportunity to learn -
@hendrikvl : great, that works !
Integrated the tutorial-supervisor app with the custom app.
It now passes the healthcheckNow 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 !
-
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.
-
@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 installingpandoc
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. -
@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.
-
@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 usingnode 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 onhttps://git.cloudron.io/explore
for clues and stuff to borrow.
But a lot there.-
Wondering if anyone has a suggestion for Cloudron app which has a more sophisticated, but not too sophisticated, example!!
-
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?
-
-
@timconsidine might be easier, if you push your current code to some public repository or so, to better guide you.
-
@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.
-
@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.
-
@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 gotinvalid namespace
Is creating projects on git.cloudron.io restricted ? -
@timconsidine I have created a public repository at
https://git.firstoption.com/timconsidine/Cloudron-Pandoc-PDF-Builderhttps://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.
-
@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. -
@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.