mirror of https://gitlab.com/litecord/litecord.git
Restructure README.md
This commit is contained in:
parent
636dec5dde
commit
000cf6a945
97
README.md
97
README.md
|
|
@ -1,72 +1,97 @@
|
||||||

|

|
||||||
|
|
||||||
Litecord is an open source implementation of Discord's backend and API in
|
Litecord is an open source implementation of Discord's HTTP API and Gateway in
|
||||||
Python.
|
Python 3.
|
||||||
|
|
||||||
This project is a rewrite of [litecord-reference].
|
This project is a rewrite of [litecord-reference].
|
||||||
|
|
||||||
[litecord-reference]: https://gitlab.com/luna/litecord-reference
|
[litecord-reference]: https://gitlab.com/luna/litecord-reference
|
||||||
|
|
||||||
## Notes
|
## Caveats
|
||||||
|
|
||||||
- Unit testing isn't completly perfect.
|
- Unit testing is incomplete.
|
||||||
- No voice is planned to be developed, for now.
|
- Currently, are no plans to support voice chat.
|
||||||
- You must figure out connecting to the server yourself. Litecord will not distribute
|
- You must figure out how to connect to a Litecord instance. Litecord will not
|
||||||
Discord's official client code nor provide ways to modify the client.
|
distribute official client code from Discord nor provide ways to modify the
|
||||||
|
official client.
|
||||||
|
|
||||||
## Install
|
## Installation
|
||||||
|
|
||||||
Requirements:
|
Requirements:
|
||||||
- Python 3.7 or higher
|
|
||||||
- PostgreSQL
|
- **Python 3.7+**
|
||||||
- gifsicle for GIF emoji and avatar handling.
|
- PostgreSQL (tested using 9.6+)
|
||||||
- [Pipenv]
|
- gifsicle for GIF emoji and avatar handling
|
||||||
|
- [pipenv]
|
||||||
|
|
||||||
[pipenv]: https://github.com/pypa/pipenv
|
[pipenv]: https://github.com/pypa/pipenv
|
||||||
|
|
||||||
|
### Download the code
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ git clone https://gitlab.com/luna/litecord.git && cd litecord
|
$ git clone https://gitlab.com/litecord/litecord.git && cd litecord
|
||||||
|
```
|
||||||
|
|
||||||
# Setup the database:
|
### Setting up the database
|
||||||
# don't forget that you can create a specific
|
|
||||||
# postgres user just for the litecord database
|
It's recommended to create a separate user for the `litecord` database.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
# Create the PostgreSQL database.
|
||||||
$ createdb litecord
|
$ createdb litecord
|
||||||
|
|
||||||
|
# Apply the base schema to the database.
|
||||||
$ psql -f schema.sql litecord
|
$ psql -f schema.sql litecord
|
||||||
|
```
|
||||||
|
|
||||||
# Configure litecord:
|
Then, you should run database migrations:
|
||||||
# edit config.py as you wish
|
|
||||||
$ cp config.example.py config.py
|
|
||||||
|
|
||||||
# run database migrations (this is a
|
```sh
|
||||||
# required step in setup)
|
|
||||||
$ pipenv run ./manage.py migrate
|
$ pipenv run ./manage.py migrate
|
||||||
|
```
|
||||||
|
|
||||||
# Install all packages:
|
### Configuring
|
||||||
|
|
||||||
|
Copy the `config.example.py` file and edit it to configure your instance:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ cp config.example.py config.py
|
||||||
|
$ $EDITOR config.py
|
||||||
|
```
|
||||||
|
|
||||||
|
### Install packages
|
||||||
|
|
||||||
|
```sh
|
||||||
$ pipenv install --dev
|
$ pipenv install --dev
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
Hypercorn is used to run litecord. By default, it will bind to `0.0.0.0:5000`.
|
Hypercorn is used to run Litecord. By default, it will bind to `0.0.0.0:5000`.
|
||||||
You can use the `-b` option to change it (e.g. `-b 0.0.0.0:45000`).
|
This will expose your Litecord instance to the world. You can use the `-b`
|
||||||
|
option to change it (e.g. `-b 0.0.0.0:45000`).
|
||||||
Use `--access-log -` to output access logs to stdout.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ pipenv run hypercorn run:app
|
$ pipenv run hypercorn run:app
|
||||||
```
|
```
|
||||||
|
|
||||||
*It is recommended to run litecord behind NGINX.* Because of that,
|
You can use `--access-log -` to output access logs to stdout.
|
||||||
there is a basic `nginx.conf` file at the root.
|
|
||||||
|
|
||||||
### Checking if it is working
|
**It is recommended to run litecord behind [NGINX].** You can use the
|
||||||
|
`nginx.conf` file at the root of the repository as a template.
|
||||||
|
|
||||||
You can check if your instance is running by checking the `/api/v6/gateway`
|
[nginx]: https://www.nginx.com
|
||||||
path. For basic websocket testing a tool such as
|
|
||||||
|
### Does it work?
|
||||||
|
|
||||||
|
You can check if your instance is running by performing a HTTP `GET` request on
|
||||||
|
the `/api/v6/gateway` endpoint. For basic websocket testing, a tool such as
|
||||||
[ws](https://github.com/hashrocket/ws) can be used.
|
[ws](https://github.com/hashrocket/ws) can be used.
|
||||||
|
|
||||||
## Updating
|
## Updating
|
||||||
|
|
||||||
|
Update the code and run any new database migrations:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
$ git pull
|
$ git pull
|
||||||
$ pipenv run ./manage.py migrate
|
$ pipenv run ./manage.py migrate
|
||||||
|
|
@ -74,16 +99,16 @@ $ pipenv run ./manage.py migrate
|
||||||
|
|
||||||
## Running tests
|
## Running tests
|
||||||
|
|
||||||
To run tests we must create users that we know the passwords of.
|
Running tests involves creating dummy users with known passwords. Because of
|
||||||
Because of that, **never setup a testing environment in production.**
|
this, you should never setup a testing environment in production.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# setup the testing users
|
# Setup any testing users:
|
||||||
$ pipenv run ./manage.py setup_tests
|
$ pipenv run ./manage.py setup_tests
|
||||||
|
|
||||||
# make sure you have tox installed
|
# Install tox:
|
||||||
$ pip install tox
|
$ pip install tox
|
||||||
|
|
||||||
# run basic linter and tests
|
# Run lints and tests:
|
||||||
$ tox
|
$ tox
|
||||||
```
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue