obsidian-remote icon indicating copy to clipboard operation
obsidian-remote copied to clipboard

Container fails healthcheck when custom_user and password enabled

Open micahmorgan1 opened this issue 2 years ago • 2 comments

Describe the bug Using Portainer I was able to get the image up and running. The env options seem to work, but when I enable the custom_user and custom password options the container fails the healthcheck and gets a warning label "unhealthy" If I turn those options off, healthcheck passes.

The error log shows a 401 unauthorized error, returning an exit code 1.

I'm assuming this is because the pop-up user log-in is preventing the curl script from accessing the page and getting the response it needs to issue the exit code 0.

The container seems to run fine, but I was hoping to get rid of the this warning label. Perhaps it's a portainer issue. Any help or direction would be appreciated.

micahmorgan1 avatar Sep 01 '23 03:09 micahmorgan1

I'll have to look. The container runs in my local network so I have not changed it from the default.

I'll try to reproduce next week.

sytone avatar Sep 26 '23 20:09 sytone

You can include the authentication information in your curl command using the -u option. For example: HEALTHCHECK CMD curl --fail --user ${username}:${password} http://localhost:8080/ || exit 1 But i don't know how it would act if no auth is set...

drdada avatar Oct 07 '23 16:10 drdada

I just tried this project, it works perfectly. But I exeperinced this problem too. Fixed adding this to my compose.yml:

    healthcheck:
      test: ["CMD", "curl", "--fail", "--user", "${CUSTOM_USER}:${PASSWORD}", "http://localhost:8080/"]
      interval: 1m30s
      timeout: 10s
      retries: 3
      start_period: 30s  

I tested it a little bit and works both in case you specify CUSTOM_USER and PASSWORD or not. Anyway I'll fork the project and suggest to modify the HEALTHCHECK directive in the Dockerfile in order to take into account these 2 env vars, without the need to ovverride the check in the compose

xX-MrN0b0dy-Xx avatar Oct 20 '24 11:10 xX-MrN0b0dy-Xx