openwrt / luci

LuCI - OpenWrt Configuration Interface
Apache License 2.0
6.3k stars 2.51k forks source link

luci-app-dockerman missing main menu items #6885

Open Loafter opened 8 months ago

Loafter commented 8 months ago

luci-app-dockerman broken. It shows only the configuration button, and the full list appears only after reinstallation

to reproduce the bug:

  1. install luci-app-dockerman with depends
  2. check that after installation full menu available Annotation 2024-02-03 215940
  3. reboot router Now full menus is missing available only configuration Annotation 2024-02-03 220237
  4. remove luci-app-dockerman package
  5. install luci-app-dockerman package
  6. it appears again
  7. Annotation 2024-02-03 215940

DISTRIB_ID='OpenWrt' DISTRIB_RELEASE='23.05.2' DISTRIB_REVISION='r23630-842932a63d' DISTRIB_TARGET='x86/64' DISTRIB_ARCH='x86_64' DISTRIB_DESCRIPTION='OpenWrt 23.05.2 r23630-842932a63d / LuCI openwrt-23.05 branch git-24.006.68745-9128656'

systemcrash commented 8 months ago

Anyone with lua experience who can look at this? dockerman needs porting to js anyway.

stokito commented 7 months ago

Looks similar to #6280

@systemcrash before converting the dockerman to JS we should check and grab changes from upstream https://github.com/lisaac/luci-app-dockerman.

We may convert easily some parts but for other we'll need to call a lua script which is a shim for a Docker REST API. That may be resolved later, this is not critical to still have some non UI parts in Lua.

Basically I started from this task but there wasn't a good solution and I paused and switched to other tasks.

So if you'll have a desire to convert the dockerman to JS please let me know and I'll join. I have it somewhere in a middle of my TODO.

systemcrash commented 7 months ago

Is ucode an option?

stokito commented 7 months ago

It should be possible to make in a plain shell. Still, that's not blocking to convert the UI to JS.

tignioj commented 7 months ago

Same issue.

dannil commented 6 months ago

When fixing https://github.com/openwrt/luci/pull/6998 I discovered that I was able to make the menu behave as before by installing dockerd on my host. I'm definitely not fluent in Lua but it looks like the code which configures the menus exits early if it can't contact either the remote or local socket. This may also be related to https://github.com/openwrt/luci/pull/6985 however, if my suspicion is correct, the solution would probably be to make the menus behave appropriately even if a socket connection can't be made instead of forcing dockerd to be a mandatory dependency (see discussion in that PR for more context).

https://github.com/openwrt/luci/blob/f2a49104c4839cc61c0c6a32cf0b616ca7b7d667/applications/luci-app-dockerman/luasrc/controller/dockerman.lua#L18-L34

JKSTAFF commented 6 months ago

My guess is that the order of service startup and page loading may be causing the display error.
Here is my reproduce. After a normal system boot, when I could access the incomplete luci-dockerman, type docker command in console (take docker ps as an example ) reported this:

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

So I waited for all containers to autostart, and then docker command returned to usable. At this time, I clear the luci cache under the tmp and now I can access the missing menu again through the subpath.

flhofer commented 6 months ago

Hi, you can simply change the startup order by changing the priority in /etc/rc.d/

I, for example, set it to 45, before uhttpd at 50. mv S99dockerd S45dockerd

Now it is visible again. Note that the priority in the web interface does not update. That might be because its generated at trigger only.

JKSTAFF commented 6 months ago

Hi, you can simply change the startup order by changing the priority in /etc/rc.d/

Thank you for reply but I already tried that way (in my build it's nginx instead of httpd) and cause the same result. I also changed dockerd start priority in /etc/init.d

flhofer commented 6 months ago

Hi @JKSTAFF

I also changed dockerd start priority in /etc/init.d

What do you mean by that?

Don't confuse init.d with rc.d. The latter sets the order and contains only symlinks to the scripts in init.d. The S or K stands for start or kill, and the 2-digit number is the order, where 99 is last. If you use nginx as server, you might check what order that is and change the number accordingly.

Let me know if you need further explanation

JKSTAFF commented 6 months ago

Hi @flhofer Thank you for your patience and explanation. In my build modifying /etc/rc.d/S99dockerd lower than 60 takes precedence over nginx(S60).

I also changed dockerd start priority in /etc/init.d

I mean I also modified /etc/init.d/dockerd like this:

#!/bin/sh /etc/rc.common

USE_PROCD=1
START=99 → 50   ## I changed here

extra_command "uciadd" "<interface> <device> <zone> Add docker bridge configuration to network and firewall uci config"
..............

At least it doesn't work for me

Loafter commented 6 months ago

Yep. Guys look like this bug still appears. I have two x86 OpenWrt Host with latest 23.05.3 version and latest 24 luci-docker plugin. and one of this host display full menu items and second with missing menu items, difference only with count of container, with displayed have only one container and onother about 7 containers

flhofer commented 6 months ago

@Loafter @JKSTAFF, so it looks like if you have many containers to run at the start, the daemon is not responsive right away. In my case, it works as I have only two smaller containers. Maybe we need some autostart delay for dockerd's containers.

Rategh commented 3 months ago

I'm experiencing the same issue with OpenWrt on a Raspberry Pi. I only have one container running, and I'm using the latest versions of Docker and the Luci app.

zxn10 commented 1 month ago

I'm having the same issue. The dropdown menu appears inconsistently - sometimes it shows up, and other times it doesn't.

I don't believe it's related to the service start order. I ran docker ps and confirmed that all my containers are running fine. However, after restarting uhttps, the menu still didn't appear in Luci