How to run simple Python scripts on Cloudron
-
wrote on Jun 23, 2023, 3:22 PM last edited by
Is there a way to run simple Python scripts on Cloudron packaged in a Docker container? I know Cloudron requires a health check endpoint. Is it possible to run simple scripts without a health check endpoint?
-
wrote on Jun 23, 2023, 3:54 PM last edited by
Can you point me to the docs that show how to put it in debug mode?
-
-
wrote on Jun 23, 2023, 4:43 PM last edited by
So just to clarify instead of doing
cloudron install --image <image-name>
I docloud debug --image <image-name>
? -
wrote on Jun 23, 2023, 6:10 PM last edited by
Why not run the python scripts in the LAMP app which is already set up for all health checks?
-
wrote on Jun 23, 2023, 7:32 PM last edited by
Why should I do that if I just want to run a simple Python script.
-
wrote on Jun 23, 2023, 10:52 PM last edited by
Why not? What app were you intending to use?
-
Why should I do that if I just want to run a simple Python script.
-
wrote on Jun 24, 2023, 3:24 AM last edited by
You can also run your "simple Python script" in Jupiter notebooks, or with CTfreak which will manage a crontab for you to run it anywhere you can ssh into.
Perhaps it's more useful to share what you're trying to achieve, and what the script does, so we can offer more useful suggestions.
-
@sarthak-narayan
Lets clear things up.
You want to install a custom Cloudron App, which runs a Python program.
Correct?For example the TeamSpeak app does something similar: https://git.cloudron.io/cloudron/teamspeak-app
It might be good to take a look there.I am also running multiple python programs in the LAMP app with my webpage as a daemon.
And even if an app would not have python.. mostly impossible since its in the base included: https://git.cloudron.io/cloudron/docker-base-image/-/blob/master/Dockerfile#L45There is always https://pyinstaller.org/en/stable/ to make a binary.
-
wrote on Jun 24, 2023, 1:17 PM last edited by
Got it thanks. I am planning to install and run nginx for health check and then run my python script inside it as a cronjob.
-
App Devwrote on Jun 24, 2023, 4:28 PM last edited by fbartels Jun 24, 2023, 4:30 PM
If it is really just a python script, that otherwise does not have a Webinterface, i would just build my own container braised on the python Debian packages and start it in the background through the cli.
Somewhere here in this forum i posted how I'm running imapsync on my cloudron to migrate mails. Will edit this post once i found it.
Here it is:
docker run --rm --network host gilleslamiral/imapsync imapsync \ --host1 old.server.com --user1 old.user --password1 REDACTED --ssl1 \ --host2 127.0.0.1 --user2 cloudron.user@domain --password2 REDACTED --ssl2 \ --nosslcheck --useheader Message-Id --automap --dry
-
Got it thanks. I am planning to install and run nginx for health check and then run my python script inside it as a cronjob.
wrote on Jun 24, 2023, 5:03 PM last edited by robi Jun 24, 2023, 5:05 PM@sarthak-narayan why bother with nginx when you can run another one line python script to serve the health check?
-
I have the same question as @robi .
Cloudron has support for special
@service
cron type - https://docs.cloudron.io/apps/#cron . You can just put it in an existing app (if that makes sense). -
Is there a way to run simple Python scripts on Cloudron packaged in a Docker container? I know Cloudron requires a health check endpoint. Is it possible to run simple scripts without a health check endpoint?
wrote on Jun 25, 2023, 1:59 PM last edited by@sarthak-narayan The upcoming version of n8n will include Python support in the Code node.
https://docs.n8n.io/1-0-preview/ -
-