2019-06-06 10:23:08 +02:00
|
|
|
# LBRY Comment Server
|
2019-05-21 13:54:52 +02:00
|
|
|
|
2019-09-06 17:45:37 +02:00
|
|
|
[![Build Status](https://travis-ci.com/lbryio/comment-server.svg?branch=master)](https://travis-ci.com/lbryio/comment-server)
|
2019-08-02 01:56:18 +02:00
|
|
|
[![Maintainability](https://api.codeclimate.com/v1/badges/22f420b8b5f2373fd885/maintainability)](https://codeclimate.com/github/lbryio/comment-server/maintainability)
|
|
|
|
|
2019-06-27 14:52:04 +02:00
|
|
|
|
2019-07-30 07:57:29 +02:00
|
|
|
## Before Installing
|
|
|
|
|
2020-04-07 22:08:29 +02:00
|
|
|
Install the [`lbry-sdk`](https://github.com/lbryio/lbry-sdk)
|
2019-07-30 07:57:29 +02:00
|
|
|
in order to validate & properly delete comments.
|
|
|
|
|
|
|
|
|
2020-04-07 22:08:29 +02:00
|
|
|
|
2019-06-06 10:23:08 +02:00
|
|
|
## Installation
|
2019-05-21 13:54:52 +02:00
|
|
|
|
2019-07-30 07:57:29 +02:00
|
|
|
#### Installing the server:
|
2019-05-21 14:13:34 +02:00
|
|
|
```bash
|
2019-06-06 10:23:08 +02:00
|
|
|
|
2020-04-07 22:08:29 +02:00
|
|
|
$ git clone https://github.com/lbryio/comment-server
|
2019-06-06 10:23:08 +02:00
|
|
|
$ cd comment-server
|
2019-05-21 14:13:34 +02:00
|
|
|
|
2019-06-06 10:23:08 +02:00
|
|
|
# create a virtual environment
|
2020-04-07 22:08:29 +02:00
|
|
|
$ virtualenv --python=python3.8 venv
|
2019-05-21 14:13:34 +02:00
|
|
|
|
2019-06-06 10:23:08 +02:00
|
|
|
# Enter the virtual environment
|
|
|
|
$ source venv/bin/activate
|
|
|
|
|
2020-04-07 22:08:29 +02:00
|
|
|
# Install required dependencies
|
|
|
|
(venv) $ pip install -e .
|
|
|
|
|
|
|
|
# Run the server
|
|
|
|
(venv) $ python src/main.py \
|
|
|
|
--port=5921 \ # use a different port besides the default
|
|
|
|
--config=conf.yml \ # provide a custom config file
|
|
|
|
& \ # detach and run the service in the background
|
2019-07-30 07:57:29 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
### Installing the systemd Service Monitor
|
|
|
|
|
|
|
|
As a super-user, copy the .service and .target files to the systemd directory:
|
|
|
|
```bash
|
2020-01-03 21:42:07 +01:00
|
|
|
$ sudo cp config/comment-server* /etc/systemd/system
|
2019-05-21 14:13:34 +02:00
|
|
|
```
|
2019-07-30 07:57:29 +02:00
|
|
|
Then `$ sudo systemctl daemon-reload` to refresh the systemd service files.
|
|
|
|
|
|
|
|
|
2019-05-21 14:13:34 +02:00
|
|
|
|
2019-06-06 10:23:08 +02:00
|
|
|
## Usage
|
2019-06-27 14:52:04 +02:00
|
|
|
|
|
|
|
### Running the Server
|
2019-06-11 17:22:32 +02:00
|
|
|
To start the server, simply run:
|
2019-06-06 10:23:08 +02:00
|
|
|
```bash
|
2019-07-30 07:57:29 +02:00
|
|
|
$ sudo systemctl start comment-server.target
|
|
|
|
```
|
2019-06-11 17:22:32 +02:00
|
|
|
|
2019-07-30 07:57:29 +02:00
|
|
|
(Optional) Enable the server to run on booting:
|
|
|
|
```bash
|
|
|
|
$ sudo systemctl enable --now comment-server.target
|
2019-06-06 10:23:08 +02:00
|
|
|
```
|
2019-05-21 14:13:34 +02:00
|
|
|
|
2019-07-30 07:57:29 +02:00
|
|
|
|
2019-06-27 14:52:04 +02:00
|
|
|
### Testing
|
|
|
|
|
|
|
|
To Test the database, simply run:
|
|
|
|
```bash
|
|
|
|
# To run the whole thing :
|
|
|
|
(venv) $ python -m unittest tests.database
|
|
|
|
|
|
|
|
# To run a specific TestName under a specified TestClass:
|
|
|
|
(venv) $ python -m unittest tests.database.TestClass.TestName`
|
|
|
|
```
|
|
|
|
|
|
|
|
There are basic tests to run against the server, though they require
|
|
|
|
that there is a server instance running, though the database
|
2020-04-07 22:08:29 +02:00
|
|
|
chosen may have to be edited in `config/conf.yml`.
|
2019-06-27 14:52:04 +02:00
|
|
|
|
|
|
|
Additionally there are HTTP requests that can be send with whatever
|
|
|
|
software you choose to test the integrity of the comment server.
|
|
|
|
|
2019-05-21 14:13:34 +02:00
|
|
|
|
2019-06-27 14:52:04 +02:00
|
|
|
## Contributing
|
|
|
|
Contributions are welcome, verbosity is encouraged. Please be considerate
|
|
|
|
in your posts, and make sure that you give as much context to the issue
|
|
|
|
as possible, so that helping you is a slam dunk for us.
|
|
|
|
|
|
|
|
### Issues
|
|
|
|
If you spotted an issue from the SDK side, please replicate it using
|
|
|
|
`curl` and one of the HTTP request templates in `tests/http_requests`.
|
|
|
|
|
|
|
|
Then, just include that along with the rest of your information.
|
|
|
|
|
|
|
|
### Pull Requests
|
|
|
|
Make sure the code works and has been tested beforehand.
|
|
|
|
Although we love helping out, our job is to review your code,
|
|
|
|
not test it - that's what your computer is for.
|
|
|
|
|
|
|
|
|
|
|
|
Try to document the changes you made in a human language,
|
|
|
|
preferably English. (but we're always up for a challenge...)
|
|
|
|
Use the level of verbosity you feel is correct, and when in doubt,
|
|
|
|
just [KISS](https://people.apache.org/~fhanik/kiss.html).
|
|
|
|
|
|
|
|
### General
|
|
|
|
|
|
|
|
For more details, please refer to [lbry.tech/contribute](https://lbry.tech/contribute).
|
|
|
|
|
|
|
|
|
|
|
|
## License
|
|
|
|
This project is licensed by AGPLv3.
|
2019-10-08 22:38:03 +02:00
|
|
|
See [LICENSE](LICENSE.md) for the full license.
|
2019-06-27 14:52:04 +02:00
|
|
|
|
|
|
|
## Security
|
|
|
|
We take security seriously.
|
|
|
|
Please contact [security@lbry.io](security@lbry.io) regarding any conerns you might have,
|
|
|
|
issues you might encounter, or general outlooks on life. Our PGP key can
|
|
|
|
be found [here](https://keybase.io/lbry/key.asc), should you need it.
|
|
|
|
|
|
|
|
## Contact Us
|
|
|
|
The primary contact for this project is
|
|
|
|
[@osilkin98](https://github.com/osilkin98), and can be reached
|
|
|
|
at (o.silkin98@gmail.com).
|
2019-05-21 13:54:52 +02:00
|
|
|
|
|
|
|
|