Difegue / LANraragi

Web application for archival and reading of manga/doujinshi. Lightweight and Docker-ready for NAS/servers.
https://lrr.tvc-16.science
MIT License
2.25k stars 160 forks source link

`wget` used by container health check does not respect 'no_proxy' environment variable. #1040

Closed arusuki closed 3 months ago

arusuki commented 3 months ago

LRR Version and OS LRRVersion: 0.9.21 OS: Synology DSM 7.1-42661 Installation method: Docker Container

Summary The LRR container uses wget to check its health status, while the wget shipped with alpine image is from busybox which does not respect the no_proxy environment variable.

Therefore, when http_proxy and https_proxy environment variables are set, the wget command launched by docker health check uses proxy to access http://localhost:3000 and fails the test. The docker ps command therefore reports LRR container in unhealthy state which is false positive.

Possible Solutions

To Reproduce

When http_proxy and https_proxy environment variables are set, command docker ps shows the LRR container in unhealthy states.

CONTAINER ID   IMAGE                                 COMMAND                  CREATED          STATUS                      PORTS
3a9f9661f76d   difegue/lanraragi:latest              "//init"                 59 minutes ago   Up 23 minutes (unhealthy)   0.0.0.0:3000->3000/tcp                                    

To verify further, running command docker exec -it <LRR container ID> sh gives a shell in LRR container, then test the wget used by health check.

#inspect proxy settings
/home/koyomi/lanraragi # echo $http_proxy
http://172.28.0.1:7890
/home/koyomi/lanraragi # echo $https_proxy
http://172.28.0.1:7890
/home/koyomi/lanraragi # echo $no_proxy
localhost,127.0.0.1

#check health
/home/koyomi/lanraragi # wget --quiet --tries=1 --no-check-certificate --spider http://localhost:3000
wget: server returned error: HTTP/1.1 502 Bad Gateway

#Force wget to ignore proxy
/home/koyomi/lanraragi # wget --quiet --tries=1 --no-check-certificate --spider -Y off http://localhost:3000
/home/koyomi/lanraragi # echo $?
0

#install GNU wget
/home/koyomi/lanraragi # apk add wget
/home/koyomi/lanraragi # wget --quiet --tries=1 --no-check-certificate --spider http://localhost:3000
/home/koyomi/lanraragi # echo $?
0
Difegue commented 3 months ago

That makes sense to me. Thanks for the detailed explanation!

@holopin-bot @arusuki give-him-the-burg

holopin-bot[bot] commented 3 months ago

Congratulations @arusuki, the maintainer of this repository has issued you a badge! Here it is: https://holopin.io/claim/clz8ozi2k89330cjsu7o6pwrc

This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account. Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!