Add `ping` to Docker image


(Eric Hagman) #1

Is there anyway we could add the ping utility to the Docker image? I use it for devop reasons (ping a sync container to see if it is done). It seems kind of silly that the entire perl interpreter is packaged but ping does not exist. I know you are now using linuxkit to generate the images, it should be simple enough, right?


(Michel Conrado (Support Engineer)) #2

You can use “/health HTTP status code 200 and “OK” message if worker is running, HTTP 503 otherwise.”

https://docs.dgraph.io/deploy#more-about-dgraph

And inside the Dgraph image there is a cURL bin if you need to use.

Read more about other restrictions:

https://docs.dgraph.io/deploy#dgraph-administration


(Eric Hagman) #3

What does “if the worker is running” mean? Unless it means that the server has loaded all predicates from bulk export and is ready to run queries, I still need to use ping to do what I want.

I have a separate container that spins up, does some operations, and creates the RDF file and uses the bulk loader to create the p folder. After this is done, the container quits.

My script pings the sync container and when it goes down, starts the Dgraph server.

Any other way to do that???


(Michel Conrado (Support Engineer)) #4

Well, how “ping” would know so much information about a process from a different binary?

Ping would just give you the information that the instance is running. /health does much more than that. It is an endpoint made for admin. Where the administrator knows the server is not in trouble. It is the Dgraph’s own binary declaring this information. Ping would never do that.

Nice.

Well, if the instance goes down, obviously the endpoint /health will no longer be available. This is equivalent to the same Ping process.

If you have something more complicated, try some process with webhooks via cURL. That would be more elaborate than Pings.


(Eric Hagman) #5

I think you are misinterpreting what I would like to do. I essentially don’t want to start the server until the initial sync occurs. I’m not checking if the Dgraph server is up, I know it isn’t because I haven’t started it yet. Checking the /health endpoint doesn’t do anything for me unless I know what “200 OK” means.

The description is very vague. Does it mean the data has loaded? Does it just mean the zero server isn’t broken?


(Michel Conrado (Support Engineer)) #6

just mean the * server isn’t broken


(Michel Conrado (Support Engineer)) #7

If you wanna more about the cluster State, try
localhost:6080/state
You gonna have better details of what is in the servers.

https://docs.dgraph.io/deploy/#more-about-dgraph-zero


(Eric Hagman) #8

Yeah I ended up writing my own script to ping /state and detect when it finds a leader that is setup.


(Michel Conrado (Support Engineer)) #9

Nice! I’m glad you solved it out.


(Michel Conrado (Support Engineer)) #10

Hey, Manish has change a bit the docker file, I believe that iputils-ping can work for you. Can give a shot? pull the last RC4 it’s pinned here on discuss.

Cheers