future runtime dependencies / cockpit-ws rewrite #18973
Replies: 3 comments 2 replies
-
@Nykseli and me have been experimenting with rewriting cockpit-ws in rust. Its written in actix and supports HTTP2. would upstream be interested in pursuing this? |
Beta Was this translation helpful? Give feedback.
-
No, that's not the webserver, but the bridge. Indeed we want to rewrite the web server in Rust or Python as well at some point, but (1) this still needs some more fundamental discussions about its architecture, and (2) we want to finish the bridge project first before we start another major project.
Yes, but we have a lot of build tools/scripts which are in Python, and they will even increase in the future. That certainly shouldn't matter much as a build dep? But still, quite a lot of cockpit pages also run python helper scripts to implement functionality in a portable way, so we already have several Python runtime dependencies even before the bridge rewrite.
No -- Cockpit pages use D-Bus/shell/CLI where possible, but some functionality (e.g. in cockpit-machines) cannot be done with existing OS APIs, and requires something more strong than shell. Rust or other compiled languages don't work, as this needs to be architecture independent. Python is pretty much the only adequate choice here. |
Beta Was this translation helpful? Give feedback.
-
I wanted to quickly write down how this AFAIK might not be quite true. I don't know whether that in practice means anything for cockpit. But the topic came up again elsewhere and I wanted to make sure to write it down to link to. While python is often already available, it seems to becomes less so. WASM seems to me to be already more widely available, though that depends on the niche. Also that neglects that we can influence what is available. AFAIK what cockpit is doing now is similar to salt-ssh: pack up the python code (from where the webserver/cockpit-ws run) to run it on the python runtime available on the target (where the bridge runs). (salt-ssh is in my experience brittle, not sure what causes this.) Other choices that might be adequate (possibly in combination):
|
Beta Was this translation helpful? Give feedback.
-
Questions at the end.
Current state from my limited investigation:
It seems there is a python rewrite of cockpit-ws in the source.
The spec file mentions python in some places where I don't have investigated the reason:
Even if the python bridge and pytest tests are disabled there is a BuildRequires:
cockpit/tools/cockpit.spec
Line 107 in 4975d24
There is a suggests from cockpit-ws on it:
cockpit/tools/cockpit.spec
Lines 448 to 449 in 4975d24
cockpit-storaged requires it:
cockpit/tools/cockpit.spec
Line 647 in 4975d24
cockpit-packagekit has a recommneds on it:
cockpit/tools/cockpit.spec
Line 698 in 4975d24
I'm not sure if the pytests are only for cockpit-ws.
I have not done a comprehensive list, but a quick overview seems to indicate that the other dependencies are together smaller than the 40MB that python weighs.
#17483 (comment)
Mentions that a goal of rewriting cockpit-ws in Python or Rust is to use a webserver library and support http/2.
#17504
Mentions that the cockpit-auth-ssh-key script requires python which adds 40MB and "could eventually be ported to Rust".
I have not found anything in the docs or mailing list or github issues/discussions about the plans regarding it.
OpenSUSE Tumbleweed Micro currently doesn't have python in its image and would prefer to keep it that way for size reasons.
Fedora Coreos, might not want to pull in python either for similar reasons, but I have not checked.
(CC: @djoreilly @Nykseli @Lunarequest )
Maybe @martinpitt is the right person to ask.
Darragh did a proof of concept re-implementation: https://github.com/djoreilly/cockpit-auth-ssh-key
Would such an implementation be welcome to replace the existing script?
Are there any other goals of the cockpit-ws rewrite?
Is there any plan for other things to depend on python?
Besides cockpit-auth-ssh-key and rewritten cockpit-ws what else currently depends on python?
Is there any plan to rewrite other things that might increase runtime dependency size?
Would changing direction away from python as a runtime dependency be considered?
Beta Was this translation helpful? Give feedback.
All reactions