6 Commits

Author SHA1 Message Date
benvin c4d4dd75a7 Merge pull request 'Repin UPSTREAM_REF to jellyfin-ha-src main' (#13) from benvin/jellyfin-v0.3.2 into main
ci/woodpecker/tag/docker Pipeline was successful
Reviewed-on: #13
2026-09-13 21:06:33 +10:00
unkin-agent 521ef065ca Repin UPSTREAM_REF to jellyfin-ha-src main
ci/woodpecker/pr/build Pipeline was successful
Picks up cross-replica auth read-through, bare Jellyfin__ env config,
the min(uuid) anti-join fix for browse/search/Recently Added, and
scan-leader gating tied to Redis configuration.
2026-09-13 20:25:42 +10:00
benvin e103b57e97 Merge pull request 'fix: make plugin sync safe for concurrent replica starts' (#12) from benvin/fix-plugin-sync-race into main
Reviewed-on: #12
2026-09-13 18:57:11 +10:00
unkin-agent e0a195179b fix: make plugin sync safe for concurrent replica starts
ci/woodpecker/pr/build Pipeline was successful
Two replicas starting together on the shared /config volume race the
unconditional rm+cp, so one dies with a permission error or a plugin
UnauthorizedAccessException. Skip the sync once the correct version
is already present, stage new/changed versions and move them into
place with an atomic rename, and treat a lost rename race or an
already-removed stale version as success rather than failure.
2026-09-13 18:49:52 +10:00
benvin 64b6c01e91 Merge pull request 'build: repin UPSTREAM_REF to fixed PostgreSQL upgrade path' (#10) from benvin/jellyfin-v0.3.1 into main
ci/woodpecker/tag/docker Pipeline was successful
Reviewed-on: #10
2026-09-12 18:17:41 +10:00
unkin-agent c8960dbe82 build: repin UPSTREAM_REF to fixed PostgreSQL upgrade path
ci/woodpecker/pr/build Pipeline was successful
v0.3.0 shipped a regenerated initial migration that broke upgrades
on existing Postgres databases. Pin the fork commit restoring the
baseline plus forward migrations and the EncoderPreset fallback.
2026-09-12 18:09:24 +10:00
2 changed files with 49 additions and 10 deletions
+1 -1
View File
@@ -1 +1 @@
dcb6ae396cc43ffc080bca6405cb95e7abc4445f
ec581b5e5f156edb862d01f4bd07d9ba51903ed6
+48 -9
View File
@@ -1,24 +1,63 @@
#!/bin/sh
# Sync image-baked plugins into the /config (datadir) plugins directory on every
# start. /config is a PVC that overlays the image, so plugins baked into the
# image are invisible until copied in here. Removing any existing versioned dir
# of the same plugin first lets the image version win across restarts/downgrades.
# Sync image-baked plugins into the /config (datadir) plugins directory on
# start. /config is an RWX volume shared across replicas, so plugins baked
# into the image are invisible until copied in here -- and this must be safe
# when several replicas start (or restart) at the same instant:
# - skip entirely once the correct version is already in place, so the
# steady state (almost every start) never touches the shared volume;
# - install a new/changed version via copy-to-staging + atomic rename, so
# no reader (another replica, or this container's own jellyfin process)
# ever observes a partially-written plugin directory. A replica that
# loses the rename race just discards its own copy -- that's success,
# not an error;
# - drop stale, differently-versioned copies of the same plugin afterwards
# so they don't shadow the current one. Best-effort: another replica may
# already be doing, or have finished, the same cleanup.
# Deliberately no locking: a lock held by a replica that dies mid-sync would
# wedge every future start on this volume, which is worse than the race it
# would prevent.
set -eu
BAKED_DIR=/usr/share/jellyfin/plugins-baked
PLUGIN_DIR=/config/plugins
STAGING_DIR="$PLUGIN_DIR/.sync-tmp"
REPLICA=$(hostname)
if [ -d "$BAKED_DIR" ]; then
mkdir -p "$PLUGIN_DIR"
mkdir -p "$PLUGIN_DIR" "$STAGING_DIR"
for src in "$BAKED_DIR"/*; do
[ -d "$src" ] || continue
name=$(basename "$src") # e.g. "LDAP Authentication_22.0.0.0"
name=$(basename "$src") # e.g. "LDAP Authentication_24.0.0.0"
base=${name%_*} # plugin name without the trailing _<version>
target="$PLUGIN_DIR/$name"
if [ ! -d "$target" ]; then
# Build the new version privately (keyed by this replica's own
# hostname, so concurrent replicas never share a staging path), then
# move it into place in one atomic rename. mv -T fails with
# "Directory not empty" if another replica's rename already won --
# that's fine, our copy just becomes garbage we discard.
staging="$STAGING_DIR/$REPLICA.$name"
rm -rf "$staging"
cp -a "$src" "$staging"
if mv_err=$(mv -T "$staging" "$target" 2>&1); then
:
elif [ -d "$target" ]; then
rm -rf "$staging"
else
echo "docker-entrypoint: failed to install plugin $name: $mv_err" >&2
exit 1
fi
fi
# Remove any other version of this plugin so it can't shadow the one
# above. Another replica may be racing the same cleanup, or have already
# finished it -- an entry that's already gone is success, not an error.
for existing in "$PLUGIN_DIR/$base"_*; do
[ -e "$existing" ] && rm -rf "$existing"
[ -e "$existing" ] || continue
[ "$existing" = "$target" ] && continue
rm -rf "$existing" 2>/dev/null || true
done
rm -rf "$PLUGIN_DIR/$name"
cp -a "$src" "$PLUGIN_DIR/$name"
done
fi