Merge pull request #5 from Redume/docs/migrate-to-starlight
Some checks are pending
Create and publish a Docker image / detect what files changed (push) Waiting to run
Create and publish a Docker image / build-and-push-server (push) Blocked by required conditions
Create and publish a Docker image / build-and-push-chart (push) Blocked by required conditions
Create and publish a Docker image / build-and-push-CR (push) Blocked by required conditions
Create and publish a Docker image / build-and-push-web (push) Blocked by required conditions

Docs/migrate to starlight
This commit is contained in:
Данил 2025-03-01 22:34:38 +03:00 committed by GitHub
commit fc97f39011
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 7970 additions and 831 deletions

View file

@ -1,51 +0,0 @@
name: Deploy docs
on:
push:
branches:
- master
- main
permissions:
contents: write
jobs:
changes:
name: detect what files changed
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
docs: ${{ steps.filter.outputs.docs }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
docs:
- 'docs/**'
- 'mkdocs.yml'
deploy:
needs: changes
if: ${{ needs.changes.outputs.docs == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force

View file

@ -47,4 +47,4 @@
- [eslint/eslint](https://github.com/eslint/eslint) — [MIT](https://github.com/eslint/eslint/blob/main/LICENSE) - [eslint/eslint](https://github.com/eslint/eslint) — [MIT](https://github.com/eslint/eslint/blob/main/LICENSE)
- [prettier/prettier](https://github.com/prettier/prettier) — [MIT](https://github.com/prettier/prettier/blob/main/LICENSE) - [prettier/prettier](https://github.com/prettier/prettier) — [MIT](https://github.com/prettier/prettier/blob/main/LICENSE)
- [squidfunk/mkdocs-material](https://github.com/squidfunk/mkdocs-material?tab=MIT-1-ov-file) — [MIT](https://github.com/squidfunk/mkdocs-material/blob/master/LICENSE) - [withastro/starlight](https://github.com/withastro/starlight) - [MIT](https://github.com/withastro/starlight/blob/main/LICENSE)

View file

@ -8,10 +8,12 @@ services:
- ./nginx/:/etc/nginx/ - ./nginx/:/etc/nginx/
- ./CertSSL:/etc/nginx/ssl - ./CertSSL:/etc/nginx/ssl
- ./assets/logo.png:/etc/nginx/assets/logo.png - ./assets/logo.png:/etc/nginx/assets/logo.png
- ./docs/dist:/etc/nginx/dist
depends_on: depends_on:
- server - server
- chart - chart
- web - web
- docs
server: server:
build: build:
@ -50,6 +52,11 @@ services:
- './CertSSL:/CertSSL' - './CertSSL:/CertSSL'
- './config.yaml:/config.yaml' - './config.yaml:/config.yaml'
docs:
build:
context: ./docs
dockerfile: Dockerfile
collect-currency: collect-currency:
build: build:
context: ./ context: ./

21
docs/.gitignore vendored Normal file
View file

@ -0,0 +1,21 @@
# build output
dist/
# generated types
.astro/
# dependencies
node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# environment variables
.env
.env.production
# macOS-specific files
.DS_Store

9
docs/Dockerfile Normal file
View file

@ -0,0 +1,9 @@
FROM node:20-alpine
WORKDIR /
COPY ./package*.json .
RUN npm install
CMD ["npm", "run", "build"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

66
docs/astro.config.mjs Normal file
View file

@ -0,0 +1,66 @@
// @ts-check
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
// https://astro.build/config
export default defineConfig({
integrations: [
starlight({
title: 'Kekkai',
social: { github: 'https://github.com/redume/kekkai' },
editLink: { baseUrl: 'https://github.com/redume/kekkai/edit/main/docs/' },
sidebar: [
{
label: 'Getting started',
items: [
{
label: 'Docker',
slug: 'docs/getting-started/docker',
badge: 'recommended',
},
{
label: 'Contributing', slug: 'docs/getting-started/contributing'
},
],
},
{
label: 'Endpoints',
items: [
{
label: 'Endpoints list', slug: 'docs/endpoints/endpoints-list'
},
{
label: 'Get currency rate - /api/getRate',
slug: 'docs/endpoints/getrate'
},
{
label: 'Create charts - /api/getChart',
slug: 'docs/endpoints/create-chart'
},
{
label: 'Get metadata - /api/metadata',
slug: 'docs/endpoints/metadata'
}
],
},
{
label: 'Config',
items: [
{
label: 'Configure .env',
slug: 'docs/config/config-env'
},
{
label: 'Configure config.yaml',
slug: 'docs/config/config-yaml'
},
{
label: 'Configure Nginx',
slug: 'docs/config/config-nginx'
}
],
},
],
}),
],
});

View file

@ -1,24 +0,0 @@
Kekkai can be configured using the `.env` file in the working directory. `.env.example`.
`.env` config is used to configure PosgreSQL running in Docker Compose.
!!! info
If you are not using Docker Compose, you do not need to edit this config
??? note "Example file `.env.example`"
```
# 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
```
This config only edits the password for PosgreSQL.
Please use only the characters `A-Za-z0-9`, without special characters or spaces

View file

@ -1,132 +0,0 @@
Kekkai can be configured using the `config.yaml` file in the working directory. `config.example.yaml`.
??? "Example file `config.example.yaml`"
```
# For more information, see the documentation
# https://kekkai-docs.redume.su/
database:
user: 'DATABASE_USERNAME'
password: 'DATABASE_PASSWORD'
host: 'DATABASE_HOST'
name: 'DATABASE_NAME'
port: 5432
server:
host: '0.0.0.0'
ssl:
private_key: '/CertSSL/privkey.pem'
cert: '/CertSSL/fullchain.pem'
work: true
log:
print: true
level: 'info'
analytics:
plausible_api: 'https://plausible.io/api/event/'
plausible_domain: 'PLAUSIBLE_DOMAIN'
plausible_token: 'PLAUSIBLE_TOKEN'
work: true
currency:
chart:
save: false
collecting:
fiat: true
schedule: '30 8 * * *'
fiat:
- USD
- RUB
- EUR
- UAH
- TRY
- KZT
```
## Database
Kekkai is used as a `PostgreSQL` database.
!!! info
If you installed Kekkai via Docker Compose, then install it in the `database.host` value of `postgres`.
The rest of the data does not have to be filled in. They need to be filled in `.env`.
What should it look like:
```yaml
database:
...
host: 'postgres'
...
...
```
## Server
!!! info
If you installed Kekkai via Docker Compose, then changing `server.host`, `server.ssl` is not recommended.
### SSL
Create a folder CertSSL to store your certificates
```shell
mkdir CertSSL
```
Copy your certificates to the CertSSL folder.
It is recommended to rename the certificates to `privkey.pem` and `fullchain.pem`.
If this is not possible, you need to change the SSL name in `nginx.conf` (if using Docker Compose)
## Analytics
Kekkai uses [`Plausbile`](https://plausible.io/) as an analyst. Minimal data is transferred for anilithics.
Such as: browser, OS, status code, url, where the user came from.
Most of the data is built on User Agent. It is possible to disable analytics in Kekkai.
??? note
```yaml
...
analytics:
plausible_api: 'https://plausible.io/api/event/'
plausible_domain: 'PLAUSIBLE_DOMAIN'
plausible_token: 'PLAUSIBLE_TOKEN'
work: true
...
```
- `plausible_api`: This is where the Plausible instance is specified.
The official instance is specified by default.
- `plausible_domain`: Kekkai Instance Domain.
It should be added to Plausible first, and then to the config. You can add the domain [here](https://plausible.io/sites/new?flow=provisioning).
- `plausible_token`: Api token for authorization and sending requests. You can create it [here](https://plausible.io/settings/api-keys).
- `work`: Enable or disable analytics.
## Currency
`DuckDuckGo` (fiat currency collection) and `CoinMarketCap` (cryptocurrency collection)
are used to collect currency rates.
??? note
```yaml
...
currency:
chart:
save: false # Enable or disable saving graphs to an image (Boolean)
collecting:
fiat: true # Turn off or turn on the collection of the fiat currency rate [Boolean]
crypto: false
schedule: '30 8 * * *' # Currency collection schedule in crontab format [String]
crypto_apikey: 'APIKEY'
fiat: # List of fiat currency to save the exchange rate [Array]
- USD
- RUB
- EUR
- UAH
- TRY
- KZT
crypto:
- ETH
- TON
- USDT
```
- `currency.chart.save`: Enable or disable saving graphs.
- `currency.collecting`: Enable or disable cryptocurrency or fiat currency exchange rate collection.
- `currency.schedule`: Currency collection interval (Configurable via cron.
It is recommended to use [crontab.guru](https://crontab.guru), not supported in `Non-standard format`, like `@daily`).
- `crypto.crypto_apiKey`: API-key from CoinMarketCap service
- `currency.fiat`: A list of fiat currencies that will be saved to the database.
- `currency.crypto`: A list of crypto currencies that will be saved to the database.

View file

@ -1,140 +0,0 @@
Creating a currency rate chart.
## Creating a graph for a certain period
### Request
=== "Shell"
=== "Curl"
```bash
curl --request GET \
--url https://kekkai-api.redume.su/api/getChart/week?from_currency=RUB&conv_currency=USD
```
=== "Python"
=== "Request"
```python
import requests
res = requests.get('https://kekkai-api.redume.su/api/getChart/week', {
'from_currency': 'USD',
'conv_currency': 'RUB',
}, timeout=3)
print(res.json())
```
=== "Node.JS"
=== "Axios"
```js
const axios = require('axios');
axios.get('https://kekkai-api.redume.su/api/getChart/week', {
timeout: 3000,
'from_currency': 'USD',
'conv_currency': 'RUB',
})
.then((res) => {
console.log(res['data']);
})
.catch((err) => {
console.error(err);
});
```
### Query params
| Parameter | Description |
|-------------------|-------------------------------------------------------------------------|
| `from_currency`* | `ISO 4217` code of the currency from which the conversion takes place |
| `conv_currency`* | `ISO 4217` code of the currency to which the conversion is performed |
### URL params
| Parameter | Description |
|---------------|-------------------------------------------------------------------------|
| `period` | Available parameters: `week`, `month`, `quarter`, `year` |
`*` - Required arguments
### Response
!!! info "Output"
```json
{
"status": 201,
"message": "http://kekkai-api.redume.su/static/charts/RUB_USD_20241108_DQVDN7.png"
}
```
## Creating a schedule for specific days
### Request
=== "Shell"
=== "Curl"
```bash
curl --request GET \
--url https://kekkai-api.redume.su/api/getChart/?
from_currency=RUB&
conv_currency=USD&
start_date=2024-10-31&
end_date=2024-11-08
```
=== "Python"
=== "Request"
```python
import requests
res = requests.get('https://kekkai-api.redume.su/api/getChart/', {
'from_currency': 'USD',
'conv_currency': 'RUB',
'start_date': '2024-10-31',
'end_date': '2024-11-08'
}, timeout=3)
print(res.json())
```
=== "Node.JS"
=== "Axios"
```js
const axios = require('axios');
axios.get('https://kekkai-api.redume.su/api/getChart/', {
timeout: 3000,
'from_currency': 'USD',
'conv_currency': 'RUB',
'start_date': '2024-10-31',
'end_date': '2024-11-08'
})
.then((res) => {
console.log(res['data']);
})
.catch((err) => {
console.error(err);
});
```
### Query params
| Parameter | Description |
|------------------|------------------------------------------------------------------------|
| `from_currency`* | `ISO 4217` code of the currency from which the conversion takes place |
| `conv_currency`* | `ISO 4217` code of the currency to which the conversion is performed |
| `start_date`* | Start date of the period in the format `YYYYY-DD-MM` |
| `end_date`* | Period end date in the format `YYYYY-DD-MM` |
`*` - Required arguments
### Response
!!! info "Output"
```json
{
"status": 400,
"message": "http://kekkai-api.redume.su/static/charts/RUB_USD_20241108_1T2RI3.png"
}
```
## What the name of the chart file consists of
Example: ``.../RUB_USD_20241108_DQVDN7.png``
- `RUB_USD` - Name of currencies.
- `20241108` - Schedule request date in `YYYMMDD` format.
- `DQVDN7` - Random file character identifier.
All charts are in the charts folder, which is in the root directory (`./kekkai/chart`)

View file

@ -1,164 +0,0 @@
Currencies are identified by standard three-letter `ISO 4217` currency codes.
## Getting the currency rate for a certain day.
### Request
=== "Shell"
=== "Curl"
```bash
curl --request GET \
--url https://kekkai-api.redume.su/api/getRate/?from_currency=RUB&conv_currency=USD&date=2024-10-16
```
=== "Python"
=== "Requests"
```py
import requests
res = requests.get('https://kekkai-api.redume.su/api/getRate/', {
'from_currency': 'RUB',
'conv_currency': 'USD',
'date': '2024-10-16',
}, timeout=3)
print(res.json())
```
=== "Node.JS"
=== "Axios"
```js
const axios = require('axios');
axios.get('https://kekkai-api.redume.su/api/getRate/', {
timeout: 3000,
'from_currency': 'RUB',
'conv_currency': 'USD',
'date': '2024-10-16',
}
)
.then((res) => {
console.log(JSON.stringify(res.json()));
})
.catch((err) => {
console.error(err);
});
```
### Query Parameters
| Parameter | Description |
|-------------------|------------------------------------------------------------------------|
| `from_currency`* | `ISO 4217` code of the currency from which the conversion takes place |
| `conv_currency`* | `ISO 4217` code of the currency to which the conversion is performed |
| `date`* | Currency rate date in the format `YYYYY-DD-MM` |
| `conv_amount` | Multiplier for number conversion (Optional) |
`*` - Required arguments
### Response
!!! info "Output"
```json
[
{
"from_currency": "RUB",
"conv_currency": "USD",
"rate": 0.01,
"date": "2024-10-17T00:00:00.000Z"
}
]
```
## Get currency exchange rate for a certain period
Getting the list of the array with currency rate for a certain period of time.
### Request
=== "Shell"
=== "Curl"
```bash
curl --request GET \
--url https://kekkai-api.redume.su/api/getRate/?from_currency=RUB&conv_currency=USD&start_date=2024-10-16&end_date=2024-10-20
```
=== "Python"
=== "Requests"
```py
import requests
res = requests.get('https://kekkai-api.redume.su/api/getRate/', {
'from_currency': 'RUB',
'conv_currency': 'USD',
'start_date': '2024-10-16',
'end_date': '2024-10-20',
}, timeout=3)
print(res.json())
```
=== "Node.JS"
=== "Axios"
```js
const axios = require('axios');
axios.get('https://kekkai-api.redume.su/api/getRate/', {
timeout: 3000,
'from_currency': 'RUB',
'conv_currency': 'USD',
'start_date': '2024-10-16',
'end_date': '2024-10-20',
}
)
.then((res) => {
console.log(res['data']);
})
.catch((err) => {
console.error(err);
});
```
### Query params
| Parameter | Description |
|------------------|-------------------------------------------------------------------------|
| `from_currency`* | `ISO 4217` code of the currency from which the conversion takes place |
| `conv_currency`* | `ISO 4217` code of the currency to which the conversion is performed |
| `start_date`* | Start date of the period in the format `YYYYY-DD-MM` |
| `end_date`* | Period end date in the format `YYYYY-DD-MM` |
`*` - Required arguments
### Response
!!! info "Output"
```json
[
{
"from_currency": "RUB",
"conv_currency": "USD",
"rate": 0.01,
"date": "2024-10-17T00:00:00.000Z"
},
{
"from_currency": "RUB",
"conv_currency": "USD",
"rate": 0.01,
"date": "2024-10-18T00:00:00.000Z"
},
{
"from_currency": "RUB",
"conv_currency": "USD",
"rate": 0.01,
"date": "2024-10-19T00:00:00.000Z"
},
{
"from_currency": "RUB",
"conv_currency": "USD",
"rate": 0.01,
"date": "2024-10-20T00:00:00.000Z"
},
{
"from_currency": "RUB",
"conv_currency": "USD",
"rate": 0.01,
"date": "2024-10-21T00:00:00.000Z"
}
]
```

View file

@ -1,60 +0,0 @@
Currencies are identified by standard three-letter `ISO 4217` currency codes.
## Get data on available dates and currencies.
### Request
=== "Shell"
=== "Curl"
```bash
curl --request GET \
--url https://kekkai-api.redume.su/api/metadata/
```
=== "Python"
=== "Requests"
```py
import requests
res = requests.get('https://kekkai-api.redume.su/api/metadata/', timeout=3)
print(res.json())
```
=== "Node.JS"
=== "Axios"
```js
const axios = require('axios');
axios.get('https://kekkai-api.redume.su/api/metadata/')
.then((res) => {
console.log(JSON.stringify(res.json()));
})
.catch((err) => {
console.error(err);
});
```
### Response
!!! info "Output"
```json
{
"first_date": "2024-11-26T21:00:00.000Z",
"last_date": "2025-01-01T21:00:00.000Z",
"currencies": {
"crypto": [
"USDT",
"TON",
"BTC",
"ETH"
],
"fiat": [
"USD",
"RUB",
"EUR",
"UAH",
"TRY",
"KZT"
]
}
}
```

View file

@ -1,79 +0,0 @@
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
```

View file

@ -1,72 +0,0 @@
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
```

6933
docs/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

17
docs/package.json Normal file
View file

@ -0,0 +1,17 @@
{
"name": "docs",
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
"build": "astro build",
"preview": "astro preview",
"astro": "astro"
},
"dependencies": {
"@astrojs/starlight": "^0.32.1",
"astro": "^5.1.5",
"sharp": "^0.32.5"
}
}

36
docs/public/favicon.svg Normal file
View file

@ -0,0 +1,36 @@
<svg width="157" height="122" viewBox="0 0 157 122" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_d_179_28)">
<path d="M54.8999 97V7.39999H79.7319V43.752L110.58 7.39999H140.02L106.1 45.928L141.172 97H111.348L88.8199 63.72L79.7319 73.832V97H54.8999Z" fill="#297BCD"/>
</g>
<g opacity="0.7" filter="url(#filter1_dd_179_28)">
<path d="M38.76 109.905V97.1055C25.6187 95.7401 14.0987 91.5161 4.2 84.4334L15.72 67.4094C23.912 73.1268 31.848 76.6254 39.528 77.9054V62.5454C28.776 60.0708 20.8827 56.7428 15.848 52.5614C10.8987 48.3801 8.424 42.4068 8.424 34.6414C8.424 26.9614 11.112 20.7321 16.488 15.9534C21.864 11.0894 29.3733 8.31611 39.016 7.63345V0.337448L52.328 0.337448V8.01745C62.1413 9.12678 71.144 12.4548 79.336 18.0014L68.84 35.1534C63.8053 31.5694 58.088 29.0095 51.688 27.4734V42.3214C62.2693 44.7961 69.992 48.1668 74.856 52.4334C79.8053 56.7001 82.28 62.7161 82.28 70.4814C82.28 78.1614 79.5493 84.3481 74.088 89.0414C68.712 93.7348 61.3733 96.5081 52.072 97.3615V109.905H38.76ZM51.56 78.6734C57.2773 78.0761 60.136 75.8148 60.136 71.8894C60.136 70.0974 59.496 68.6894 58.216 67.6654C57.0213 66.5561 54.8027 65.5321 51.56 64.5934V78.6734ZM39.656 40.1454V26.3214C33.8533 26.8334 30.952 29.0521 30.952 32.9774C30.952 34.6841 31.5493 36.0921 32.744 37.2014C34.024 38.2254 36.328 39.2068 39.656 40.1454Z" fill="#297BCD"/>
</g>
<defs>
<filter id="filter0_d_179_28" x="54.8999" y="7.40002" width="101.372" height="101.7" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dx="10" dy="7"/>
<feGaussianBlur stdDeviation="2.55"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_179_28"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_179_28" result="shape"/>
</filter>
<filter id="filter1_dd_179_28" x="0.199951" y="0.337402" width="97.1801" height="121.668" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dx="10" dy="7"/>
<feGaussianBlur stdDeviation="2.55"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_179_28"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="4"/>
<feGaussianBlur stdDeviation="2"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_179_28" result="effect2_dropShadow_179_28"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_179_28" result="shape"/>
</filter>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

View file

@ -1,14 +0,0 @@
{
"yaml.schemas": {
"https://squidfunk.github.io/mkdocs-material/schema.json": "mkdocs.yml"
},
"yaml.customTags": [
"!ENV scalar",
"!ENV sequence",
"!relative scalar",
"tag:yaml.org,2002:python/name:material.extensions.emoji.to_svg",
"tag:yaml.org,2002:python/name:material.extensions.emoji.twemoji",
"tag:yaml.org,2002:python/name:pymdownx.superfences.fence_code_format",
"tag:yaml.org,2002:python/object/apply:pymdownx.slugs.slugify mapping"
]
}

View file

@ -0,0 +1,7 @@
import { defineCollection } from 'astro:content';
import { docsLoader } from '@astrojs/starlight/loaders';
import { docsSchema } from '@astrojs/starlight/schema';
export const collections = {
docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }),
};

View file

@ -0,0 +1,31 @@
---
title: Configure .env
---
import { Aside, Code } from '@astrojs/starlight/components';
Kekkai can be configured using the `.env` file in the working directory. `.env.example`.
`.env` config is used to configure PosgreSQL running in Docker Compose.
<Aside>
If you are not using Docker Compose, you do not need to edit this config
</Aside>
<Code code=
'
# 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
' title='.env.example'/>
This config only edits the password for PosgreSQL.
Please use only the characters `A-Za-z0-9`, without special characters or spaces

View file

@ -1,3 +1,9 @@
---
title: Nginx configuration
---
import { Code } from '@astrojs/starlight/components';
Kekkai is used by `Nginx` to redirect to the correct microservice. Kekkai is used by `Nginx` to redirect to the correct microservice.
## Change domain ## Change domain
@ -5,12 +11,11 @@ Kekkai is used by `Nginx` to redirect to the correct microservice.
Change localhost to your `domain` or `ipv4` based on your needs. Change localhost to your `domain` or `ipv4` based on your needs.
If you need to use Kekkai locally, you don't need to change anything, If you need to use Kekkai locally, you don't need to change anything,
??? note <Code code='
``` ...
... server_name localhost; # Your domain
server_name localhost; # Your domain ...
... 'title='nginx.conf'/>
```
## Change name for SSL ## Change name for SSL
@ -18,11 +23,10 @@ This is where the name of the SSL files changes. This needs to be edited if you
Change `privkey.pem` and `fullchain.pem` to the names of the files you have. Change `privkey.pem` and `fullchain.pem` to the names of the files you have.
??? note <Code code=
``` '
... ...
ssl_certificate /etc/nginx/ssl/fullchain.pem; ssl_certificate /etc/nginx/ssl/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/privkey.pem; ssl_certificate_key /etc/nginx/ssl/privkey.pem;
... ...
``` ' title='nginx.conf'/>

View file

@ -0,0 +1,148 @@
---
title: Configure config.yaml
---
import { Aside } from '@astrojs/starlight/components';
Kekkai can be configured using the `config.yaml` file in the working directory.
`config.example.yaml`.
```yaml
# For more information, see the documentation
# https://kekkai-docs.redume.su/
database:
user: 'DATABASE_USERNAME'
password: 'DATABASE_PASSWORD'
host: 'DATABASE_HOST'
name: 'DATABASE_NAME'
port: 5432
server:
host: '0.0.0.0'
ssl:
private_key: '/CertSSL/privkey.pem'
cert: '/CertSSL/fullchain.pem'
work: true
log:
print: true
level: 'info'
analytics:
plausible_api: 'https://plausible.io/api/event/'
plausible_domain: 'PLAUSIBLE_DOMAIN'
plausible_token: 'PLAUSIBLE_TOKEN'
work: false
currency:
chart:
save: false
collecting:
fiat: true
schedule: '30 8 * * *'
fiat:
- USD
- RUB
- EUR
- UAH
- TRY
- KZT
```
## Database
Kekkai is used as a `PostgreSQL` database.
<Aside>
If you installed Kekkai via Docker Compose,
then install it in the `database.host` value of `postgres`.
The rest of the data does not have to be filled in.
They need to be filled in `.env`.
What should it look like:
```yaml
database:
...
host: 'postgres'
...
...
```
</Aside>
## Server
<Aside>
If you installed Kekkai via Docker Compose, then changing `server.host`, `
server.ssl` is not recommended.
</Aside>
### SSL
Create a folder CertSSL to store your certificates
```shell
mkdir CertSSL
```
Copy your certificates to the CertSSL folder.
It is recommended to rename the certificates to `privkey.pem` and `fullchain.pem`.
If this is not possible,
you need to change the SSL name in `nginx.conf` (if using Docker Compose)
## Analytics
Kekkai uses [`Plausbile`](https://plausible.io/) as an analyst.
Minimal data is transferred for anilithics.
Such as: browser, OS, status code, url, where the user came from.
Most of the data is built on User Agent.
It is possible to disable analytics in Kekkai.
```yaml
...
analytics:
plausible_api: 'https://plausible.io/api/event/'
plausible_domain: 'PLAUSIBLE_DOMAIN'
plausible_token: 'PLAUSIBLE_TOKEN'
work: true
...
```
- `plausible_api`: This is where the Plausible instance is specified.
The official instance is specified by default.
- `plausible_domain`: Kekkai Instance Domain.
It should be added to Plausible first, and then to the config.
You can add the domain [here](https://plausible.io/sites/new?flow=provisioning).
- `plausible_token`: Api token for authorization and sending requests.
You can create it [here](https://plausible.io/settings/api-keys).
- `work`: Enable or disable analytics.
## Currency
`DuckDuckGo` (fiat currency collection) and `CoinMarketCap` (cryptocurrency collection)
are used to collect currency rates.
```yaml
...
currency:
chart:
save: false # Enable or disable saving graphs to an image (Boolean)
collecting:
fiat: true # Turn off or turn on the collection of the fiat currency rate [Boolean]
crypto: false
schedule: '30 8 * * *' # Currency collection schedule in crontab format [String]
crypto_apikey: 'APIKEY'
fiat: # List of fiat currency to save the exchange rate [Array]
- USD
- RUB
- EUR
- UAH
- TRY
- KZT
crypto:
- ETH
- TON
- USDT
```
- `currency.chart.save`: Enable or disable saving graphs.
- `currency.collecting`: Enable or disable cryptocurrency
or fiat currency exchange rate collection.
- `currency.schedule`: Currency collection interval (Configurable via cron.
It is recommended to use [crontab.guru](https://crontab.guru),
not supported in `Non-standard format`, like `@daily`).
- `crypto.crypto_apiKey`: API-key from CoinMarketCap service
- `currency.fiat`: A list of fiat currencies that will be saved to the database.
- `currency.crypto`: A list of crypto currencies that will be saved to the database.

View file

@ -0,0 +1,172 @@
---
title: Create Charts - /api/getChart
---
Creating a currency rate chart.
import { Tabs, TabItem, Aside } from '@astrojs/starlight/components';
## Creating a graph for a certain period
### Request
<Tabs>
<TabItem label='Shell'>
<Tabs>
<TabItem label='curl'>
```shell
curl --request GET --url https://kekkai-api.redume.su/api/getChart/week?from_currency=RUB&conv_currency=USD
```
</TabItem>
</Tabs>
</TabItem>
<TabItem label='Python'>
<Tabs>
<TabItem label='requests'>
```python
import requests
res = requests.get('https://kekkai-api.redume.su/api/getChart/week', {
'from_currency': 'USD',
'conv_currency': 'RUB',
}, timeout=3)
print(res.json())
```
</TabItem>
</Tabs>
</TabItem>
<TabItem label='Node.JS'>
<Tabs>
<TabItem label='axios'>
```javascript
const axios = require('axios');
axios.get('https://kekkai-api.redume.su/api/getChart/week', {
timeout: 3000,
'from_currency': 'USD',
'conv_currency': 'RUB',
})
.then((res) => {
console.log(res['data']);
})
.catch((err) => {
console.error(err);
});
```
</TabItem>
</Tabs>
</TabItem>
</Tabs>
### Query params
| Parameter | Description |
|-------------------|-------------------------------------------------------------------------|
| `from_currency`* | `ISO 4217` code of the currency from which the conversion takes place |
| `conv_currency`* | `ISO 4217` code of the currency to which the conversion is performed |
### URL params
| Parameter | Description |
|---------------|-------------------------------------------------------------------------|
| `period` | Available parameters: `week`, `month`, `quarter`, `year` |
`*` - Required arguments
### Response
<Aside title='Output'>
```json
{
"status": 201,
"message": "http://kekkai-api.redume.su/static/charts/RUB_USD_20241108_DQVDN7.png"
}
```
</Aside>
## Creating a schedule for specific days
### Request
<Tabs>
<TabItem label='Shell'>
<Tabs>
<TabItem label='curl'>
```shell
curl --request GET --url https://kekkai-api.redume.su/api/getChart/?from_currency=RUB&conv_currency=USD&start_date=2024-10-31&end_date=2024-11-08
```
</TabItem>
</Tabs>
</TabItem>
<TabItem label='Python'>
<Tabs>
<TabItem label='requests'>
```python
import requests
res = requests.get('https://kekkai-api.redume.su/api/getChart/', {
'from_currency': 'USD',
'conv_currency': 'RUB',
'start_date': '2024-10-31',
'end_date': '2024-11-08'
}, timeout=3)
print(res.json())
```
</TabItem>
</Tabs>
</TabItem>
<TabItem label='Node.JS'>
<Tabs>
<TabItem label='axios'>
```javascript
const axios = require('axios');
axios.get('https://kekkai-api.redume.su/api/getChart/', {
timeout: 3000,
'from_currency': 'USD',
'conv_currency': 'RUB',
'start_date': '2024-10-31',
'end_date': '2024-11-08'
})
.then((res) => {
console.log(res['data']);
})
.catch((err) => {
console.error(err);
});
```
</TabItem>
</Tabs>
</TabItem>
</Tabs>
### Query params
| Parameter | Description |
|------------------|------------------------------------------------------------------------|
| `from_currency`* | `ISO 4217` code of the currency from which the conversion takes place |
| `conv_currency`* | `ISO 4217` code of the currency to which the conversion is performed |
| `start_date`* | Start date of the period in the format `YYYYY-DD-MM` |
| `end_date`* | Period end date in the format `YYYYY-DD-MM` |
`*` - Required arguments
### Response
<Aside title='Output'>
```json
{
"status": 201,
"message": "http://kekkai-api.redume.su/static/charts/RUB_USD_20250226_RX02RN.png"
}
```
</Aside>
## What the name of the chart file consists of
Example: ``.../RUB_USD_20241108_DQVDN7.png``
- `RUB_USD` - Name of currencies.
- `20241108` - Schedule request date in `YYYMMDD` format.
- `DQVDN7` - Random file character identifier.
All charts are in the charts folder, which is in the root directory (`/chart`)

View file

@ -1,8 +1,12 @@
---
title: Endpoints list
---
## API Base URL ## API Base URL
All requests to our API should be directed to the URL below: All requests to our API should be directed to the URL below:
``` ```
https://kekkai-api.redume.su/api/ https://kekkai.redume.su/api/
``` ```

View file

@ -0,0 +1,199 @@
---
title: Get currency rate - /api/getRate
---
Currencies are identified by standard three-letter `ISO 4217` codes.
import { Tabs, TabItem, Aside } from '@astrojs/starlight/components';
## Getting the currency rate for a certain day.
### Request
<Tabs>
<TabItem label='Shell'>
<Tabs>
<TabItem label='curl'>
```shell
curl --request GET --url https://kekkai-api.redume.su/api/getRate/?from_currency=RUB&conv_currency=USD&date=2024-10-16
```
</TabItem>
</Tabs>
</TabItem>
<TabItem label='Python'>
<Tabs>
<TabItem label='requests'>
```python
import requests
res = requests.get('https://kekkai-api.redume.su/api/getRate/', {
'from_currency': 'RUB',
'conv_currency': 'USD',
'date': '2024-10-16',
}, timeout=3)
print(res.json())
```
</TabItem>
</Tabs>
</TabItem>
<TabItem label='Node.JS'>
<Tabs>
<TabItem label='axios'>
```javascript
const axios = require('axios');
axios.get('https://kekkai-api.redume.su/api/getRate/', {
timeout: 3000,
'from_currency': 'RUB',
'conv_currency': 'USD',
'date': '2024-10-16',
}
)
.then((res) => {
console.log(JSON.stringify(res.json()));
})
.catch((err) => {
console.error(err);
});
```
</TabItem>
</Tabs>
</TabItem>
</Tabs>
### Query Parameters
| Parameter | Description |
|-------------------|------------------------------------------------------------------------|
| `from_currency`* | `ISO 4217` code of the currency from which the conversion takes place |
| `conv_currency`* | `ISO 4217` code of the currency to which the conversion is performed |
| `date`* | Currency rate date in the format `YYYYY-DD-MM` |
| `conv_amount` | Multiplier for number conversion (Optional) |
`*` - Required arguments
### Response
<Aside title='Output'>
```json
[
{
"from_currency": "RUB",
"conv_currency": "USD",
"rate": 0.01,
"date": "2024-10-17T00:00:00.000Z"
}
]
```
</Aside>
## Get currency exchange rate for a certain period
Getting the list of the array with currency rate for a certain period of time.
### Request
<Tabs>
<TabItem label='Shell'>
<Tabs>
<TabItem label='curl'>
```shell
curl --request GET --url https://kekkai-api.redume.su/api/getRate/?from_currency=RUB&conv_currency=USD&start_date=2024-10-16&end_date=2024-10-20
```
</TabItem>
</Tabs>
</TabItem>
<TabItem label='Python'>
<Tabs>
<TabItem label='requests'>
```python
import requests
res = requests.get('https://kekkai-api.redume.su/api/getRate/', {
'from_currency': 'RUB',
'conv_currency': 'USD',
'start_date': '2024-10-16',
'end_date': '2024-10-20',
}, timeout=3)
print(res.json())
```
</TabItem>
</Tabs>
</TabItem>
<TabItem label='Node.JS'>
<Tabs>
<TabItem label='axios'>
```javascript
const axios = require('axios');
axios.get('https://kekkai-api.redume.su/api/getRate/', {
timeout: 3000,
'from_currency': 'RUB',
'conv_currency': 'USD',
'start_date': '2024-10-16',
'end_date': '2024-10-20',
}
)
.then((res) => {
console.log(JSON.stringify(res.json()));
})
.catch((err) => {
console.error(err);
});
```
</TabItem>
</Tabs>
</TabItem>
</Tabs>
### Query parameters
| Parameter | Description |
|------------------|-------------------------------------------------------------------------|
| `from_currency`* | `ISO 4217` code of the currency from which the conversion takes place |
| `conv_currency`* | `ISO 4217` code of the currency to which the conversion is performed |
| `start_date`* | Start date of the period in the format `YYYYY-DD-MM` |
| `end_date`* | Period end date in the format `YYYYY-DD-MM` |
`*` - Required arguments
### Response
<Aside title='Output'>
```json
[
{
"from_currency": "RUB",
"conv_currency": "USD",
"rate": 0.01,
"date": "2024-10-17T00:00:00.000Z"
},
{
"from_currency": "RUB",
"conv_currency": "USD",
"rate": 0.01,
"date": "2024-10-18T00:00:00.000Z"
},
{
"from_currency": "RUB",
"conv_currency": "USD",
"rate": 0.01,
"date": "2024-10-19T00:00:00.000Z"
},
{
"from_currency": "RUB",
"conv_currency": "USD",
"rate": 0.01,
"date": "2024-10-20T00:00:00.000Z"
},
{
"from_currency": "RUB",
"conv_currency": "USD",
"rate": 0.01,
"date": "2024-10-21T00:00:00.000Z"
}
]
```
</Aside>

View file

@ -0,0 +1,79 @@
---
title: Get metadata - /api/metadata
---
Currencies are identified by standard three-letter `ISO 4217` currency codes.
import { Tabs, TabItem, Aside } from '@astrojs/starlight/components';
## Get data on available dates and currencies.
### Request
<Tabs>
<TabItem label='Shell'>
<Tabs>
<TabItem label='curl'>
```shell
curl --request GET --url https://kekkai-api.redume.su/api/metadata/
```
</TabItem>
</Tabs>
</TabItem>
<TabItem label='Python'>
<Tabs>
<TabItem label='requests'>
```python
import requests
res = requests.get('https://kekkai-api.redume.su/api/metadata/', timeout=3)
print(res.json())
```
</TabItem>
</Tabs>
</TabItem>
<TabItem label='Node.JS'>
<Tabs>
<TabItem label='axios'>
```javascript
const axios = require('axios');
axios.get('https://kekkai-api.redume.su/api/metadata/')
.then((res) => {
console.log(JSON.stringify(res.json()));
})
.catch((err) => {
console.error(err);
});
```
</TabItem>
</Tabs>
</TabItem>
</Tabs>
### Response
<Aside title='Output'>
```json
{
"first_date": "2024-11-26T21:00:00.000Z",
"last_date": "2025-01-01T21:00:00.000Z",
"currencies": {
"crypto": [
"USDT",
"TON",
"BTC",
"ETH"
],
"fiat": [
"USD",
"RUB",
"EUR",
"UAH",
"TRY",
"KZT"
]
}
}
```
</Aside>

View file

@ -1,7 +1,14 @@
If you have any questions, you can write to the [mail](mailto:redddume@gmail.com) or [Telegram](https://t.me/Redddume) ---
title: Contributing
---
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 ### Fork and clone your repository
1. Fork the repository ([click here to fork now](https://github.com/Redume/Kekkai/fork)) 1. Fork the repository
([click here to fork now](https://github.com/Redume/Kekkai/fork))
2. Clone your forked code 2. Clone your forked code
```bash ```bash
git clone https://github.com/<nickname>/Kekkai.git git clone https://github.com/<nickname>/Kekkai.git
@ -18,16 +25,20 @@ git checkout <name_new_branch>
6. Submit a new Pull Request 6. Submit a new Pull Request
### Testing ### Testing
Before sending a Pull Request, test the functionality. Everything should work both in Docker Compose and without it. Before sending a Pull Request, test the functionality.
Everything should work both in Docker Compose and without it.
It is recommended to use Debugger and Debug log for testing. The logging level is changed in `config.yaml` It is recommended to use Debugger and Debug log for testing.
The logging level is changed in `config.yaml`
### Code Style ### Code Style
[`Pylint`][pylint], [`mypy`][mypy], [`eslint`][eslint] and [`prettier`][prettier] are used as code syntax checks [`Pylint`][pylint], [`mypy`][mypy],
[`eslint`][eslint] and [`prettier`][prettier] are used as code syntax checks
#### Checking the Node.JS code #### 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 To check the code, you must first download the necessary libraries,
which are located at the root of the project
```bash ```bash
npm install npm install
``` ```

View file

@ -0,0 +1,84 @@
---
title: Docker
---
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.
import { Steps, Code } from '@astrojs/starlight/components';
<Steps>
1. Preparing files
```
git clone https://github.com/redume/Kekkai
```
```
cd Kekkai
```
2. Change config files
In nginx.conf, you need to specify your domain or ipv4 address
<Code code='
...
listen 443 ssl;
server_name localhost; # Your domain
...
' lang='txt' title='nginx.conf' />
To set up SSL. Create folder `CertSSL`
```
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`
<Code code='
ssl_certificate /etc/nginx/ssl/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
' lang='txt' title='nginx.conf' />
<Code code=
"
database:
user: 'DATABASE_USERNAME'
password: 'DATABASE_PASSWORD'
host: 'DATABASE_HOST'
name: 'DATABASE_NAME'
port: 5432
...
" lang='yaml' title='config.sample.yaml' />
Fill in the data in the database item, as well as in the .env config
<Code code='
# 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
' lang='txt' title='.env.sample' />
- 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`.
3. Start the containers
```shell
docker compose up -d
```
</Steps>

View file

@ -1,3 +1,8 @@
---
title: Home
description: The first free Open-Source Tool for Saving Historical Currency data
---
## What is Kekkai? ## What is Kekkai?
Kekkai — The first free Open-Source Tool for Saving Historical Currency data Kekkai — The first free Open-Source Tool for Saving Historical Currency data
@ -8,4 +13,5 @@ with the ability to create currency exchange rate charts.
- Free & Open-Source - Free & Open-Source
- The ability to create graphs - The ability to create graphs
- Plausible support. Anonymous data collection with the ability to disable it. Available only to server owners - Plausible support. Anonymous data collection with the ability to disable it.
Available only to server owners

5
docs/tsconfig.json Normal file
View file

@ -0,0 +1,5 @@
{
"extends": "astro/tsconfigs/strict",
"include": [".astro/types.d.ts", "**/*"],
"exclude": ["dist"]
}

View file

@ -1,62 +0,0 @@
site_name: Kekkai
site_url: https://kekkai-docs.redume.su
site_author: Redume
site_description: The first free Open-Source Tool for Saving Historical Currency data
repo_name: Redume/Kekkai
repo_url: https://github.com/Redume/Kekkai
edit_uri: ''
copyright: Copyright &copy; 2024 Redume
nav:
- Getting started:
- Docker [Recommended]: getting-started/docker.md
- Manual: getting-started/manual.md
- Contributing: getting-started/contributing.md
- Endpoints:
- Endpoints list: endpoints/list-endpoints.md
- Get currency rate - /api/getRate: endpoints/get-rate.md
- Create Charts - /api/getChart: endpoints/create-chart.md
- Get Metadata - /api/metadata: endpoints/metadata.md
- Config:
- Configure config.yaml: config/config-yaml.md
- Configure .env: config/config-env.md
- Configure nginx.conf: config/conf-nginx.md
theme:
logo: assets/logo.png
favicon: assets/logo.png
language: en
name: material
palette:
- media: "(prefers-color-scheme: light)"
scheme: default
toggle:
icon: material/brightness-7
name: Switch to dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
toggle:
icon: material/brightness-4
name: Switch to system preference
features:
- content.code.copy
- content.tabs.link
markdown_extensions:
- pymdownx.tabbed:
alternate_style: true
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- admonition
- pymdownx.details
- pymdownx.superfences
- tables

View file

@ -9,8 +9,6 @@ location /api/getChart {
} }
location /static/chart { location /static/chart {
limit_req zone=kekkai burst=4;
proxy_pass http://chart:3030; proxy_pass http://chart:3030;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;

4
nginx/docs/nginx.conf Normal file
View file

@ -0,0 +1,4 @@
location ~ ^/(_astro|assets|docs|pagefind)/ {
root /etc/nginx/dist;
index index.html;
}

99
nginx/mime.types Normal file
View file

@ -0,0 +1,99 @@
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/avif avif;
image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
font/woff woff;
font/woff2 woff2;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.oasis.opendocument.graphics odg;
application/vnd.oasis.opendocument.presentation odp;
application/vnd.oasis.opendocument.spreadsheet ods;
application/vnd.oasis.opendocument.text odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation
pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document
docx;
application/vnd.wap.wmlc wmlc;
application/wasm wasm;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}

View file

@ -1,14 +1,14 @@
events { } events { }
http { http {
include /etc/nginx/mime.types;
limit_req_zone $binary_remote_addr zone=kekkai:10m rate=10r/s; limit_req_zone $binary_remote_addr zone=kekkai:10m rate=10r/s;
server { server {
listen 80; listen 80;
server_name localhost; # Your domain server_name localhost; # Your domain
limit_req zone=kekkai;
return 301 https://$host$request_uri$is_args$args; return 301 https://$host$request_uri$is_args$args;
} }
@ -20,10 +20,9 @@ http {
ssl_certificate /etc/nginx/ssl/fullchain.pem; ssl_certificate /etc/nginx/ssl/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/privkey.pem; ssl_certificate_key /etc/nginx/ssl/privkey.pem;
limit_req zone=kekkai;
include chart/nginx.conf; include chart/nginx.conf;
include server/nginx.conf; include server/nginx.conf;
include web/nginx.conf; include web/nginx.conf;
include docs/nginx.conf;
} }
} }

View file

@ -1,6 +1,4 @@
location / { location / {
limit_req zone=kekkai burst=4;
proxy_pass http://web:3050; proxy_pass http://web:3050;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;