dobby is free and will serve your orders.
You can start dobby in Docker using:
$ docker run -p 4444:4444 thecasualcoder/dobby
which will start dobby server in port 4444
.
You can ask dobby any of the following
$ curl localhost:4444/version
$ curl localhost:4444/meta
Ask dobby
$ curl -i localhost:4444/health
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:32:02 GMT
Content-Length: 16
{"healthy":true}
$ curl -i -X PUT localhost:4444/control/health/perfect
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:33:02 GMT
Content-Length: 20
{"status":"success"}
$ curl -i localhost:4444/health
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:33:16 GMT
Content-Length: 16
{"healthy":true}
$ curl -i -X PUT localhost:4444/control/health/sick
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:33:29 GMT
Content-Length: 20
{"status":"success"}
$ curl -i localhost:4444/health
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:33:48 GMT
Content-Length: 17
{"healthy":false}
$ curl -i -X PUT "localhost:4444/control/health/sick?resetInSeconds=20"
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:34:42 GMT
Content-Length: 20
{"status":"success"}
$ curl -i localhost:4444/health
HTTP/1.1 500 Internal Server Error
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:34:47 GMT
Content-Length: 17
{"healthy":false}
# After 20seconds
$ curl -i localhost:4444/health
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:35:12 GMT
Content-Length: 16
{"healthy":true}
Ask dobby
$ curl -i localhost:4444/readiness
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:40:30 GMT
Content-Length: 14
{"ready":true}
$ curl -i -X PUT localhost:4444/control/ready/perfect
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:40:51 GMT
Content-Length: 20
{"status":"success"}
$ curl -i localhost:4444/readiness
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:41:25 GMT
Content-Length: 14
{"ready":true}
$ curl -i -X PUT localhost:4444/control/ready/sick
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:41:41 GMT
Content-Length: 20
{"status":"success"}
$ curl -i localhost:4444/readiness
HTTP/1.1 503 Service Unavailable
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:41:58 GMT
Content-Length: 15
{"ready":false}
$ curl -i -X PUT "localhost:4444/control/ready/sick?resetInSeconds=20"
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:42:39 GMT
Content-Length: 20
{"status":"success"}
$ curl -i localhost:4444/readiness
HTTP/1.1 503 Service Unavailable
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:42:43 GMT
Content-Length: 15
{"ready":false}
# After 20seconds
$ curl -i localhost:4444/readiness
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:43:05 GMT
Content-Length: 14
{"ready":true}
You can also ask dobby to
# to create a memory spike
$ curl -i -X PUT localhost:4444/control/goturbo/memory
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 12:00:22 GMT
Content-Length: 20
{"status":"success"}
# to create a cpu spike
$ curl -i -X PUT localhost:4444/control/goturbo/cpu
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 12:01:07 GMT
Content-Length: 20
{"status":"success"}
$ curl -i -X PUT localhost:4444/control/crash
# Beware, this is stop the running server
Ask dobby
$ curl -i localhost:4444/return/200
HTTP/1.1 200 OK
Date: Sun, 17 May 2020 09:51:13 GMT
Content-Length: 0
$ curl -i localhost:4444/return/401?delay=300
HTTP/1.1 401 Unauthorized
Date: Sun, 17 May 2020 09:50:34 GMT
Content-Length: 0
# To make a get request to http://httpbin.org/get
$ curl -i localhost:4444/call -d '{"url": "http://httpbin.org/get", "method": "GET"}'
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:46:25 GMT
Content-Length: 240
{"args":{},"headers":{},"url":"http://httpbin.org/get"}
# To make a post request to http://httpbin.org/post
$ curl -i localhost:4444/call -d '{"url": "http://httpbin.org/post", "method": "POST", "body": "{key: value}"}'
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:49:09 GMT
Content-Length: 311
{"args":{},"data":"\"{key: value}\"","files":{},"form":{},"headers":{},"json":"{key: value}","url":"http://httpbin.org/post"}
$ curl -i localhost:4444/proxy -d '{"path":"/time","method": "GET", "proxy": {"url":"http://worldtimeapi.org/api/timezone/asia/kolkata","method":"GET"}}'
HTTP/1.1 201 Created
Date: Tue, 16 Mar 2021 11:51:32 GMT
Content-Length: 0
$ curl -i localhost:4444/time
# makes a call to http://worldtimeapi.org/api/timezone/asia/kolkata
$ curl -i -X DELETE localhost:4444/proxy -d '{"path":"/time","method": "GET", "proxy": {"url":"http://worldtimeapi.org/api/timezone/asia/kolkata","method":"GET"}}'
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 16 Mar 2021 11:55:22 GMT
Content-Length: 50
{"result":"deleted the proxy config successfully"}
$ curl -i localhost:4444/time
HTTP/1.1 404 Not Found
Content-Type: text/plain
Date: Tue, 16 Mar 2021 11:55:46 GMT
Content-Length: 18
404 page not found
Available configurations:
Key | Value | Purpose | Default |
---|---|---|---|
VERSION | String | To set the version of program | Build Arg |
INITIAL_DELAY | Int | Sets the initial delay to start the server (in seconds) | 0 |
INITIAL_HEALTH | String | Sets the initial health of the program | TRUE |
INITIAL_READINESS | String | Sets the initial readiness of the program | TRUE |
PORT | Int | Sets the port of the server | 4444 |
BIND_ADDR | String | Listen address of the process | 127.0.0.1 |
$ git clone https://github.com/thecasualcoder/dobby.git && cd dobby
$ make compile
$ ./out/dobby server
Swagger docs will be available at: http://localhost:4444/swagger/index.html
Fork the repo and start contributing
- Make sure to run build before raising PR (
make build
) - Make sure to generate and check in swagger docs if any added (
make swagger-docs
) - Update README.md if necessary
- Check goreleaser before pushing (
goreleaser --snapshot --skip-publish --rm-dist --debug
)