Skip to content

Latest commit

 

History

History
157 lines (106 loc) · 2.95 KB

README.md

File metadata and controls

157 lines (106 loc) · 2.95 KB

Wheel of Fortune

Overview

An over-engineered DIY version of Wheel of Fortune (Wheel or Prizes). The main features are:

  • 3 LED strips with individually controllable LEDs (WLED)
  • 3 linear servo motors for displaying effect logos
  • absolute position optical encoder for wheel position (position depended effects)
  • Amplified sound system for theme and effect sound
  • ESP32 based LED and servo motor controller
  • Orange PI 3 LTS based compute unit
  • Node (React + Mantine) app for configuration
  • Server stack for metrics, monitoring and backup

Outlook:

Internals:

Services:

For detailed instructions how to build the system, see following readme files:

  1. Mechanical setup
  2. Electrical setup
  3. Embedded software
  4. Server software

Development

Code is split to two main parts:

  1. Python backend (FastAPI)
  2. Node frontend (React + Mantine)

Finally, frontend static HTML + Javascript files are backed into backend Python package and served via backend FastAPI server.

Backend

Development environment

Python 3.11 is currently preferred, but should also work on any Python >= 3.10

python -m venv venv
source venv/bin/activate
pip install -r dev-requirements.txt
pip install -e .

Running backend

source venv/bin/activate
python -m wheel_of_fortune

Updating requirements

After adding dependency update requirement files by running:

source venv/bin/activate
pip-compile --upgrade -o requirements.txt pyproject.toml \
    && pip-compile --extra dev --upgrade -o dev-requirements.txt pyproject.toml \
    && pip-sync dev-requirements.txt

Frontend

Setup development environment

Install nvm and node and install dependencies:

cd wheel_of_fortune/frontend/
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash
source ~/.bashrc
nvm install
nvm use
npm ci

Developer mode

Create .env.local file for overriding environment:

VITE_API_URL=https://wheel.int.example.com/api/v1
VITE_WS_URL=wss://wheel.int.example.com/api/v1/ws

Run frontend in dev mode:

nvm use
npm run dev

Release build

nvm use
npm run build

Update packages

To update package-lock.json and install updates:

npm update
npm install

To also update package.json file:

npm install -g npm-check-updates
ncu -u
npm install

Build steps

Usually not needed, as Github actions automatically build and test frontend & docker images. But for completeness, here are commands to do build manually:

Frontend

cd wheel_of_fortune/frontend/
nvm use
npm ci
npm run build
cd ../..

Backend

python -m build

Docker image

docker build -t wheel_of_fortune .