Closed benjaoming closed 5 years ago
For instance: Running service kolibri port
could be an interface to avoid kolibri-server
using internals of the kolibri debian package or kolibri upstream sources? @jredrejo what do you think?
I imagine that kolibri service port
would source /etc/default/kolibri
and then invoke some yet-to-be-created kolibri get-config port
command... or we just decide that it always explicitly define KOLIBRI_HTTP_PORT
in /etc/default/kolibri
and thus we don't care any further for it.
@benjaoming I see several problems here:
get-config port
should look only in kolibri options.ini file. Clearly, in that case kolibri-server must stop any previous running instance of kolibri that CherryPy might have started.Summarizing: I think we should add this code to the kolibri-server init script:
I don't like points 2 & 4 but I can't think of a better solution. Do you have any alternative?
If we use an nginx config file, this config must be the port written there, so it can't be a file provided by the package (well, postinst could hardcode it but then the user can't change it later).
Well... hmm... I think this pattern is already getting us there:
stop any running instance of kolibri
I agree with the steps, except that kolibri
still has to run as a daemon and somehow be configured to run without CherryPy.
I'm arriving more and more at a point where I think that the package should control certain mandatory aspects of Kolibri through ENV_VARS set in /etc/default/kolibri
and /etc/kolibri/conf.d
. This way, the server should dictate Kolibri to 1) assume the user facing port used in the Nginx config and 2) tell Kolibri to run without CherryPy.
@benjaoming why does kolibri has to run as a daemon?, what is the problem in stopping it?
On the other hand, there's an alternative we have not touched yet as it could be odd as we are both upstream and the package maintainer , but the possibility is there: we can patch Kolibri code when building the package if the end result is not contradictory with the Kolibri user experience and documentation. I.E. if we need to patch Kolibri to read some envs that don't conflict with options.ini, that's fine. What we should avoid is having two different sources of truth, one for the people using the package and another for the rest of the users.
Why does kolibri has to run as a daemon?, what is the problem in stopping it?
Some process has to run to download those 100 GB of channel data :slightly_smiling_face: I can't see it being a UWSGI worker... we harakiri them and scale the number of workers up and down... this won't work if suddenly a worker is busy for 2 days, or another worker starts doing the same, because they run w/o shared states etc.
I never heard of anyone doing background tasks in their UWSGI workers... async work has always been handled outside of UWSGI.. celery, channels etc. In our case, we use our own daemon w/ Iceqube. That's why I want to make sure we don't consider UWSGI workers w/ each their Iceqube. At all.
Side note: I don't think we can patch the code from upstream kolibri
from the kolibri-server
package.. it doesn't package that code :)
Ok, this is my proposal
HTTP_PORT=9999
(Bad side effect: Device info page will show port 9999, any idea to workaround it?)KOLIBRI_CHERRYPY_START=False kolibri start
) providing background services but not starting CherryPy, thus not opening any other portmy understanding is that this issue has been addressed.
If not, please open new individual issues and target any critical short-term ones to the v0.1.0 milestone
Bad side effect: Device info page will show port 9999, any idea to workaround it?
@jredrejo is there an issue open for this?
if it only affects versions prior to 0.12.x, my sense is that would be a 'wontfix' because we'd almost certainly want people to simply upgrade
@benjaoming @indirectlylit right, the wrong port in Device info page was solved in kolibri 0.12.0. Previously we had to keep two TCP ports open and Device info showed the wrong one. I'd say this is a fixed issue more than wonfix ;)
For the sake of keeping user facing documentation etc. simple, we should stick to the normal port
8080
. But this port is already occupied by CherryPy. So we would need a way to switch off CherryPy.Secondly, we would want to pick up a user-defined port. It's not exactly known how we can read the user-defined port, but let's get a good interface for the
kolibri
environment to launch and detect its own port.