Commit 1feae87d authored by justinw's avatar justinw

bring readme more up-to-date

parent 10f0d4d6
......@@ -2,6 +2,18 @@
A reverse proxy that only speaks json-rpc 2.0. Upstream routing is done using json-rpc method "namespaces".
## Building & Running
The easiest way to get up and running with jussi is by running it in a docker container.
1) Copy the example `DEV_config.json` to a local directory and make any necessary edits.
2) Run this docker command (replace `/path/to/config.json` with the path to your config file):
```
docker run -it --env JUSSI_UPSTREAM_CONFIG_FILE=/app/config.json -v /path/to/config.json:/app/config.json -p 9000:9000 steemit/jussi:latest
```
You can build jussi using docker which will run it's full test suite with `docker build -t="myname/jussi:latest" .`
## Namespaces
A json-rpc method namespace is a json-rpc method prefix joined to the method name with a period, so a method in the "sbds" namespace begins with `sbds.` and will be forwarded to a sbds endpoint:
```
......@@ -31,6 +43,57 @@ Content-Type: application/json
}
```
### Configuring and routing additional namespaces
Jussi comes with an example config file, `DEV_config.json`. You can add additional namespaces for routing different calls to different hosts.
Additional namespaces can be added to the upstreams array:
```
{
"name": "foo",
"urls": [["foo", "https://foo.host.name"]],
"ttls": [["foo", 3]],
"timeouts": [["foo", 5]]
}
```
Once the above upstream has been added to your local config and jussi, the following curl would work:
```
curl -s --data '{"jsonrpc":"2.0", "method":"foo.bar", "params":["baz"], "id":1}' http://localhost:9000
```
### Caching and Time to Live
For each namespace, you can configure a time to live (ttl). Jussi will cache any request for this namespace for however long you specify. Setting to `0` won't expire, `-1` won't be cached, and `-2` will be cached without expiration only if it is still irreversible on chain. Any positive number is te number of seconds to cache the request.
### Multiple routes
Each urls key can have multiple endpoints for each namespace. For example:
```
{
"urls":[
["appbase", "https://api.steemitdev.com"]
]
}
```
… could be expaned to list specific additional methods in that namespace:
```
{
"urls":[
["appbase","https://api.steemitdev.com"],
["appbase.condenser_api.get_account_history","https://api-for-account-history.steemitdev.com"],
["appbase.condenser_api.get_ops_in_block","https://api-for-get-ops-in-block.steemitdev.com"]
]
}
```
This makes it possible to forward specific calls to specific clusters of nodes.
## What jussi does
### At Startup
1. parse the upstream config and build the routing, caching, timeout data structures
......@@ -65,3 +128,7 @@ Content-Type: application/json
1. return single jsonrpc response or assembled jsonrpc responses for batch requests
1. cache response in redis cache
1. cache response in memory
## Additional documentation
For more indepth documentation on jussi including examples, check out the section on it in the steem dev portal: https://developers.steem.io/services/#services-jussi
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment