This commit is contained in:
2026-03-14 13:01:24 +01:00
commit 46fb96886a
25 changed files with 1546 additions and 0 deletions

5
debian/changelog vendored Normal file
View File

@@ -0,0 +1,5 @@
orderpy-bridge (1.0.0) unstable; urgency=medium
* Initial daemon package (systemd, /opt/orderpy-bridge, venv).
-- OrderPy <support@orderpy.com> Sat, 21 Feb 2026 12:00:00 +0000

1
debian/compat vendored Normal file
View File

@@ -0,0 +1 @@
13

14
debian/control vendored Normal file
View File

@@ -0,0 +1,14 @@
Source: orderpy-bridge
Section: net
Priority: optional
Maintainer: OrderPy <support@orderpy.com>
Build-Depends: debhelper-compat (= 13)
Standards-Version: 4.6.2
Package: orderpy-bridge
Architecture: all
Depends: python3 (>= 3.11), python3-venv, ${misc:Depends}
Description: OrderPy Bridge daemon (WebSocket + local setup API)
Connects to OrderPy Cloud via WebSocket and exposes a local HTTP API
for bridge discovery and claim. Sends receipt bytes to configured
network printers. Runs as a systemd service with minimal privileges.

34
debian/postinst vendored Normal file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
set -e
SERVICE_USER="orderpy-bridge"
SERVICE_GROUP="orderpy-bridge"
DATA_DIR="/var/lib/orderpy-bridge"
INSTALL_DIR="/opt/orderpy-bridge"
ENV_FILE="/etc/orderpy-bridge/orderpy-bridge.env"
if ! getent group "$SERVICE_GROUP" >/dev/null; then
groupadd --system "$SERVICE_GROUP"
fi
if ! getent passwd "$SERVICE_USER" >/dev/null; then
useradd --system --no-create-home --gid "$SERVICE_GROUP" "$SERVICE_USER"
fi
install -d -m 750 -o "$SERVICE_USER" -g "$SERVICE_GROUP" "$DATA_DIR"
if [[ ! -f "$ENV_FILE" ]]; then
install -m 640 -o root -g "$SERVICE_GROUP" /etc/orderpy-bridge/orderpy-bridge.env.example "$ENV_FILE"
echo "Created $ENV_FILE — please edit and set ORDERPY_CLOUD_URL, ORDERPY_ALLOWED_ORIGINS."
fi
chown -R "$SERVICE_USER:$SERVICE_GROUP" "$INSTALL_DIR"
if [[ ! -x "$INSTALL_DIR/venv/bin/uvicorn" ]]; then
python3 -m venv "$INSTALL_DIR/venv"
"$INSTALL_DIR/venv/bin/pip" install --disable-pip-version-check -r "$INSTALL_DIR/requirements.txt"
chown -R "$SERVICE_USER:$SERVICE_GROUP" "$INSTALL_DIR/venv"
fi
systemctl daemon-reload
echo "OrderPy Bridge installed. Edit $ENV_FILE then: systemctl enable --now orderpy-bridge"

12
debian/rules vendored Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/make -f
%:
dh $@
override_dh_auto_install:
install -d debian/orderpy-bridge/opt/orderpy-bridge
cp -r bridge_core debian/orderpy-bridge/opt/orderpy-bridge/
install -m 644 daemon/main.py daemon/requirements.txt debian/orderpy-bridge/opt/orderpy-bridge/
install -d debian/orderpy-bridge/etc/orderpy-bridge
install -m 640 daemon/orderpy-bridge.env.example debian/orderpy-bridge/etc/orderpy-bridge/orderpy-bridge.env.example
install -d debian/orderpy-bridge/etc/systemd/system
install -m 644 daemon/systemd/orderpy-bridge.service debian/orderpy-bridge/etc/systemd/system/