comment-server/README.md

62 lines
1.5 KiB
Markdown
Raw Normal View History

2019-06-06 03:23:08 -05:00
# LBRY Comment Server
2019-05-21 07:54:52 -04:00
2019-06-06 03:23:08 -05:00
## Installation
2019-05-21 07:54:52 -04:00
2019-06-06 03:23:08 -05:00
Firstly you'll need to install and run the `lbrynet` daemon,
the details of which can be found [here](https://github.com/osilkin98/lbryio/lbry).
2019-05-21 08:13:34 -04:00
2019-06-06 03:23:08 -05:00
Installing the server:
2019-05-21 08:13:34 -04:00
```bash
2019-06-06 03:23:08 -05:00
2019-05-21 08:13:34 -04:00
$ git clone https://github.com/osilkin98/comment-server
2019-06-06 03:23:08 -05:00
$ cd comment-server
2019-05-21 08:13:34 -04:00
2019-06-06 03:23:08 -05:00
# create a virtual environment
2019-05-21 08:19:39 -04:00
$ virtualenv --python=python3 venv
2019-05-21 08:13:34 -04:00
2019-06-06 03:23:08 -05:00
# Enter the virtual environment
$ source venv/bin/activate
# install the library dependencies
2019-05-21 08:19:39 -04:00
(venv) $ pip install -r requirements.txt
2019-05-21 08:13:34 -04:00
```
2019-06-06 03:23:08 -05:00
## Usage
2019-05-21 08:13:34 -04:00
2019-06-06 03:23:08 -05:00
First, make sure that the LBRY API server is running,
to do so you can run the following:
```bash
(venv) $ curl --data '{ "method": "status"}' http://localhost:5279/ | grep is_running
# Or from the lbrynet virtual environment:
(lbry-venv) $ lbrynet status | grep is_running
```
Then to start the server, simply run:
```bash
(venv) $ python -m main &
```
2019-05-21 08:13:34 -04:00
## Schema
![schema](schema.png)
## About
2019-05-21 07:54:52 -04:00
A lot of the design is more or less the same with the original,
2019-06-06 03:23:08 -05:00
except this version focuses less on performance and more on scalability.
2019-05-21 07:54:52 -04:00
2019-06-06 03:23:08 -05:00
Rewritten with python because it's easier to adjust
and maintain. Instead of doing any multithreading,
this implementation just delegates a single
database connection for write operations.
2019-05-21 07:54:52 -04:00
2019-06-06 03:23:08 -05:00
The server was originally implemented with `aiohttp`
2019-05-21 07:54:52 -04:00
and uses `aiojobs` for scheduling write operations.
2019-06-06 03:23:08 -05:00
As pointed out by several people, Python is a dinosaur
in comparison to SQLite's execution speed,
so there is no sensibility in multi-threading from the
perspective of the server code itself.