Skip to content

Latest commit

 

History

History
60 lines (47 loc) · 1.65 KB

File metadata and controls

60 lines (47 loc) · 1.65 KB

Running on FreeBSD (without Docker)

The server is plain FastAPI + SQLite, so it runs directly under a FreeBSD jail's Python. Docker (see the main README) is the easier path if you have it; these are notes for a native jail install.

Packages

pkg install python311 py311-sqlite3 rust
  • py311-sqlite3 is a separate package on FreeBSD; the base Python build does not include the SQLite module.
  • rust is needed at install time to build pydantic-core (a FastAPI dependency) and watchfiles if you use --reload. It can be removed afterwards if you want to reclaim the space.

Install and run

python3.11 -m venv /usr/local/board-inventory/venv
/usr/local/board-inventory/venv/bin/pip install -r requirements.txt
/usr/local/board-inventory/venv/bin/uvicorn app:app --host 0.0.0.0 --port 5000

Run it from the directory containing app.py and dashboard.html, or set BOARD_INVENTORY_DB to choose where the SQLite file lives.

rc.d service (optional)

Drop a script at /usr/local/etc/rc.d/board_inventory (no extension) so it starts on boot. Sketch:

#!/bin/sh
# PROVIDE: board_inventory
# REQUIRE: NETWORKING
# KEYWORD: shutdown
. /etc/rc.subr
name="board_inventory"
rcvar="board_inventory_enable"
pidfile="/var/run/${name}.pid"
board_inventory_user="www"
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} \
  /usr/local/board-inventory/venv/bin/uvicorn app:app --host 0.0.0.0 --port 5000"
load_rc_config $name
run_rc_command "$1"

Then:

sysrc board_inventory_enable=YES
service board_inventory start

Make sure the board_inventory_user can read app.py/dashboard.html and write the database file/directory.