The embedded Raspberry Pi will be responsible for the communication between the ESP and the control panel (Flutter project). It gathers and transmit user inputs to the ESP and send sensors data to the control panel (user).
It is an API with two main features: get the status of the websockets (open/close) and access the websockets to receive/send data.
Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all parts it needs, such as libraries and other dependencies, and ship it all out as one package.
On the Raspberry Pi, the installation is a little bit different from the common OS. The official documentation is here.
First, clone the repository:
git clone https://github.com/THE-TRAVELERS/Embedded-Python-Server.gitMove to the directory:
cd Embedded-Python-ServerInstall the dependencies and build the Docker image using:
sudo apt installe make
make installAnd then, run the service:
make startThe service will be up and running. To check the logs, we may use the tool lazydocker:
lazydockerThe othe commands available in the Makefile are:
make stop: Stop the service.make restart: Restart the service.make logs: Show the logs of the service.make clean: Remove the Docker container and image.make bash: Open a shell inside the Docker container.make update: Update the service to the latest version.
First clone the repository and navigate to Embedded-Python-Server/src directory:
Then, let's set up a virtual environment:
python3 -m venv travenv
source travenv/bin/activateThen, install the requirements:
pip install -r requirements.txtNow, we can run the FastAPI server for a debug environment:
fastapi dev /app/main.py --port 8000Or for a production environment:
fastapi run /app/main.py --port 8000This project is licensed under the MIT License - see the LICENSE file for details.