Skip to content
Snippets Groups Projects
Commit ee1ab308 authored by furion's avatar furion
Browse files

[docs] update documentation

parent a8b60cfe
No related branches found
No related tags found
No related merge requests found
...@@ -2,20 +2,10 @@ ...@@ -2,20 +2,10 @@
`hivemind` is an off-chain consensus layer for Steem communities and API server for social features like feeds and follows. `hivemind` is an off-chain consensus layer for Steem communities and API server for social features like feeds and follows.
# Dev Environment # Dev Environment
Make sure you have Python 3.5+, Docker and MySQL installed on your local machine.
Prepare MySQL Database (once):
```
make mysql
```
Prepare and load REPL (on change):
```
make build
make iypthon
```
## Setting up MySQL ## Setting up MySQL
First, we need to setup a MySQL server. An easy way to do that (in Docker) is to run: First, we need to start a MySQL server (in Docker).
``` ```
make mysql make mysql
``` ```
...@@ -24,6 +14,7 @@ Then we need to set `DATABASE_URL` environment variable, for example: ...@@ -24,6 +14,7 @@ Then we need to set `DATABASE_URL` environment variable, for example:
``` ```
set DATABASE_URL 'mysql://root:root_password@mysql:3306/testdb' set DATABASE_URL 'mysql://root:root_password@mysql:3306/testdb'
``` ```
*I defined `mysql` in `/etc/hosts` such that it links to mysql docker container IP.*
Lastly we invoke the `ensure-schema` command to create MySQL tables. Lastly we invoke the `ensure-schema` command to create MySQL tables.
......
...@@ -2,6 +2,32 @@ hive-cli ...@@ -2,6 +2,32 @@ hive-cli
~~~~~~~~ ~~~~~~~~
`hive` is a convenient CLI utility that enables you to manage the indexer, or spin up the `JSON-RPC` server. `hive` is a convenient CLI utility that enables you to manage the indexer, or spin up the `JSON-RPC` server.
Usage
-----
::
~/G/s/hive % hive -h
Usage: hive [OPTIONS] COMMAND [ARGS]...
The *hive* CLI manages database, indexer and the server.
For more detailed information on a command and its flags, run:
hive COMMAND --help
Options:
-h, --help Show this message and exit.
Commands:
db Database Level Operations.
indexer Parse the blockchain and index the MySQL...
server HTTP server for answering DB queries
Database Commands
-----------------
Todo
Server Commands Server Commands
--------------- ---------------
Todo Todo
......
Modules Modules
~~~~~~~ ~~~~~~~
``hive`` is comprised of the following modules: **hive** is comprised of the following modules:
- ``hive.indexer`` - ``hive.indexer``
- ``hive.db``
- ``hive.server`` - ``hive.server``
- ``hive.extras`` - ``hive.extras``
...@@ -22,6 +23,27 @@ hive.server ...@@ -22,6 +23,27 @@ hive.server
.. automodule:: hive.server .. automodule:: hive.server
:members: :members:
Health Check
------------
To perform a health check, perform a `GET` on ``/health``.
Returns 200 if everything is OK, and 500 /w json error message otherwise.
JSON-RPC Example
----------------
.. code-block:: python
from jsonrpcclient.http_client import HTTPClient
HTTPClient('http://localhost:1234').request('hive.status')
Outputs:
::
--> {"jsonrpc": "2.0", "method": "hive.status", "id": 8}
<-- {"result": {"diff": 6396850, "hive": 5042966, "steemd": 11439816}, "id": 8, "jsonrpc": "2.0"} (200 OK)
Result: {'diff': 6396850, 'hive': 5042966, 'steemd': 11439816}
-------- --------
hive.extras hive.extras
......
...@@ -11,11 +11,8 @@ context_settings = dict(help_option_names=['-h', '--help']) ...@@ -11,11 +11,8 @@ context_settings = dict(help_option_names=['-h', '--help'])
context_settings=context_settings, context_settings=context_settings,
) )
def cli(): def cli():
"""The *hive* CLI manages storage, retrieval, and querying of the Steem """The *hive* CLI manages database, indexer and the server.
blockchain.
hive has several commands, each of which has additional subcommands.
\b \b
For more detailed information on a command and its flags, run: For more detailed information on a command and its flags, run:
hive COMMAND --help hive COMMAND --help
......
...@@ -85,14 +85,6 @@ json_rpc_methods = { ...@@ -85,14 +85,6 @@ json_rpc_methods = {
for method_name, fn_call in json_rpc_methods.items(): for method_name, fn_call in json_rpc_methods.items():
jsonrpc.register_method(method=fn_call, method_name=method_name) jsonrpc.register_method(method=fn_call, method_name=method_name)
# TODO: add to documentation
# In [9]: from jsonrpcclient.http_client import HTTPClient
#
# In [10]: HTTPClient('http://localhost:1234').request('hive.status')
# --> {"jsonrpc": "2.0", "method": "hive.status", "id": 8}
# <-- {"result": {"diff": 6396850, "hive": 5042966, "steemd": 11439816}, "id": 8, "jsonrpc": "2.0"} (200 OK)
# Out[10]: {'diff': 6396850, 'hive': 5042966, 'steemd': 11439816}
# WSGI application # WSGI application
# ---------------- # ----------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment