mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 12:43:12 +03:00
Написал докуметацию
This commit is contained in:
parent
684ccdef3e
commit
840499154d
9 changed files with 325 additions and 1 deletions
66
docs/getting-started/contributing.md
Normal file
66
docs/getting-started/contributing.md
Normal file
|
@ -0,0 +1,66 @@
|
|||
If you have any questions, you can write to the [mail](mailto:redddume@gmail.com) or [Telegram](https://t.me/Redddume)
|
||||
|
||||
### Fork and clone your repository
|
||||
1. Fork the repository ([click here to fork now](https://github.com/Redume/Kekkai/fork))
|
||||
2. Clone your forked code
|
||||
```bash
|
||||
git clone https://github.com/<nickname>/Kekkai.git
|
||||
```
|
||||
3. Create new branch
|
||||
```bash
|
||||
git branch <name_new_branch>
|
||||
```
|
||||
4. Switch to new branch
|
||||
```bash
|
||||
git checkout <name_new_branch>
|
||||
```
|
||||
5. Push your commits
|
||||
6. Submit a new Pull Request
|
||||
|
||||
### Testing
|
||||
|
||||
|
||||
### Code Style
|
||||
[`Pylint`][pylint], [`mypy`][mypy], [`eslint`][eslint] and [`prettier`][prettier] are used as code syntax checks
|
||||
|
||||
#### Checking the Node.JS code
|
||||
|
||||
To check the code, you must first download the necessary libraries, which are located at the root of the project
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
`eslint` and `prettier` is used to check and automatically correct the Node.JS code
|
||||
```bash
|
||||
npm eslint .
|
||||
```
|
||||
|
||||
#### Checking the Python code
|
||||
To check code, you need to install libraries `mypy` and `pylint`
|
||||
|
||||
```bash
|
||||
python3 -m pip install -U mypy
|
||||
```
|
||||
|
||||
and install `pylint`
|
||||
```bash
|
||||
pip install pylint
|
||||
```
|
||||
Start check the code
|
||||
|
||||
for `pylint`:
|
||||
```bash
|
||||
pylint /chart/
|
||||
```
|
||||
|
||||
and for `mypy`:
|
||||
```bash
|
||||
mypy /chart/
|
||||
```
|
||||
|
||||
|
||||
|
||||
[pylint]: https://github.com/pylint-dev/pylint
|
||||
[mypy]: https://github.com/python/mypy
|
||||
[eslint]: https://github.com/eslint/eslint
|
||||
[prettier]: https://github.com/prettier/prettier
|
76
docs/getting-started/docker.md
Normal file
76
docs/getting-started/docker.md
Normal file
|
@ -0,0 +1,76 @@
|
|||
Docker Compose is the recommended method to run Kekkai in production. Below are the steps to deploy Kekkai with Docker Compose.
|
||||
|
||||
Kekkai requires Docker Compose version 2.x.
|
||||
|
||||
### Steps 1 - Preparing files
|
||||
```shell
|
||||
git clone https://github.com/Redume/Kekkai.git
|
||||
```
|
||||
|
||||
```shell
|
||||
cd Kekkai
|
||||
```
|
||||
|
||||
|
||||
### Steps 2 - Change config files
|
||||
??? note "Nginx Configuration"
|
||||
In `nginx.conf`, you need to specify your domain or ipv4 address
|
||||
```
|
||||
...
|
||||
listen 443 ssl;
|
||||
server_name localhost; # Your domain
|
||||
...
|
||||
```
|
||||
|
||||
To set up SSL
|
||||
```bash
|
||||
mkdir CertSLL
|
||||
```
|
||||
|
||||
After that, copy the SSL certificates to the `CertSSL` folder, if the names are different,
|
||||
then change either the name of the certificates or in `nginx.conf`
|
||||
|
||||
```
|
||||
ssl_certificate /etc/nginx/ssl/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
|
||||
```
|
||||
|
||||
??? note "The main config is `config_sample.yaml` for Kekkai"
|
||||
```yaml
|
||||
database:
|
||||
user: 'DATABASE_USERNAME'
|
||||
password: 'DATABASE_PASSWORD'
|
||||
host: 'DATABASE_HOST'
|
||||
name: 'DATABASE_NAME'
|
||||
port: 5432
|
||||
...
|
||||
```
|
||||
|
||||
Fill in the data in the `database` item, as well as in the `.env` config
|
||||
|
||||
|
||||
??? note "`.env-sample` config for PostgreSQL"
|
||||
```.env
|
||||
# Connection secret for postgres. You should change it to a random password
|
||||
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
|
||||
|
||||
POSTGRES_PASSWORD=my_password
|
||||
|
||||
# If you do not know what you are doing, then you should not edit the values below
|
||||
###################################################################################
|
||||
POSTGRES_DB=kekkai
|
||||
DB_HOST=postgres
|
||||
POSTGRES_USER=postgres
|
||||
```
|
||||
|
||||
- Populate custom database information if necessary.
|
||||
- Consider changing `DB_PASSWORD` to a custom value. Postgres is not publically exposed, so this password is only used for - local authentication. To avoid issues with Docker parsing this value, it is best to use only the characters `A-Za-z0-9`.
|
||||
|
||||
!!! note
|
||||
After editing, rename the config files by removing `sample` in the name
|
||||
|
||||
|
||||
### Steps 3 - Start the containers
|
||||
```shell title='Start the containers using docker compose command'
|
||||
docker compose -f "docker-compose.yaml" up -d --build
|
||||
```
|
72
docs/getting-started/manual.md
Normal file
72
docs/getting-started/manual.md
Normal file
|
@ -0,0 +1,72 @@
|
|||
For full use, you need to install `Node.JS v20`, `PostgreSQL v15`, `Python v13.3`, `Nginx`
|
||||
|
||||
### Steps 1 - Preparing files
|
||||
|
||||
```shell
|
||||
git clone https://github.com/Redume/Kekkai.git
|
||||
```
|
||||
|
||||
```shell
|
||||
cd Kekkai
|
||||
```
|
||||
|
||||
### Steps 2 - Change config files
|
||||
|
||||
??? note "Nginx Configuration"
|
||||
In `nginx.conf`, you need to specify your domain or ipv4 address
|
||||
```nginx
|
||||
...
|
||||
listen 443 ssl;
|
||||
server_name localhost; # Your domain
|
||||
...
|
||||
```
|
||||
|
||||
??? note "The main config is `config_sample.yaml` for Kekkai"
|
||||
```yaml
|
||||
database:
|
||||
user: 'DATABASE_USERNAME'
|
||||
password: 'DATABASE_PASSWORD'
|
||||
host: 'DATABASE_HOST'
|
||||
name: 'DATABASE_NAME'
|
||||
port: 5432
|
||||
...
|
||||
```
|
||||
|
||||
Fill in the data in the `database` item, as well as in the `.env` config
|
||||
|
||||
### Steps 3 - Install libs
|
||||
|
||||
Install library. In `/shared/logger`, `/shared/config`, `/shared/database`, `/collect-currency`,` /server`,
|
||||
the required node.JS libraries In each of the directories, you need to write this command
|
||||
|
||||
```shell
|
||||
npm install
|
||||
```
|
||||
|
||||
and install python libs
|
||||
```shell
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
Start the nginx service
|
||||
```shell
|
||||
sudo systemctl start nginx.service
|
||||
```
|
||||
|
||||
### Steps 4 - Launch Services
|
||||
|
||||
Launch each of the services
|
||||
There are all three services `MainService`, `Collect-currency`, `Chart`
|
||||
|
||||
- `MainService` is an API for getting the exchange rate
|
||||
```shell
|
||||
cd server & node .
|
||||
```
|
||||
- `Collect-Currency` is a service for collecting and save the rate in a database
|
||||
```shell
|
||||
cd collect-currency/src/ && node .
|
||||
```
|
||||
- `ChartService` is a service for creating currency rate charts
|
||||
```shell
|
||||
python3 main.py
|
||||
```
|
Loading…
Add table
Reference in a new issue