Sometimes you need to have service, that just puts out HTTP Errors. Either on purpose or - even better - randomly.
So here it is!
You can use /.well-known/health-check for your health probes of you container manager.
You can call /errors/random for a totally random status.
Errors have a probability of 70%.
There is a - hardcoded - list of Errors:
var errorsList = [...]int{ http.StatusInternalServerError, http.StatusServiceUnavailable, http.StatusBadRequest, http.StatusBadGateway, http.StatusConflict}
You can also call /codes/xxx for a result with that specific status code.
Everthing above 399 counts as an error.
If you go to / you see the generator page.
You can click the start button, and a background request will be done to /errors/random every 500ms.
All errors are listed.
You may click stop if you have enough errors.
You need to have javascript enable for that one.
You can forcefully kill the service by sending a POST to /kill.
E.g.:
curl -X POST http://localhost:9000/kill
You can build the service with build.sh - you need docker for that one.
You can run the service with run.sh - you need docker for that one.
If there is already a version present, just do a docker pull phaus/error-service:latest
Enjoy! Leave a comment to tell me, what you are doing with this!