Commit graph

78 commits

Author SHA1 Message Date
dekzter
90a600b48f merged in dev 2026-03-26 12:17:43 -04:00
None
7e22172070 fix: remove PUID auto-detect
The auto-detect read PUID/PGID from /data/db ownership (UID 102 in pre-PUID images), causing all upgrading users to run as UID 102 instead of the expected UID 1000. This broke host-side access (SSH, WinSCP), made existing DATA_DIR files unwritable, and failed comskip on recordings created before the change.
2026-03-17 19:32:07 -05:00
None
9e720f4fc7 fix: handle chown failures gracefully on external mounts
DATA_DIRS chown failures (NFS, SMB/CIFS, FUSE) crashed the container under set -e. The old image never chowned these directories, so users with external mounts had a working setup that broke on upgrade with zero config changes.

- Collect mkdir and chown failures per-directory instead of crashing
- Emit a single consolidated warning listing all affected directories with current ownership and remediation steps
- Container continues to start; Django reports at runtime if it cannot write to a specific directory
- Local volumes are unaffected: chown still runs and succeeds silently
2026-03-17 18:27:19 -05:00
None
19d3f4258f Add /data/backups to DATA_DIRS
Corrects issue with user ownership migration on previous installations with /data/backups in-use
2026-03-17 17:46:13 -05:00
SergeantPanda
03e1061716 Bug Fix: Fix postgres lock file permissions before starting and upgrading Postgres. 2026-03-13 14:59:46 -05:00
dekzter
f69a462253 merged in dev 2026-03-13 08:22:44 -04:00
None
29525336ab replace migration port and correct variable quoting for guarding
- replaced $_pg_tmp_port with $POSTRGES_PORT in migration logic. Works because "pg_ctl stop -w" is run before entrypoint.sh restarts postgres. Verified that this does not cause a race condition.

- Correcting unquoted environment variables to prevent inappropriate variables from causing execution inconsistencies (still unquoted in comments and prints)
2026-03-12 20:25:54 -05:00
SergeantPanda
a1a2b3332f Declare CONNECT_ROLE and CONNECT_DB as local variables in promote_app_role function 2026-03-12 18:38:04 -05:00
None
52ed0fc15a fix: run PostgreSQL as PUID/PGID user to resolve ownership conflicts (#1078)
PostgreSQL now runs as the PUID/PGID user ($POSTGRES_USER) instead of the internal postgres system user (UID 102). This fixes container startup failures when PUID/PGID is set, caused by chown permission errors on restricted filesystems (NFS root_squash, CIFS) and UID collisions with the postgres system user.

Changes:
- Run all PostgreSQL operations (initdb, pg_ctl, psql) as $POSTGRES_USER
- Auto-detect PUID/PGID from existing data owner when not explicitly set
- Validate PUID/PGID (reject zero, non-numeric values) before startup
- Migrate existing data ownership with sentinel-based skip optimization
- Use trust auth for local Unix sockets, md5 for network connections
- Add promote_app_role() and ensure_app_database() as idempotent startup guarantees that handle fresh installs, upgrades, and PUID changes
- Preserve postgres role as superuser for rollback compatibility
- Centralize /data/db ownership in 02-postgres.sh (sentinel-aware)
- Add integration test suite (20 scenarios) covering fresh installs, upgrades, restarts, PUID changes, UID collisions, bind mounts, modular mode, PG major upgrades, and end-to-end web UI verification
2026-03-11 23:36:32 -05:00
None
6ff81e6287 Fix modular mode deployment issues (#1045)
- Fix Postgres version check failing with restricted DB users (use $POSTGRES_DB instead of hardcoded 'postgres')
- Fix DVR recording broken in modular mode (respect DISPATCHARR_PORT instead of hardcoding 9191)
- Remove flushdb() from wait_for_redis.py to prevent Redis data loss on container restart
- Add DISPATCHARR_PORT to celery environment in docker-compose.yml
- Add depends_on health conditions for proper service startup ordering
- Add extra_hosts for host.docker.internal resolution on Linux
- Harden celery entrypoint with timeouts for JWT wait (120s) and migration wait (300s)
- Replace fragile showmigrations grep with migrate --check
- Add unit tests for DVR port resolution and flushdb removal regression
2026-03-03 17:18:16 -06:00
dekzter
d5349dcf4f create scripts directory 2026-02-26 14:07:34 -05:00
dekzter
6f4665e6eb merged in dev 2026-02-26 08:20:20 -05:00
SergeantPanda
fb8c831f1b
Merge pull request #881 from CodeBormen/fix-modular-compose-deployment
feat: Add DISPATCHARR_ENV=modular support for multi-container deployment
2026-02-03 09:49:07 -06:00
None
762949e983 Update verbiage for consistency 2026-01-31 20:48:54 -06:00
None
8eef088950 Add PostgreSQL version check for modular deployments
Implements automatic version validation for external databases in modular mode to ensure compatibility.

Changes:
- Added check_external_postgres_version() in 02-postgres.sh
- Integrated version check in entrypoint.sh after database connection
- Enforces minimum PostgreSQL version matching DispatcharrBase
- Allows newer versions with forward compatibility notice
- Rejects older versions with clear upgrade instructions

The version requirement automatically scales when DispatcharrBase is updated, requiring no manual maintenance. Only applies to modular deployments using external databases; AIO deployments are unaffected.

Tested and verified correct behavior with PostgreSQL v17, v18, and v16
2026-01-31 20:45:39 -06:00
SergeantPanda
68879ea933 Merge branch 'dev' of https://github.com/Dispatcharr/Dispatcharr into pr/tobimichael96/885 2026-01-30 12:37:07 -06:00
SergeantPanda
a3ed1d9628 Refactor for uv transition. 2026-01-30 12:12:42 -06:00
SergeantPanda
8de22fc44d Indent modular if statement for readability. 2026-01-29 10:22:07 -06:00
dekzter
dba70b3c58 outstanding commits, may revisit later 2026-01-27 15:23:07 -05:00
Matt Grutza
557e192d4c Add UTF8 encoding check for external databases
Extend ensure_utf8_encoding() to support both internal and external PostgreSQL.

- Modular mode: Uses TCP connection with PGPASSWORD authentication
- AIO mode: Uses Unix socket as postgres user
- Explicitly set database owner during recreation (fixes missing --owner flag)
- Conversion logic (dump/drop/recreate/restore) works for both AIO and modular modes
- Skip internal PostgreSQL setup entirely when DISPATCHARR_ENV=modular
2026-01-23 19:15:27 -06:00
Tobias Effner
c698916a60 feat: migrate to UV 2026-01-23 22:45:37 +01:00
Mattias Svensson
cbb8a52163 Fix: nginx startup failure due to group name mismatch
The script was creating a group named 'dispatch' (hardcoded) while
nginx.conf expected a group matching POSTGRES_USER (e.g., 'dispatcharr').

Changes:
- Use $POSTGRES_USER for group name instead of hardcoded 'dispatch'
- Make sed command more robust to match any existing user directive

This ensures the group name matches the user name, fixing the error:
"getgrnam("dispatcharr") failed in /etc/nginx/nginx.conf:1"

Fixes #877

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 08:04:49 +01:00
sethwv-alt
b157159b87
Fix root-owned __pycache__ by running Django commands as non-root user 2025-12-31 12:16:19 -05:00
SergeantPanda
18645fc08f Bug Fix: Re-apply failed merge to fix clients that don't have ipv6 support. 2025-12-22 16:39:09 -06:00
SergeantPanda
20182c7ebf
Merge branch 'main' into dev 2025-12-19 17:53:06 -06:00
SergeantPanda
f0a9a3fc15 Bug Fix: Docker init script now validates DISPATCHARR_PORT is an integer before using it, preventing sed errors when Kubernetes sets it to a service URL like tcp://10.98.37.10:80. Falls back to default port 9191 when invalid (Fixes #737) 2025-12-19 17:00:30 -06:00
dekzter
c51916b40c
Revert "Advanced Filtering" 2025-12-12 08:30:17 -05:00
SergeantPanda
69f9ecd93c Bug Fix: Remove ipv6 binding from nginx config if ipv6 is not available. 2025-12-08 20:12:44 -06:00
SergeantPanda
93f074241d Bug fix/enhancement: Check if we're the owner of /data and set ownership if not. Also pre-create /data/models folder 2025-11-04 09:03:39 -06:00
SergeantPanda
d456051eb3 Verify /app also has the correct permissions. 2025-10-18 19:52:22 -05:00
SergeantPanda
9b07f013a4 Refactor directory creation and ownership management in init script for clarity and maintainability. Will only chown recursively if we are not the owner. This should help improve boot speeds. 2025-10-18 19:33:23 -05:00
SergeantPanda
41d7066d6e Fix incorrect paths for DVR and Plugins. 2025-09-13 11:49:04 -05:00
SergeantPanda
75816b5d8e Change folder creation for Recordings in entrypoint from 'recordings' to 'Recordings' 2025-09-13 09:07:08 -05:00
SergeantPanda
f9a9d5d336 Convert postgres to UTF8 from ASCII 2025-08-02 19:02:57 -05:00
SergeantPanda
406ac37fb9 Delete temp folder if it exists during upgrade. 2025-07-31 15:01:28 -05:00
SergeantPanda
108a992643 Detect mismatched Postgres version and automatically run pg_upgrade 2025-07-31 14:53:55 -05:00
SergeantPanda
14c3944578 Don't hardcode dispatch as user for nginx. Use postgres_user. 2025-05-14 10:19:55 -05:00
SergeantPanda
cecc057ea4 Make sure we can change render group gid to match host and capture errors so we don't crash server. 2025-05-14 09:32:24 -05:00
SergeantPanda
0a9250c3d5 Vastly improved logic for detecting recommended acceleration methods. 2025-05-13 12:32:49 -05:00
SergeantPanda
dd54a13bdd Fix script exiting entrypoint if no devices were found. 2025-05-13 00:37:07 -05:00
SergeantPanda
40765ed46d One more attempt at proper intel detection. 2025-05-12 21:19:43 -05:00
SergeantPanda
bb73da1cb9 Fixes invalid regex detection for intel gpu models. 2025-05-12 20:55:35 -05:00
SergeantPanda
08493321dd Fixes intel devices not matching correctly for libva_driver recommendations. 2025-05-12 20:27:38 -05:00
SergeantPanda
0953e044b7 Huge improvement to hardware acceleration script. Renamed for accuracy. 2025-05-12 19:46:23 -05:00
SergeantPanda
634d16d402 Improved logic for assigned GID's and group memberships for video and render groups. 2025-05-12 17:23:10 -05:00
SergeantPanda
9f1d382472 Don't force GID for render group. 2025-05-12 16:02:24 -05:00
SergeantPanda
da9a78c875 Only write LIBVA_DRIVER_NAME to dispatcharr.sh if it's set by the user. 2025-05-12 13:16:15 -05:00
SergeantPanda
3a06b12f2c Hopefully fixes QSV hardware acceleration. 2025-05-11 12:45:57 -05:00
SergeantPanda
3a4631e9ad Add extra note if model isn't detected. 2025-05-10 16:51:42 -05:00
SergeantPanda
3c1157d330 Enhance user group verification messages to include the username for clarity 2025-05-10 16:45:01 -05:00