Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c88e6d76c8 | |||
| e6e847598a | |||
| f150d915f5 | |||
| b43e10f752 | |||
| c4d4dd75a7 | |||
| 521ef065ca | |||
| e103b57e97 | |||
| e0a195179b |
+9
-7
@@ -27,7 +27,7 @@ RUN apt-get update \
|
|||||||
# Versions are the newest each plugin publishes whose targetAbi <= the pinned
|
# Versions are the newest each plugin publishes whose targetAbi <= the pinned
|
||||||
# Jellyfin server version (12.0.0):
|
# Jellyfin server version (12.0.0):
|
||||||
# LDAP Authentication 24.0.0.0 targetAbi 12.0.0.0
|
# LDAP Authentication 24.0.0.0 targetAbi 12.0.0.0
|
||||||
# SSO Authentication 4.0.0.4 targetAbi 10.11.0.0 (newest release; loads on 12.0)
|
# SSO Authentication 5.0.0.0 targetAbi 12.0.0.0
|
||||||
# sha256 pins make each fetch reproducible.
|
# sha256 pins make each fetch reproducible.
|
||||||
FROM --platform=linux/amd64 debian:bookworm-slim AS plugins
|
FROM --platform=linux/amd64 debian:bookworm-slim AS plugins
|
||||||
|
|
||||||
@@ -37,10 +37,12 @@ RUN apt-get update \
|
|||||||
|
|
||||||
ARG LDAP_URL=http://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/jellyfin/files/plugin/ldap-authentication/ldap-authentication_24.0.0.0.zip
|
ARG LDAP_URL=http://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/jellyfin/files/plugin/ldap-authentication/ldap-authentication_24.0.0.0.zip
|
||||||
ARG LDAP_SHA256=3be1f9d6a6ce9ea375e556dd30136d178a8dbe35cbe866d30d3451dc3ff7e804
|
ARG LDAP_SHA256=3be1f9d6a6ce9ea375e556dd30136d178a8dbe35cbe866d30d3451dc3ff7e804
|
||||||
# LDAP is served through artifactapi remote. SSO is served through the artifactapi
|
# Both are served through artifactapi remotes over http: this stage's base image
|
||||||
# github proxy, which the CI build network can reach (github is not directly reachable).
|
# trusts only public CAs and artifactapi presents an internal-CA certificate, so
|
||||||
ARG SSO_URL=http://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/github/9p4/jellyfin-plugin-sso/releases/download/v4.0.0.4/sso-authentication_4.0.0.4.zip
|
# https here fails to verify. The sha256 pins below supply the integrity guarantee.
|
||||||
ARG SSO_SHA256=c09f16ba31059a434ddd7f811e4f9608d4b4c4514cc80a5bf1ca33bee61e1107
|
# SSO is the in-house unkin fork (valkey-backed OAuth state, shared across replicas).
|
||||||
|
ARG SSO_URL=http://artifactapi.k8s.syd1.au.unkin.net/api/v2/remotes/jellyfin-plugins/files/unkin/jellyfin-plugin-sso/5.0.0.0/sso-authentication_5.0.0.0.zip
|
||||||
|
ARG SSO_SHA256=7e5f09cc4c81dce35edca650d74ed0680f425ca65c6221bb75456de9b8557e14
|
||||||
|
|
||||||
WORKDIR /plugins
|
WORKDIR /plugins
|
||||||
RUN set -eu; \
|
RUN set -eu; \
|
||||||
@@ -50,8 +52,8 @@ RUN set -eu; \
|
|||||||
unzip -oq ldap.zip -d "LDAP Authentication_24.0.0.0"; \
|
unzip -oq ldap.zip -d "LDAP Authentication_24.0.0.0"; \
|
||||||
curl -fsSL "$SSO_URL" -o sso.zip; \
|
curl -fsSL "$SSO_URL" -o sso.zip; \
|
||||||
echo "$SSO_SHA256 sso.zip" | sha256sum -c -; \
|
echo "$SSO_SHA256 sso.zip" | sha256sum -c -; \
|
||||||
mkdir -p "SSO Authentication_4.0.0.4"; \
|
mkdir -p "SSO Authentication_5.0.0.0"; \
|
||||||
unzip -oq sso.zip -d "SSO Authentication_4.0.0.4"; \
|
unzip -oq sso.zip -d "SSO Authentication_5.0.0.0"; \
|
||||||
rm -f ldap.zip sso.zip
|
rm -f ldap.zip sso.zip
|
||||||
|
|
||||||
# ── Runtime stage ─────────────────────────────────────────────────────────────
|
# ── Runtime stage ─────────────────────────────────────────────────────────────
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
10fed9409db4d65a101bdcbadaf86c8f2180a901
|
6691b785c30715ec4561b00b7bd0fd112478d3e3
|
||||||
|
|||||||
+48
-9
@@ -1,24 +1,63 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Sync image-baked plugins into the /config (datadir) plugins directory on every
|
# Sync image-baked plugins into the /config (datadir) plugins directory on
|
||||||
# start. /config is a PVC that overlays the image, so plugins baked into the
|
# start. /config is an RWX volume shared across replicas, so plugins baked
|
||||||
# image are invisible until copied in here. Removing any existing versioned dir
|
# into the image are invisible until copied in here -- and this must be safe
|
||||||
# of the same plugin first lets the image version win across restarts/downgrades.
|
# 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
|
set -eu
|
||||||
|
|
||||||
BAKED_DIR=/usr/share/jellyfin/plugins-baked
|
BAKED_DIR=/usr/share/jellyfin/plugins-baked
|
||||||
PLUGIN_DIR=/config/plugins
|
PLUGIN_DIR=/config/plugins
|
||||||
|
STAGING_DIR="$PLUGIN_DIR/.sync-tmp"
|
||||||
|
REPLICA=$(hostname)
|
||||||
|
|
||||||
if [ -d "$BAKED_DIR" ]; then
|
if [ -d "$BAKED_DIR" ]; then
|
||||||
mkdir -p "$PLUGIN_DIR"
|
mkdir -p "$PLUGIN_DIR" "$STAGING_DIR"
|
||||||
for src in "$BAKED_DIR"/*; do
|
for src in "$BAKED_DIR"/*; do
|
||||||
[ -d "$src" ] || continue
|
[ -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>
|
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
|
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
|
done
|
||||||
rm -rf "$PLUGIN_DIR/$name"
|
|
||||||
cp -a "$src" "$PLUGIN_DIR/$name"
|
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user