Just an HTTP server for useful microservices testing purposes
322
https://hub.docker.com/r/efbar/minimal-service
https://github.com/efbar/minimal-service/blob/main/Dockerfile
The purpose is to create a simple HTTP service to be used in microservices environments. This service can be deployed as raw binary or as a container and could be useful for testing service-to-service communication with focus on service discovery and service mesh scenarios.
It accepts only two methods, GET and POST.
At every GET request, it will respond with the same sent body or none if empty or not present in request. It will add some useful headers like timing metrics related headers and who served the request.
Request Content-Type could be application/json and text/plain, it will respond accordingly.
A POST request at path /bounce is accepted. Then it will check that body must include a json string:
{"rebound":"true","endpoint":"http://my.other.service"}
it will strictly check json keys and then it will do a GET request to the endpoint filled in endpoint key.
Every other body with any differences (unless the endpoint value) will be discarded and warned.
If the endpoint value has a valid and alive url and the next POST request ends positively, the response will have as Headers the ones received from the endpoint response, plus some others like Response-time, Request-time and Duration.
The body will contain the endpoint's response HTTP status (OK 200).
In case of not 200 codes from the endpoint, the headers will be not modified and the body will contain 500 Internal Server Error.
The service has some features and you can set them with environment variables.
0 to the chosen value.This service can be started setting various environment variables, here the list:
| Env variable | default | value range |
|---|---|---|
SERVICE_PORT | 9090 | |
DELAY_MAX | 0 | |
TRACING | 0 | 0 or 1 |
JAEGER_URL | http://localhost:14268/api/traces | URI in form scheme://host:port/api/traces |
DISCARD_QUOTA | 0 | from 0 to 100 |
REJECT | 0 | 0 or 1 |
DEBUG | 0 | 0 or 1 |
CONNECT | 0 | 0 or 1 |
CONSUL_SERVER | http://127.0.0.1:8500 | URI in form scheme://host:port |
You can perform an health-check with a simple GET request at path /health.
If up, it will respond with a 200 status and with Status OK string in body.
You can use Makefile:
Choose a command from list below
usage: make <command>
build
run
install
test
clean
build-linux
build-mac
build-windows
build-docker
Content type
Image
Digest
sha256:262c89867…
Size
14.6 MB
Last updated
over 3 years ago
docker pull efbar/minimal-service:1.0.2