You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a docker container sometimes it's hard for docker to know the status of the program(s) running inside the the container. To help docker know if everything is running as intended we can use something called health check.
By adding a HEALTHCHECK line to our Dockerfile we can periodically try to connect to our server and if it returns 200 OK everything is fine but if it returns an error too many times in a row the container will be marked as unhealthy.
To make the system better we can add an url to our server like http://localhost:8080/status which can be queried and return the status of the server as a simple 200 OK or some other error message when the server isn't running as intended.
The text was updated successfully, but these errors were encountered:
When a request comes in to the server an instance of ClientHandler will be created and its run method will be called in a thread.
When reading information from the incoming request there will be a path in the first line containing /status.
Using the HttpParser class in our project we can get help obtaining this information.
It's then a matter of running different code depending on what path is in the request.
When running a docker container sometimes it's hard for docker to know the status of the program(s) running inside the the container. To help docker know if everything is running as intended we can use something called health check.
https://scoutapm.com/blog/how-to-use-docker-healthcheck
If we add the following to our Dockerfile:
HEALTHCHECK CMD curl --fail http://localhost:8080 || exit 1
By adding a HEALTHCHECK line to our Dockerfile we can periodically try to connect to our server and if it returns 200 OK everything is fine but if it returns an error too many times in a row the container will be marked as unhealthy.
To make the system better we can add an url to our server like http://localhost:8080/status which can be queried and return the status of the server as a simple 200 OK or some other error message when the server isn't running as intended.
The text was updated successfully, but these errors were encountered: