Open reusu opened 1 year ago
这将是个很大的工程量,暂时没有时间做这些
I can assist here and convert Lua to JavaScript. Will you review and accept PR?
我可以在这里提供帮助,将 Lua 转换为 JavaScript。 你会审查并接受 PR 吗?
@stokito yes, of course.
but the first thing we need to do is to forward the docker daemon socket, I have written a demo before, please refer. https://github.com/lisaac/luci-in-docker/commit/4d9afdd5789455ffa0011cd215efed29f7e861b8
As far I understood the forwarder is needed to translate HTTP calls to a unix socket e.g. this is a reverse proxy.
Basically the dockermon itself can be rewritten to JS but the forwarder can remain in Lua for now. Using JS will make it easier to learn and contribute for others. The Lua is deprecated now in OpenWrt and instead was added ucode (light server side JS).
The dockerd supports exposing it's http api as tcp socket. But it requires for enabled HTTPS and authorization.
The Docker Engine daemon API is JSON based https://docs.docker.com/engine/api/v1.43/
The docker
command by itself just send request with this api.
We can do the same directly from UI and then we don't need the docker
client to be installed on the OpenWrt.
I found the ui-for-docker that works in this way: plain html and js that sends docker api requests. It anyway has a small reverse proxy to the docker unix socket just to make it easier to start without configuring the docker api endpoint. The author of the project later created Portainer.
We can avoid creating of the reverse proxy by creating a rpcd service that we can call with UBUS. Internally it can just get the JSON payload and resend it with curl into a unix socket or remote https. It's basically few lines of a shell script. I can do that for you if you wish to try.
Yes, it is a reverse proxy.
I am happy that they changed it to ucode, so we can use js to write back-end!
Also I think we need to add streaming and websocket support, which is important for future dockerman.
And Im not sure if ubus rpcd service can handle this? or maybe we can simply use nginx to reverse proxy it?
I created a separate issue on this https://github.com/openwrt/luci/issues/7313
看了下程序是luci-compat模式的 现在openwrt官方默认都用luci2的模式来写luci-app了 大佬有兴趣从compat移到纯js+ubus的luci2么