diff --git a/package/secubox/secubox-app-streamlit/Makefile b/package/secubox/secubox-app-streamlit/Makefile index 670d6e47..228a229f 100644 --- a/package/secubox/secubox-app-streamlit/Makefile +++ b/package/secubox/secubox-app-streamlit/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=secubox-app-streamlit PKG_VERSION:=1.0.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_ARCH:=all PKG_MAINTAINER:=CyberMind Studio @@ -32,6 +32,7 @@ Features: - Run Streamlit apps in LXC container - Python 3.12 with Streamlit 1.53.x - App management (add, remove, switch) +- Auto-install requirements.txt dependencies - Web dashboard integration - Configurable port and memory limits diff --git a/package/secubox/secubox-app-streamlit/files/usr/sbin/streamlitctl b/package/secubox/secubox-app-streamlit/files/usr/sbin/streamlitctl index 661eabcd..cc0c7dfe 100644 --- a/package/secubox/secubox-app-streamlit/files/usr/sbin/streamlitctl +++ b/package/secubox/secubox-app-streamlit/files/usr/sbin/streamlitctl @@ -83,6 +83,13 @@ Configuration: Data directory: /srv/streamlit +Requirements: + Place a requirements.txt file in /srv/streamlit/apps/ to auto-install + Python dependencies. Supported naming conventions: + - .requirements.txt (e.g., sappix.requirements.txt) + - _requirements.txt (e.g., sappix_requirements.txt) + - requirements.txt (global fallback) + EOF } @@ -181,6 +188,28 @@ HELLO fi fi +# Get app name without .py extension +APP_NAME=$(basename "$APP_PATH" .py) + +# Install app-specific requirements if present +# Check for: .requirements.txt, _requirements.txt, or global requirements.txt +for req_file in "/srv/apps/${APP_NAME}.requirements.txt" \ + "/srv/apps/${APP_NAME}_requirements.txt" \ + "/srv/apps/requirements.txt"; do + if [ -f "$req_file" ]; then + REQ_HASH=$(md5sum "$req_file" 2>/dev/null | cut -d' ' -f1) + REQ_MARKER="/opt/.req_${APP_NAME}_${REQ_HASH}" + if [ ! -f "$REQ_MARKER" ]; then + echo "Installing requirements from: $req_file" + pip3 install --break-system-packages -r "$req_file" 2>/dev/null || \ + pip3 install -r "$req_file" 2>/dev/null || \ + echo "Warning: Some requirements may have failed to install" + touch "$REQ_MARKER" + fi + break + fi +done + echo "Starting Streamlit with app: $APP_PATH" cd /srv/apps