Final polish for deploy

This commit is contained in:
2025-12-28 00:42:05 +01:00
parent e1c842b719
commit 4000d0972e
7 changed files with 26 additions and 13 deletions

View File

@@ -1 +1 @@
dh_auto_install dh_builddeb

View File

@@ -2,7 +2,7 @@ Package: sensorpajen
Version: 2.0.0-dev Version: 2.0.0-dev
Architecture: all Architecture: all
Maintainer: Fredrik <fredrik@wahlberg.se> Maintainer: Fredrik <fredrik@wahlberg.se>
Installed-Size: 109 Installed-Size: 110
Depends: python3 (>= 3.9), python3-venv, python3-pip, bluetooth, bluez, libcap2-bin Depends: python3 (>= 3.9), python3-venv, python3-pip, bluetooth, bluez, libcap2-bin
Recommends: mosquitto-clients Recommends: mosquitto-clients
Section: misc Section: misc

View File

@@ -1,4 +1,5 @@
90ea43f1be78ca18b9210f2d370001c4 opt/sensorpajen/pyproject.toml 3b3c15c00bf48fc519b8fbe507a93a7e opt/sensorpajen/pyproject.toml
0894789523a53bb372980c0906a7d0b5 opt/sensorpajen/requirements.txt
940d73f24eb9f971ce27f9355e3072f3 opt/sensorpajen/scripts/approve-sensors.sh 940d73f24eb9f971ce27f9355e3072f3 opt/sensorpajen/scripts/approve-sensors.sh
20eb4f3839b990a530410768897402c0 opt/sensorpajen/src/sensorpajen/__init__.py 20eb4f3839b990a530410768897402c0 opt/sensorpajen/src/sensorpajen/__init__.py
1f452c46e42f8dc3751dba6ca68256e9 opt/sensorpajen/src/sensorpajen/approve_sensors.py 1f452c46e42f8dc3751dba6ca68256e9 opt/sensorpajen/src/sensorpajen/approve_sensors.py
@@ -13,6 +14,6 @@ c9c22f9c1d65bfafd89fa45f16b7192b usr/lib/systemd/system/sensorpajen.service
bd2f1371c60af415bc9d0dbc1111184d usr/share/doc/sensorpajen/ROADMAP.md.gz bd2f1371c60af415bc9d0dbc1111184d usr/share/doc/sensorpajen/ROADMAP.md.gz
380e8e6b01b757ceac05bc5805844ae4 usr/share/doc/sensorpajen/changelog.Debian.gz 380e8e6b01b757ceac05bc5805844ae4 usr/share/doc/sensorpajen/changelog.Debian.gz
14152a98d7cd7fe8daf280aacc4cbf3f usr/share/doc/sensorpajen/examples/discovered_sensors.json.example 14152a98d7cd7fe8daf280aacc4cbf3f usr/share/doc/sensorpajen/examples/discovered_sensors.json.example
b0249deee21ceb834bc2fe9947be82d3 usr/share/doc/sensorpajen/examples/sensorpajen.env.example 387cb9ee7f22570312604e2cc07ca7a0 usr/share/doc/sensorpajen/examples/sensorpajen.env.example
292efbddd951c39cb2c9546d5fac5e05 usr/share/doc/sensorpajen/examples/sensors.json.example 292efbddd951c39cb2c9546d5fac5e05 usr/share/doc/sensorpajen/examples/sensors.json.example
5f647c63bfc3b174611694779fd215e0 usr/share/doc/sensorpajen/readme.md.gz 5f647c63bfc3b174611694779fd215e0 usr/share/doc/sensorpajen/readme.md.gz

View File

@@ -42,13 +42,24 @@ case "$1" in
venv/bin/pip install --upgrade pip setuptools wheel venv/bin/pip install --upgrade pip setuptools wheel
fi fi
# Install Python dependencies from pyproject.toml # Install Python dependencies from requirements.txt
echo "Installing Python dependencies..." echo "Installing Python dependencies..."
venv/bin/pip install -e . || { if [ -f "/opt/sensorpajen/requirements.txt" ]; then
echo "Warning: pip install failed. You may need to install dependencies manually." venv/bin/pip install -r /opt/sensorpajen/requirements.txt
} else
echo "Warning: requirements.txt not found, installing bluepy and paho-mqtt directly"
venv/bin/pip install bluepy paho-mqtt
fi
if [ $? -ne 0 ]; then
echo "Error: Failed to install dependencies"
exit 1
fi
# Set Bluetooth capabilities on Python executable # Set ownership of application directory BEFORE setting capabilities
chown -R sensorpajen:sensorpajen /opt/sensorpajen
# Set Bluetooth capabilities on Python executable (after ownership change)
PYTHON_PATH=$(readlink -f /opt/sensorpajen/venv/bin/python3) PYTHON_PATH=$(readlink -f /opt/sensorpajen/venv/bin/python3)
if command -v setcap >/dev/null 2>&1; then if command -v setcap >/dev/null 2>&1; then
setcap cap_net_raw,cap_net_admin+eip "$PYTHON_PATH" || { setcap cap_net_raw,cap_net_admin+eip "$PYTHON_PATH" || {
@@ -59,9 +70,6 @@ case "$1" in
echo "Warning: setcap not found (install libcap2-bin package)" echo "Warning: setcap not found (install libcap2-bin package)"
fi fi
# Set ownership of application directory
chown -R sensorpajen:sensorpajen /opt/sensorpajen
# Install systemd service file # Install systemd service file
if [ -f /opt/sensorpajen/debian/sensorpajen.service ]; then if [ -f /opt/sensorpajen/debian/sensorpajen.service ]; then
cp /opt/sensorpajen/debian/sensorpajen.service /etc/systemd/system/ cp /opt/sensorpajen/debian/sensorpajen.service /etc/systemd/system/

View File

@@ -26,6 +26,7 @@ classifiers = [
] ]
dependencies = [ dependencies = [
"pybluez>=0.31",
"bluepy>=1.3.0", "bluepy>=1.3.0",
"paho-mqtt>=1.6.0", "paho-mqtt>=1.6.0",
] ]

View File

@@ -0,0 +1,3 @@
pybluez
bluepy
paho-mqtt

View File

@@ -13,7 +13,7 @@ DISCOVERED_SENSORS_FILE=config/discovered_sensors.json
WATCHDOG_TIMEOUT=5 WATCHDOG_TIMEOUT=5
ENABLE_BATTERY=true ENABLE_BATTERY=true
LOG_LEVEL=INFO LOG_LEVEL=INFO
CONFIG_RELOAD_INTERVAL=900 # 15 minutes in seconds CONFIG_RELOAD_INTERVAL=900
# ntfy Notifications (optional) # ntfy Notifications (optional)
NTFY_ENABLED=false NTFY_ENABLED=false