hoarder-app / hoarder

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search
https://hoarder.app
GNU Affero General Public License v3.0
6.48k stars 235 forks source link

Hoarder-app always unhealthy #625

Closed hot22shot closed 2 weeks ago

hot22shot commented 2 weeks ago

Describe the Bug

Hi,

The health status is always unhealthy for the docker container of the hoarder-app. But the application is working correctly.

I checked the healthcheck and found that the test fails :

/app # wget --spider http://127.0.0.1:3000/api/health Connecting to 127.0.0.1:3000 (127.0.0.1:3000) wget: can't connect to remote host (127.0.0.1): Connection refused

But if I use the actual @ip of the container it works :

/app # wget --spider http://172.24.0.5:3000/api/health Connecting to 172.24.0.5:3000 (172.24.0.5:3000) remote file exists

Steps to Reproduce

Check the status of the hoarder-app container.

Expected Behaviour

healthcheck is OK

Screenshots or Additional Context

No response

Device Details

No response

Exact Hoarder Version

0.18.0

MohamedBassem commented 2 weeks ago

hmmm, that's interesting. Are you running the container in any special setup? Kubernetes, for example?

hot22shot commented 2 weeks ago

My host is an unraid server with docker and I used portainer to deploy it with a stack.

MohamedBassem commented 2 weeks ago

Are you using "network=host" by any chance?

hot22shot commented 2 weeks ago

no, I have a dedicated network for the stack :

networks:
  info-network:
    name: info-network
    driver: bridge
MohamedBassem commented 2 weeks ago

hmmm, interesting. Does using localhost work by any chance?

hot22shot commented 2 weeks ago

localhost is also failing :

/app # wget --spider http://localhost:3000/api/health
Connecting to localhost:3000 ([::1]:3000)
wget: can't connect to remote host: Connection refused
MohamedBassem commented 2 weeks ago

Ok this will need some googling I guess. Can you share your compose file for reference?

hot22shot commented 2 weeks ago

I solved it, I had a HOSTNAME env variable set to "hoarder-app" in my docker-compose file, that conflicted with :

const hostname = process.env.HOSTNAME || '0.0.0.0'

in the server.js file.

It prevented hoarder from biding 0.0.0.0 and instead only binded the local address of the container. Once I commented my variable in the docker compose script the container is now healthy !

MohamedBassem commented 2 weeks ago

ah that makes sense 👍