docs: add readme file
This commit is contained in:
parent
c7b401eae7
commit
c189cc6955
205
README.md
205
README.md
@ -1 +1,204 @@
|
||||
# Backend
|
||||
# MIREA schedule by Winsomnia
|
||||
|
||||
[![NET Release](https://img.shields.io/badge/v8.0-8?style=flat-square&label=.NET&labelColor=512BD4&color=606060)](https://dotnet.microsoft.com/download/dotnet/8.0)
|
||||
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://opensource.org/licenses/MIT)
|
||||
|
||||
This project is a backend part of an application developed on ASP.NET , which provides an API for getting schedule data.
|
||||
|
||||
The main task is to provide convenient and flexible tools for accessing the schedule in various ways.
|
||||
|
||||
## Purpose
|
||||
|
||||
The purpose of this project is to provide convenient and flexible tools for obtaining schedule data.
|
||||
|
||||
In a situation where existing resources provide limited functionality or an inconvenient interface, this project aims to provide users with a simple and effective tool for accessing information about class schedules.
|
||||
|
||||
Developing your own API and using your own tools for downloading and processing data allows you to ensure the reliability, flexibility and extensibility of the application functionality.
|
||||
|
||||
## Features
|
||||
|
||||
1. **Flexible API**: The API provides a variety of methods for accessing schedule data. Unlike competitors that provide a limited set of endpoints, this application provides a wider range of functionality, allowing you to get data about groups, campuses, faculties, classrooms and teachers. You can get all the data at once or select specific IDs with the details that are needed.
|
||||
2. **Database Providers**: The application provides the capability of various database providers.
|
||||
3. **Using self-written packages**: The project uses two proprietary NuGet packages. One of them is designed for parsing schedules, and the other is for downloading Excel spreadsheets from external sites.
|
||||
|
||||
## Project status
|
||||
|
||||
The project is under development. Further development will be aimed at expanding the functionality and improving the user experience.
|
||||
|
||||
# Environment Variables
|
||||
|
||||
This table provides information about the environment variables that are used in the application. These variables are stored in the [.env](.env) file.
|
||||
|
||||
In addition to these variables, you also need to fill in a file with settings in json format. The web application provided by this project already has everything necessary to configure the file in the Client-Server communication format via the controller. If you need to get the configuration file otherwise, then you need to refer to the classes that provide configuration-related variables.
|
||||
|
||||
Please note that the application will not work correctly if you do not fill in the required variables.
|
||||
|
||||
| Variable | Default | Description | Required |
|
||||
|---------------------------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
|
||||
| PATH_TO_SAVE | ❌ | The path to save the data. Saving logs (if the full path is not specified), databases (if Sqlite), and other data that should be saved in a place other than where the program is launched. | ✔ |
|
||||
| SECURITY_SIGNING_TOKEN | ❌ | JWT signature token. This token will be used to create and verify the signature of JWT tokens. The token must be equal to 64 characters. | ✔ |
|
||||
| SECURITY_ENCRYPTION_TOKEN | ❌ | Token for JWT encryption. This token will be used to encrypt and decrypt JWT tokens. The token must be equal to 32 characters. | ✔ |
|
||||
| SECURITY_LIFE_TIME_RT | 1440 | Time in minutes after which the Refresh Token will become invalid. | ❌ |
|
||||
| SECURITY_LIFE_TIME_JWT | 15 | Time in minutes after which the JWT token will become invalid. | ❌ |
|
||||
| SECURITY_LIFE_TIME_1_FA | 15 | Time in minutes after which the token of the first factor will become invalid. | ❌ |
|
||||
| SECURITY_JWT_ISSUER | ❌ | An identifier that points to the server that created the token. | ✔ |
|
||||
| SECURITY_JWT_AUDIENCE | ❌ | ID of the audience for which the token is intended. | ✔ |
|
||||
| SECURITY_HASH_ITERATION | ❌ | The number of iterations used to hash passwords in the Argon2 algorithm. | ✔ |
|
||||
| SECURITY_HASH_MEMORY | ❌ | The amount of memory used to hash passwords in the Argon2 algorithm. | ✔ |
|
||||
| SECURITY_HASH_PARALLELISM | ❌ | Parallelism determines how many of the memory fragments divided into strips will be used to generate a hash. | ✔ |
|
||||
| SECURITY_HASH_SIZE | 32 | The size of the output hash generated by the password hashing algorithm. | ❌ |
|
||||
| SECURITY_HASH_TOKEN | ❌ | Additional protection for Argon2. We recommend installing a token so that even if the data is compromised, an attacker cannot brute force a password without a token. | ❌ |
|
||||
| SECURITY_SALT_SIZE | 16 | The size of the salt used to hash passwords. The salt is a random value added to the password before hashing to prevent the use of rainbow hash tables and other attacks. | ❌ |
|
||||
|
||||
# Installation
|
||||
|
||||
If you want to make a fork of this project or place the Backend application on your hosting yourself, then follow the instructions below.
|
||||
|
||||
1. [Docker Installation](#docker-installation)
|
||||
2. [Docker Self Build](#docker-self-build)
|
||||
3. [Manual Installation](#manual-installation)
|
||||
4. [Self Build](#self-build)
|
||||
|
||||
## Docker Installation
|
||||
|
||||
**Requirements**
|
||||
|
||||
- Docker
|
||||
|
||||
To launch the application, pull out the application image:
|
||||
|
||||
```bash
|
||||
docker pull winsomnia/mirea-backend:latest
|
||||
```
|
||||
|
||||
Next, you need to fill in the required fields inside.env and pass it when the container is started:
|
||||
|
||||
```bash
|
||||
docker run -d --name mirea-backend -p 8080 \
|
||||
--restart=on-failure:10 \
|
||||
-v mirea-data:/data \
|
||||
-e PATH_TO_SAVE=/data \
|
||||
-e .env \
|
||||
winsomnia/mirea-backend:latest
|
||||
```
|
||||
|
||||
Using the `--name` option, you can specify your container name, for example: `--name mirea`.
|
||||
|
||||
With the `-p` option, you can specify the port you need: `-p 80:8080`.
|
||||
|
||||
It is necessary to tell the application exactly where to save the data so that it does not disappear when the container is deleted.
|
||||
|
||||
To do this, replace the `-v` option, where you need to specify the path to the data on the host first, and then using `:` specify the path inside the container. `-v /nas/mirea/backend:/myfolder`.
|
||||
|
||||
At the same time, do not forget to replace inside [.env](.env) `PATH_TO_SAVE` with what you specify in the `-v` option. In our case, it will be `PATH_TO_SAVE=/myfolder`.
|
||||
|
||||
That's it, the container is running!
|
||||
|
||||
## Docker Self Build
|
||||
|
||||
- Docker
|
||||
|
||||
To build your own application image, run:
|
||||
|
||||
```bash
|
||||
docker build -t my-name/mirea-backend:latest .
|
||||
```
|
||||
|
||||
Where `-t` indicates the name and version of the image. You can specify their `your-name/image-name:version`.
|
||||
|
||||
Now the image is ready. To launch the container, refer to [Docker Installation](#docker-installation), do not forget to specify the name of the image that you have built.
|
||||
|
||||
## Manual Installation
|
||||
|
||||
**Requirements**
|
||||
|
||||
- ASP.NET Core runtime 8.0
|
||||
|
||||
To install using a pre-built application, follow these steps:
|
||||
|
||||
1. [Install ASP.NET](#install-aspnet)
|
||||
2. [Download Package](#download-package)
|
||||
3. [Run](#run)
|
||||
|
||||
### Install ASP.NET
|
||||
|
||||
Installation ASP.NET it depends on the specific platform.
|
||||
Go to [Microsoft website](https://dotnet.microsoft.com/download/dotnet/8.0 ) and find your platform. Follow the installation instructions.
|
||||
|
||||
### Download Package
|
||||
|
||||
The latest versions of the packages can be found in [releases](https://git.winsomnia.net/Winsomnia/MireaBackend/releases ). If there is no build for your platform, go [to the Self Build section](#self-build).
|
||||
|
||||
### Run
|
||||
|
||||
Go to the directory with the application.
|
||||
|
||||
Don't forget to set up [required configurations](#environment-variables) for the application to work.
|
||||
|
||||
Run the program.
|
||||
|
||||
`Debian/Ubuntu`
|
||||
|
||||
```bash
|
||||
dotnet Mirea.Api.Endpoint.dll
|
||||
```
|
||||
|
||||
## Self Build
|
||||
|
||||
Requirements
|
||||
|
||||
- ASP.NET Core runtime 8.0
|
||||
- .NET 8.0 sdk (for build)
|
||||
- git
|
||||
|
||||
To build your own version of the program, follow these steps:
|
||||
|
||||
1. [Install .NET SDK](#install-net-sdk)
|
||||
2. [Clone The Repository](#clone-the-repository)
|
||||
3. [Build Self Release](#build-self-release)
|
||||
|
||||
### Install NET SDK
|
||||
|
||||
Installation.The NET SDK depends on the specific platform.
|
||||
Go to [Microsoft website](https://dotnet.microsoft.com/download/dotnet/8.0 ) and find your platform. Follow the installation instructions.
|
||||
|
||||
### Clone The Repository
|
||||
|
||||
Install git in advance or clone the repository in another way.
|
||||
|
||||
> ⚠ It is advisable to clone the `master` branch, the rest of the branches may work unstable.
|
||||
|
||||
```bash
|
||||
git clone https://git.winsomnia.net/Winsomnia/MireaBackend.git \
|
||||
cd DoctorTelegramBot
|
||||
```
|
||||
|
||||
### Build Self Release
|
||||
|
||||
Go to the project folder. Restore the dependencies using the command:
|
||||
|
||||
```bash
|
||||
dotnet restore
|
||||
```
|
||||
|
||||
Let's move on to the assembly.
|
||||
|
||||
Variables:
|
||||
|
||||
- `<platform>` — Platform for which the build will be performed.
|
||||
- `<arch>` — System architecture. Example: x86 x64.
|
||||
- `<output directory>` — The directory where the assembly will be saved.
|
||||
|
||||
```bash
|
||||
dotnet publish "./Endpoint/Endpoint.csproj" -c Release -r <platform>-<arch> -framework net8.0 -o <output directory> /p:SelfContained=false /p:UseAppHost=false
|
||||
```
|
||||
|
||||
The release is now in the directory you specified. To run it, look at the [startup instructions](#run).
|
||||
|
||||
# Contribution and Feedback
|
||||
|
||||
You can contribute to the project by creating pull requests. Any feedback is welcome to improve the project.
|
||||
|
||||
# License
|
||||
|
||||
This project is licensed under the [MIT License](LICENSE.txt).
|
||||
|
Loading…
Reference in New Issue
Block a user