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

Dockerfile is missing HEALTHCHECK #8404

Closed
3 tasks done
kare opened this issue Sep 3, 2021 · 17 comments · Fixed by #8429
Closed
3 tasks done

Dockerfile is missing HEALTHCHECK #8404

kare opened this issue Sep 3, 2021 · 17 comments · Fixed by #8429
Labels
effort/hours Estimated to take one or several hours exp/novice Someone with a little familiarity can pick up good first issue Good issue for new contributors help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature P3 Low: Not priority right now

Comments

@kare
Copy link

kare commented Sep 3, 2021

Checklist

  • My issue is specific & actionable.
  • I am not suggesting a protocol enhancement.
  • I have searched on the issue tracker for my issue.

Description

Dockerfile is missing HEALTHCHECK. It would be a nice addition. Something simple should work like checking whether exposed ports respond with curl or netcat. https://docs.docker.com/engine/reference/builder/#healthcheck

@kare kare added the kind/enhancement A net-new feature or improvement to an existing feature label Sep 3, 2021
@welcome
Copy link

welcome bot commented Sep 3, 2021

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review.
In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment.
Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

@Stebalien Stebalien added effort/hours Estimated to take one or several hours exp/novice Someone with a little familiarity can pick up P3 Low: Not priority right now good first issue Good issue for new contributors help wanted Seeking public contribution on this issue labels Sep 6, 2021
@arjunraghurama
Copy link
Contributor

Hello,
Which endpoint to query in order check if the container is healthy or not?
I hope it is localhost:8080

@kare
Copy link
Author

kare commented Sep 9, 2021

Container exposes several ports both tcp and udp. See Dockerfile for details.

# Swarm TCP; should be exposed to the public
EXPOSE 4001
# Swarm UDP; should be exposed to the public
EXPOSE 4001/udp
# Daemon API; must not be exposed publicly but to client services under you control
EXPOSE 5001
# Web Gateway; can be exposed publicly with a proxy, e.g. as https://ipfs.example.org
EXPOSE 8080
# Swarm Websockets; must be exposed publicly when the node is listening using the websocket transport (/ipX/.../tcp/8081/ws).
EXPOSE 8081

Checking ports 4001/tcp, 4001/udp, and 5001/tcp would be a good start.
Secondary would be a Websocket connection to port 8081/tcp and HTTP connection to port 8080/tcp.

Am I right in thinking @Stebalien?

@Stebalien
Copy link
Member

I would check if some known file can be retrieved from the gateway. E.g., the empty directory. That should provide a reasonable end-to-end health check.

@arjunraghurama
Copy link
Contributor

arjunraghurama commented Sep 9, 2021

What about http://localhost:5001/webui ?

@Stebalien
Copy link
Member

Stebalien commented Sep 9, 2021 via email

@arjunraghurama
Copy link
Contributor

Hey @Stebalien I found below file is guaranteed to exist after a node has started.
QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme. Is this fine??

@Stebalien
Copy link
Member

As long as that CID isn't hard-coded because it can change and a hard-coded CID will bit rot.

@arjunraghurama
Copy link
Contributor

Yeah. The contents of readme file might change in future resulting in change of CID. I couldn't figure out the path of readme file inside the container.
ipfs id command will return node info once it is up. Can this be used?

@arjunraghurama
Copy link
Contributor

Or we could ping any one of the node in the swarm?

@Stebalien
Copy link
Member

Stebalien commented Sep 10, 2021 via email

@arjunraghurama
Copy link
Contributor

arjunraghurama commented Sep 10, 2021

I tried this within the container

hash=`echo "I <3 IPFS -$(whoami)" | ipfs add -q`
wget "https://ipfs.io/ipfs/$hash" -O /dev/null &> /dev/null

but wget sometimes fails fetch the file

This is what i found out later
The public gateways may be overloaded or having a hard time reaching you

@Stebalien
Copy link
Member

Stebalien commented Sep 10, 2021 via email

@arjunraghurama
Copy link
Contributor

Well in that case, we would need to create an empty directory that no one will add any data into and add directory to ipfs and then fetch locally. Is this flow correct?

@Stebalien
Copy link
Member

Stebalien commented Sep 11, 2021 via email

@arjunraghurama
Copy link
Contributor

Oh. Okay. I was unaware of that. Thanks for the info.

@kare
Copy link
Author

kare commented Oct 18, 2021

Big Thank You to all who contributed!

cc: @arjunraghurama @Stebalien

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/hours Estimated to take one or several hours exp/novice Someone with a little familiarity can pick up good first issue Good issue for new contributors help wanted Seeking public contribution on this issue kind/enhancement A net-new feature or improvement to an existing feature P3 Low: Not priority right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants