How to run simple Python scripts on Cloudron
-
@sarthak-narayan LAMP app can run python - may be tiny over kill but unless you build your own app you're sol
-
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.
-
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.
-
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
-
@sarthak-narayan why bother with nginx when you can run another one line python script to serve the health check?
-
@sarthak-narayan The upcoming version of n8n will include Python support in the Code node.
https://docs.n8n.io/1-0-preview/ -
-