Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 18 additions & 22 deletions examples/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,41 @@ FRONTEND_PORT=8080
# FORWARDED_ALLOW_IPS=*

# ----- Printers (required) --------------------------------------------------
# Comma-separated <slug>:<ip> pairs. Slugs are arbitrary identifiers.
# Examples below use RFC 5737 documentation IPs — replace with your printer IPs.
PRINTERS=pt750w:192.0.2.10,ql820:192.0.2.11

# SNMP read community for status polling. Default for Brother printers is "public".
SNMP_COMMUNITY=public
# Printers are configured via a printers.yaml file (see backend/app/seed/printers.yaml.example).
# Mount the file into the container (see compose.pangolin.yml volumes section):
# volumes:
# - ./printers.yaml:/etc/hub/printers.yaml:ro
#
# Override the config path if you use a different mount point:
# PRINTER_HUB_PRINTERS_CONFIG=/etc/hub/printers.yaml

# ----- Hub (required) -------------------------------------------------------
# Public URL of the hub (used for QR-code label content and PWA scope).
# Public hostname of the hub (used in Pangolin blueprint labels).
# Only relevant for reverse-proxy variants — for standalone, leave blank.
Comment on lines +36 to 37
PRINTERHUB_HOST=printerhub.example.com

# Random 32-byte hex string for webhook authentication.
# Generate: openssl rand -hex 32
WEBHOOK_API_KEY=CHANGE_ME_GENERATE_WITH_OPENSSL_RAND_HEX_32
# ----- Webhook authentication (required if using webhook endpoint) ----------
# Random 32-byte hex string. Generate: openssl rand -hex 32
PRINTER_HUB_WEBHOOK_API_KEY=CHANGE_ME_GENERATE_WITH_OPENSSL_RAND_HEX_32

# ----- Database -------------------------------------------------------------
# SQLite database path inside the container.
DATABASE_URL=sqlite:///data/printer-hub.db

# ----- Defaults -------------------------------------------------------------
# Default tape size in millimetres if the UI doesn't specify
DEFAULT_TAPE_PT_SERIES=12
DEFAULT_TAPE_QL_SERIES=62
# PRINTER_HUB_DATABASE_URL=sqlite+aiosqlite:////data/printer-hub.db

# ----- App integrations (optional) ------------------------------------------
# Snipe-IT — for asset-tag printing
# SNIPEIT_URL=https://snipeit.example.com
# SNIPEIT_API_TOKEN=
# PRINTER_HUB_SNIPEIT_URL=https://snipeit.example.com
# PRINTER_HUB_SNIPEIT_API_KEY=

# Grocy — for product/storage labels
# GROCY_URL=https://grocy.example.com
# GROCY_API_KEY=
# PRINTER_HUB_GROCY_URL=https://grocy.example.com
# PRINTER_HUB_GROCY_API_KEY=

# Spoolman — for 3D printer filament spool labels
# SPOOLMAN_URL=https://spoolman.example.com
# PRINTER_HUB_SPOOLMAN_URL=https://spoolman.example.com

# ----- Logging --------------------------------------------------------------
LOG_LEVEL=INFO
PRINTER_HUB_LOG_LEVEL=INFO

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In .env.example wurde LOG_LEVEL durch PRINTER_HUB_LOG_LEVEL ersetzt. In compose.pangolin.yml wird für den Frontend-Container jedoch weiterhin LOG_LEVEL=${LOG_LEVEL:-INFO} verwendet. Da LOG_LEVEL nun nicht mehr in .env.example dokumentiert ist, ist für Benutzer nicht direkt ersichtlich, wie sie das Logging des Frontends konfigurieren können. Es wird empfohlen, einen entsprechenden Kommentar oder die Variable LOG_LEVEL=INFO für das Frontend in .env.example zu behalten.

PRINTER_HUB_LOG_LEVEL=INFO
# LOG_LEVEL=INFO

Comment on lines 60 to +61

# ----- Container UID/GID (optional) -----------------------------------------
# Override only if 1000:1000 conflicts with your host user.
Expand Down
59 changes: 36 additions & 23 deletions examples/compose.pangolin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,13 @@ services:
environment:
- PORT=${BACKEND_PORT:-8000}
- FORWARDED_ALLOW_IPS=${FORWARDED_ALLOW_IPS:-*}
- PRINTERS=${PRINTERS}
- SNMP_COMMUNITY=${SNMP_COMMUNITY:-public}
- DATABASE_URL=${DATABASE_URL:-sqlite:///data/printer-hub.db}
- WEBHOOK_API_KEY=${WEBHOOK_API_KEY}
- UI_BASE_URL=https://${PRINTERHUB_HOST}
- LOG_LEVEL=${LOG_LEVEL:-INFO}
- PRINTER_HUB_PRINTERS_CONFIG=${PRINTER_HUB_PRINTERS_CONFIG:-/etc/hub/printers.yaml}
- PRINTER_HUB_DATABASE_URL=${PRINTER_HUB_DATABASE_URL:-sqlite+aiosqlite:////data/printer-hub.db}
- PRINTER_HUB_WEBHOOK_API_KEY=${PRINTER_HUB_WEBHOOK_API_KEY}
- PRINTER_HUB_LOG_LEVEL=${PRINTER_HUB_LOG_LEVEL:-INFO}
volumes:
- ./data:/data
- ./printers.yaml:/etc/hub/printers.yaml:ro
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-fsS", "http://localhost:${BACKEND_PORT:-8000}/healthz"]
Expand All @@ -40,7 +39,7 @@ services:
container_name: label-printer-hub-frontend
user: "1000:1000"
networks:
- pangolin-newt
- pangolin_mgmt
- hub-internal
environment:
- PORT=${FRONTEND_PORT:-8080}
Expand All @@ -57,26 +56,40 @@ services:
retries: 3
start_period: 15s
labels:
- "pangolin.enable=true"

# Main UI behind SSO
- "pangolin.resources.printerhub.protocol=https"
- "pangolin.resources.printerhub.full-domain=${PRINTERHUB_HOST}"
- "pangolin.resources.printerhub.port=${FRONTEND_PORT:-8080}"
- "pangolin.resources.printerhub.auth.sso-enabled=true"
# Main UI — behind Pangolin SSO
- "pangolin.public-resources.printerhub.name=Label Printer Hub"
- "pangolin.public-resources.printerhub.full-domain=${PRINTERHUB_HOST}"
- "pangolin.public-resources.printerhub.protocol=http"
- "pangolin.public-resources.printerhub.ssl=true"
- "pangolin.public-resources.printerhub.targets[0].method=http"
- "pangolin.public-resources.printerhub.targets[0].port=${FRONTEND_PORT:-8080}"
- "pangolin.public-resources.printerhub.targets[0].path-match=prefix"
- "pangolin.public-resources.printerhub.auth.sso-enabled=true"

# Webhook subroute without SSO (Two-Resources pattern)
- "pangolin.resources.printerhub-webhooks.protocol=https"
- "pangolin.resources.printerhub-webhooks.full-domain=${PRINTERHUB_HOST}"
- "pangolin.resources.printerhub-webhooks.path-prefix=/api/webhook/"
- "pangolin.resources.printerhub-webhooks.port=${FRONTEND_PORT:-8080}"
- "pangolin.resources.printerhub-webhooks.auth.bypass=true"
# Webhook subroute — auth bypass (Two-Resources pattern)
# Note: Two routes on the same full-domain are only possible with distinct
# path-prefix values. The webhook resource bypasses SSO so that external
# callers can post without a browser session.
Comment on lines +70 to +72

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Der Kommentar erwähnt, dass zwei Routen auf derselben Domain nur mit unterschiedlichen path-prefix-Werten möglich sind. Im Code wird jedoch kein path-prefix-Label auf Ressourcenebene verwendet, sondern targets[0].path und targets[0].path-match. Bitte prüfen Sie, ob der Kommentar veraltet ist oder ob hier tatsächlich ein Label wie pangolin.public-resources.printerhub-webhooks.path-prefix=/api/webhook/ auf Ressourcenebene fehlt, damit Pangolin die Routen und den SSO-Bypass korrekt trennen kann.

Comment on lines +70 to +72
- "pangolin.public-resources.printerhub-webhooks.name=Label Printer Hub Webhooks"
- "pangolin.public-resources.printerhub-webhooks.full-domain=${PRINTERHUB_HOST}"
- "pangolin.public-resources.printerhub-webhooks.protocol=http"
- "pangolin.public-resources.printerhub-webhooks.ssl=true"
- "pangolin.public-resources.printerhub-webhooks.targets[0].method=http"
- "pangolin.public-resources.printerhub-webhooks.targets[0].port=${FRONTEND_PORT:-8080}"
- "pangolin.public-resources.printerhub-webhooks.targets[0].path-match=prefix"
- "pangolin.public-resources.printerhub-webhooks.targets[0].path=/api/webhook/"
- "pangolin.public-resources.printerhub-webhooks.auth.bypass=true"

networks:
pangolin-newt:
pangolin_mgmt:
# Use the alias-name pattern so this compose works regardless of where
# Pangolin is deployed. The Newt container joins the network under its
# own project name (typically "pangolin_pangolin_mgmt").
name: pangolin_pangolin_mgmt
external: true
hub-internal:
driver: bridge

# After deploy, restart the newt container so blueprint labels are reloaded:
# docker restart pangolin-newt
# After deploy, reload the Newt container so the blueprint labels are picked up.
# Use your container management tool (Dockhand, Portainer, or similar) to
# restart the Newt container — do not bypass it with a raw docker command.
Loading