I would like to package 13ft, a selfhosted equivalent of 12ft ladder. It allows to bypass some paywalls by fooling the website, impersonating GoogleBot (guess what : a lot of website gives their whole content to GoogleBot for SEO ranking).
how do I start this python script properly ? Including on server restart.
how to stop it properly ? (shut down a SystemD service ?)
how users could do it ?
how to uninstall properly
how can we check that flask isn’t used by another app before removing it ?
how do we transfer an app to Yunohost catalog ? I don’t remember
edit : I found how to do it (in the repository settings), now I waiting for github to unfork the repository as I can’t transfert a example_ynh fork, even with a different name.
you will usually want to use gunicorn which is a small piece of software that creates a bunch of workers for the app such that it’s not a single process handling all the request (imagine only 1 waiter/waitress/cook in a 1000-person restaurant)
(and cf also the ynh_add_systemd_config and similar helper calls in the app install, remove, upgrade, restore))
Not sure why you’d want to stop it ? Maybe you’re referring to having the systemd service listed in the “Services” section of the webadmin. For this you can have a look at the call to yunohost service add in the app install script
Usually Python apps use what’s called virtualenv to properly separate all their dependencies from the rest of the system (similar to nodejs node_modules folder)
This implies the app provides a requirements.txt as part of its source to list its dependencies (and for the love of god, please don’t install stuff with pip globally on a yunohost system, that tends to make everything explode)
I configured a systemd service (and registration into yunohost web admin interface), but I’m unsure how to do it properly. Right now the command is python 3 /var/www/[app path]/init.py and that’s it.
I don’t know if it’s needed in that case, it’s a very simple and lightweight app, and I believe it won’t be used that much.
Is it simple to do ? What’s the drawbacks ?
When I uninstall it ?
And also I think it’s good that users have the control to shut it down.
Already done, thanks :), it’s very simple with the handler and the default example
Oh yeah, I haven’t deployed a python app for so long that I forgot about that
Great, thanks for the tip. What the syntax ? Just flask ?
Thanks for pointing this, very appreciated, I was a bit lost about how to do it properly the yunohost way
Hmmm yeah maybe you’re right, I didnt really have a look into the actual app . Just highlighting that’s the usual stuff, but big +1 for not blindly copypasting stuff, each app has its own quirks
Then yeah I guess you mean the service integration in the Services section of the webadmin
During the uninstall, just stop the service, remove it from yunohost with yunohost service remove(?) and remove the systemd conf with the appropriate helper … the example app should show all this
Hmmm not sure what you mean, requirements.txt should be provided by the upstream app … though you could also build one manually … The syntax is for example this: https://github.com/YunoHost/pepettes/blob/main/requirements.txt (you can see Flask in the list along a bunch of other stuff). requirements.txt are usually generated by running something like pip freeze which list all packages installed + their version
Note that if this is just to install Flask, then there’s no need for a requirements.txt … They become relevant when you start having a bunch of dependencies. To install flask inside the venv, you can just run venv/bin/pip install Flask (not sure about the exact syntax and the call to pip inside the venv depends on the exact context)
I understand
On the other side, the configuration you shared allows for an easy way to shutdown the app, as well as reloading it (not sure it’s useful).
Great, thanks.
It doesn’t have it. The app is very simple, and html file, a python file, that’s it.
edit: the software author added this file ! So I’m using it.
I guess I’ll have to do that… thanks for sharing this example.
That’s the thing I didn’t know !
I believed that I would keep the right to do that as I can write to it and shared it with Yunohost-Apps organisation.
# (Optional) If it set as false don't extract the source. Default: true
# (Useful to get a debian package or a python wheel.)
SOURCE_EXTRACT=(true|false)