Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有想法使用luci2来重构下程序么 #157

Open
reusu opened this issue Dec 17, 2022 · 6 comments
Open

有想法使用luci2来重构下程序么 #157

reusu opened this issue Dec 17, 2022 · 6 comments

Comments

@reusu
Copy link

reusu commented Dec 17, 2022

看了下程序是luci-compat模式的
现在openwrt官方默认都用luci2的模式来写luci-app了
大佬有兴趣从compat移到纯js+ubus的luci2么

@lisaac
Copy link
Owner

lisaac commented Jul 6, 2023

这将是个很大的工程量,暂时没有时间做这些

@stokito
Copy link

stokito commented Aug 8, 2023

I can assist here and convert Lua to JavaScript. Will you review and accept PR?

我可以在这里提供帮助,将 Lua 转换为 JavaScript。 你会审查并接受 PR 吗?

@lisaac
Copy link
Owner

lisaac commented Aug 9, 2023

@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.
lisaac/luci-in-docker@4d9afdd

@stokito
Copy link

stokito commented Aug 9, 2023

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.

@lisaac
Copy link
Owner

lisaac commented Aug 9, 2023

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?

@stokito
Copy link

stokito commented Oct 8, 2024

I created a separate issue on this openwrt/luci#7313

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants