Update README/CONTRIBUTING Closes #180 (#204)

* Update README/CONTRIBUTING Closes #180

 * Remove duplicated files in docs/develop and copy them from project
   root to there on documentation generation.

* Makefile: Use fastapi to start server, set port to 8503
This commit is contained in:
Dominique Lasserre
2024-11-17 15:27:43 +01:00
committed by GitHub
parent b3914ab16b
commit edfe309a26
6 changed files with 72 additions and 212 deletions

View File

@@ -8,14 +8,34 @@ See [CONTRIBUTING.md](CONTRIBUTING.md).
## Installation
Good installation guide:
<https://meintechblog.de/2024/09/05/andreas-schmitz-joerg-installiert-mein-energieoptimierungssystem/>
The project requires Python 3.9 or newer. Currently there are no official packages or images published.
The project requires Python 3.10 or newer.
Following sections describe how to locally start the EOS server on `http://localhost:8503`.
### Run from source
Install dependencies in virtual environment:
```bash
python -m venv .venv
.venv/bin/pip install -r requirements.txt
```
Finally, start EOS fastapi server:
```bash
.venv/bin/fastapi run --port 8503 src/akkudoktoreos/server/fastapi_server.py
```
### Docker
```bash
docker compose up --build
```
## Configuration
This project uses a `config.json` file to manage configuration settings.
This project uses the `EOS.config.json` file to manage configuration settings.
### Default Configuration
@@ -26,70 +46,11 @@ A default configuration file `default.config.json` is provided. This file contai
Users can specify a custom configuration directory by setting the environment variable `EOS_DIR`.
- If the directory specified by `EOS_DIR` contains an existing `config.json` file, the application will use this configuration file.
- If the `config.json` file does not exist in the specified directory, the `default.config.json` file will be copied to the directory as `config.json`.
- If the `EOS.config.json` file does not exist in the specified directory, the `default.config.json` file will be copied to the directory as `EOS.config.json`.
### Configuration Updates
If the configuration keys in the `config.json` file are missing or different from those in `default.config.json`, they will be automatically updated to match the default settings, ensuring that all required keys are present.
### Quick Start Guide
On Linux (Ubuntu/Debian):
```bash
sudo apt install make
```
On MacOS (requires [Homebrew](https://brew.sh)):
```zsh
brew install make
```
The server can be started with `make run`. A full overview of the main shortcuts is given by `make help`.
### Detailed Instructions
All necessary dependencies can be installed via `pip`. Clone the repository and install the required packages with:
```bash
git clone https://github.com/Akkudoktor-EOS/EOS
cd EOS
```
Next, create a virtual environment. This serves to store the Python dependencies, which we will install later using `pip`:
```bash
python -m venv .venv
```
Finally, install the Python dependencies for EOS:
```bash
.venv/bin/pip install -r requirements.txt
```
To always use the Python version from the virtual environment, you should activate it before working in EOS:
```bash
source .venv/bin/activate
```
## Usage
To use the system and start the server, run `fastapi_server.py` in the previously activated virtual environment:
```bash
fastapi run src/akkudoktoreos/server/fastapi_server.py
```
### Docker
To run the system with Docker:
```bash
docker compose up --build
```
If the configuration keys in the `EOS.config.json` file are missing or different from those in `default.config.json`, they will be automatically updated to match the default settings, ensuring that all required keys are present.
## Classes and Functionalities
@@ -115,4 +76,9 @@ Each class is designed to be easily customized and extended to integrate additio
## Server API
See the Swagger documentation for detailed information: [EOS OpenAPI Spec](https://petstore3.swagger.io/?url=https://raw.githubusercontent.com/Akkudoktor-EOS/EOS/refs/heads/main/docs/akkudoktoreos/openapi.json)
See the Swagger API documentation for detailed information: [EOS OpenAPI Spec](https://petstore3.swagger.io/?url=https://raw.githubusercontent.com/Akkudoktor-EOS/EOS/refs/heads/main/docs/akkudoktoreos/openapi.json)
## Further resources
- [Installation guide (de)](https://meintechblog.de/2024/09/05/andreas-schmitz-joerg-installiert-mein-energieoptimierungssystem/)