mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-13 02:51:27 +02:00
Update paperless-ngx addon to 2.20.15 and realign with upstream s6-overlay
Upstream paperless-ngx switched to an s6-overlay v3 init system at v2.15.0 (ENTRYPOINT ["/init"]) and removed the legacy /sbin/docker-entrypoint.sh that this add-on patched. The add-on had therefore been broken since the 2.15.x bump. - Inject initialization via S6_STAGE2_HOOK=/ha_entrypoint.sh instead of patching the now-removed upstream entrypoint - Export runtime variables to the s6 container_environment so the upstream supervised services (svc-webserver, svc-worker, svc-scheduler, svc-consumer) pick them up - Use the canonical ha_entrypoint.sh template (remove the outdated bundled copy) - Add 00-global_var module + jq for env_vars passthrough - Guard the ImageMagick policy patch and the optional nginx/redis startup - Bump version and updater tracking to 2.20.15
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
## 2.20.15 (2026-06-05)
|
||||
- Update to latest version from paperless-ngx/paperless-ngx (changelog : https://github.com/paperless-ngx/paperless-ngx/releases)
|
||||
- Realign the add-on with upstream's s6-overlay v3 init system: upstream removed the legacy `/sbin/docker-entrypoint.sh`, so initialization is now injected through the s6 stage-2 hook (`S6_STAGE2_HOOK=/ha_entrypoint.sh`) and runtime variables are exported to the s6 container environment that feeds the supervised services (svc-webserver, svc-worker, svc-scheduler, svc-consumer)
|
||||
- Added support for configuring extra environment variables via the `env_vars` add-on option alongside config.yaml. See https://github.com/alexbelgium/hassio-addons/wiki/Add-Environment-variables-to-your-Addon-2 for details.
|
||||
|
||||
## 2.15.1 (2025-04-12)
|
||||
|
||||
@@ -45,14 +45,16 @@ RUN if [ ! -f /bin/sh ] && [ -f /usr/bin/sh ]; then ln -s /usr/bin/sh /bin/sh; f
|
||||
if [ ! -f /bin/bash ] && [ -f /usr/bin/bash ]; then ln -s /usr/bin/bash /bin/bash; fi
|
||||
|
||||
# Modules
|
||||
ARG MODULES="00-banner.sh 00-local_mounts.sh 00-smb_mounts.sh 01-custom_script.sh"
|
||||
ARG MODULES="00-banner.sh 00-global_var.sh 00-local_mounts.sh 00-smb_mounts.sh 01-custom_script.sh"
|
||||
|
||||
# Automatic modules download
|
||||
COPY ha_automodules.sh /ha_automodules.sh
|
||||
RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_automodules.sh
|
||||
|
||||
# Manual apps
|
||||
ENV PACKAGES="redis-server"
|
||||
# redis-server: paperless-ngx expects an external broker, provided by this add-on
|
||||
# jq: required by the 00-global_var module for env_vars passthrough
|
||||
ENV PACKAGES="redis-server jq"
|
||||
|
||||
# Automatic apps & bashio
|
||||
COPY ha_autoapps.sh /ha_autoapps.sh
|
||||
@@ -63,22 +65,21 @@ RUN chmod 744 /ha_autoapps.sh && /ha_autoapps.sh "$PACKAGES" && rm /ha_autoapps.
|
||||
################
|
||||
|
||||
# Add entrypoint
|
||||
#ENV S6_STAGE2_HOOK=/ha_entrypoint.sh
|
||||
#COPY ha_entrypoint.sh /ha_entrypoint.sh
|
||||
# Upstream paperless-ngx ships an s6-overlay v3 init (ENTRYPOINT ["/init"]) and no
|
||||
# longer provides /sbin/docker-entrypoint.sh, so initialization is injected through
|
||||
# the s6 stage-2 hook instead of patching the upstream entrypoint.
|
||||
ENV S6_STAGE2_HOOK=/ha_entrypoint.sh
|
||||
COPY ha_entrypoint.sh /ha_entrypoint.sh
|
||||
RUN chmod 777 /ha_entrypoint.sh
|
||||
|
||||
# Install bashio
|
||||
COPY bashio-standalone.sh /usr/local/lib/bashio-standalone.sh
|
||||
RUN chmod 0755 /usr/local/lib/bashio-standalone.sh
|
||||
|
||||
# Add custom scripts
|
||||
RUN sed -i "2a source /ha_entrypoint.sh" /sbin/docker-entrypoint.sh && \
|
||||
sed -i "s=/\.=source =g" /ha_entrypoint.sh && \
|
||||
sed -i "s=env bash=env bashio=g" /sbin/docker-entrypoint.sh
|
||||
|
||||
RUN \
|
||||
# Activate imagemagick
|
||||
sed -i "s/rights=\"none\"/rights=\"read|write\"/g" /etc/ImageMagick-6/policy.xml
|
||||
# Activate imagemagick (upstream already ships a paperless policy; guard for safety)
|
||||
RUN if [ -f /etc/ImageMagick-6/policy.xml ]; then \
|
||||
sed -i "s/rights=\"none\"/rights=\"read|write\"/g" /etc/ImageMagick-6/policy.xml; \
|
||||
fi
|
||||
|
||||
#ENTRYPOINT [ "/usr/bin/env" ]
|
||||
#CMD [ "/ha_entrypoint.sh" ]
|
||||
|
||||
@@ -130,5 +130,5 @@ slug: paperless_ng
|
||||
stage: deprecated
|
||||
udev: true
|
||||
url: https://github.com/alexbelgium/hassio-addons
|
||||
version: 2.14.7
|
||||
version: 2.20.15
|
||||
webui: http://[HOST]:[PORT:8000]
|
||||
|
||||
@@ -25,9 +25,13 @@ if bashio::config.has_value "PAPERLESS_MEDIA_ROOT"; then export PAPERLESS_MEDIA_
|
||||
if bashio::config.has_value "PAPERLESS_CONSUMPTION_DIR"; then export PAPERLESS_CONSUMPTION_DIR="$(bashio::config "PAPERLESS_CONSUMPTION_DIR")"; fi
|
||||
if bashio::config.has_value "PAPERLESS_EXPORT_DIR"; then export PAPERLESS_EXPORT_DIR="$(bashio::config "PAPERLESS_EXPORT_DIR")"; fi
|
||||
|
||||
# Redis is provided by this add-on (paperless-ngx expects an external broker)
|
||||
export PAPERLESS_REDIS="redis://localhost:6379"
|
||||
|
||||
# Create folder and permissions if needed
|
||||
chown -R paperless:paperless /config
|
||||
chown -R paperless:paperless /config || true
|
||||
for variable in "$PAPERLESS_DATA_DIR" "$PAPERLESS_MEDIA_ROOT" "$PAPERLESS_CONSUMPTION_DIR" "$PAPERLESS_EXPORT_DIR"; do
|
||||
[ -z "$variable" ] && continue
|
||||
echo "Creating directory \"$variable\""
|
||||
mkdir -p "$variable"
|
||||
chmod -R 755 "$variable"
|
||||
@@ -77,8 +81,20 @@ esac
|
||||
|
||||
set +u
|
||||
|
||||
#############################
|
||||
# Export to s6 environment #
|
||||
#############################
|
||||
|
||||
# Upstream now runs on s6-overlay v3: variables are shared with the supervised
|
||||
# services (svc-webserver, svc-worker, ...) by writing them to the s6
|
||||
# container_environment, which is read by `with-contenv` when each service starts.
|
||||
S6_ENV_DIR=""
|
||||
for candidate in /var/run/s6/container_environment /run/s6/container_environment; do
|
||||
if [ -d "$candidate" ]; then S6_ENV_DIR="$candidate"; break; fi
|
||||
done
|
||||
|
||||
# For all relevant variables
|
||||
for variable in PAPERLESS_DATA_DIR PAPERLESS_MEDIA_ROOT PAPERLESS_CONSUMPTION_DIR PAPERLESS_EXPORT_DIR USERMAP_UID USERMAP_GID PAPERLESS_TIME_ZONE PAPERLESS_URL PAPERLESS_OCR_LANGUAGES PAPERLESS_OCR_MODE PAPERLESS_ADMIN_PASSWORD PAPERLESS_ADMIN_USER PAPERLESS_DBENGINE PAPERLESS_DBHOST PAPERLESS_DBPORT PAPERLESS_DBNAME PAPERLESS_DBUSER PAPERLESS_DBPASS; do
|
||||
for variable in PAPERLESS_DATA_DIR PAPERLESS_MEDIA_ROOT PAPERLESS_CONSUMPTION_DIR PAPERLESS_EXPORT_DIR USERMAP_UID USERMAP_GID PAPERLESS_TIME_ZONE PAPERLESS_URL PAPERLESS_OCR_LANGUAGES PAPERLESS_OCR_MODE PAPERLESS_ADMIN_PASSWORD PAPERLESS_ADMIN_USER PAPERLESS_REDIS PAPERLESS_DBENGINE PAPERLESS_DBHOST PAPERLESS_DBPORT PAPERLESS_DBNAME PAPERLESS_DBUSER PAPERLESS_DBPASS; do
|
||||
|
||||
# Skip if not defined
|
||||
if [[ -z "$(eval echo "\$$variable")" ]]; then continue; fi
|
||||
@@ -87,12 +103,7 @@ for variable in PAPERLESS_DATA_DIR PAPERLESS_MEDIA_ROOT PAPERLESS_CONSUMPTION_DI
|
||||
variablecontent="$(eval echo "\$$variable")"
|
||||
# Sanitize " ' ` in current variable
|
||||
variablecontent="${variablecontent//[\"\'\`]/}"
|
||||
#if [[ "$variablecontent" = *" "* ]] && [[ "$variable" != "PAPERLESS_OCR_LANGUAGES" ]]; then
|
||||
# variablecontent="\"$variablecontent\""
|
||||
#fi
|
||||
bashio::log.blue "$variable=\"$variablecontent\""
|
||||
# Add to entrypoint
|
||||
sed -i "1a export $variable=\"$variablecontent\"" /sbin/docker-entrypoint.sh
|
||||
# Export
|
||||
export "$variable"="$variablecontent"
|
||||
# Add to bashrc
|
||||
@@ -102,23 +113,35 @@ for variable in PAPERLESS_DATA_DIR PAPERLESS_MEDIA_ROOT PAPERLESS_CONSUMPTION_DI
|
||||
# set /etc/environment
|
||||
mkdir -p /etc
|
||||
echo "$variable=\"$variablecontent\"" >> /etc/environment
|
||||
# For s6
|
||||
if [ -d /var/run/s6/container_environment ]; then printf "%s" "${variablecontent}" > /var/run/s6/container_environment/"${variable}"; fi
|
||||
# For s6 (read by the upstream supervised services via with-contenv)
|
||||
if [ -n "$S6_ENV_DIR" ]; then printf "%s" "${variablecontent}" > "$S6_ENV_DIR/${variable}"; fi
|
||||
done
|
||||
|
||||
#################
|
||||
# Staring redis #
|
||||
#################
|
||||
exec redis-server &
|
||||
bashio::log.info "Starting redis"
|
||||
if command -v redis-server > /dev/null 2>&1; then
|
||||
bashio::log.info "Starting redis"
|
||||
redis-server &
|
||||
else
|
||||
bashio::log.fatal "redis-server is not installed; paperless-ngx requires it as broker"
|
||||
fi
|
||||
|
||||
#################
|
||||
# Staring nginx #
|
||||
#################
|
||||
exec nginx &
|
||||
bashio::log.info "Starting nginx"
|
||||
# nginx is only used for the optional SSL endpoint (port 8443). The web UI is
|
||||
# served directly by the upstream svc-webserver on port 8000 regardless.
|
||||
if command -v nginx > /dev/null 2>&1; then
|
||||
bashio::log.info "Starting nginx"
|
||||
nginx &
|
||||
else
|
||||
bashio::log.warning "nginx not installed; skipping the optional SSL proxy (the web UI stays available on port 8000)"
|
||||
fi
|
||||
|
||||
###############
|
||||
################
|
||||
# Starting app #
|
||||
###############
|
||||
################
|
||||
# The upstream s6-overlay init (svc-webserver, svc-worker, svc-scheduler,
|
||||
# svc-consumer, svc-flower) is started by s6 once this stage-2 hook returns.
|
||||
bashio::log.info "Initial username and password are admin. Please change in the administration panel of the webUI after login."
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/command/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
echo "Starting..."
|
||||
|
||||
####################
|
||||
# Starting scripts #
|
||||
####################
|
||||
|
||||
for SCRIPTS in /etc/cont-init.d/*; do
|
||||
[ -e "$SCRIPTS" ] || continue
|
||||
echo "$SCRIPTS: executing"
|
||||
|
||||
# Check if run as root
|
||||
if test "$(id -u)" == 0 && test "$(id -u)" == 0; then
|
||||
chown "$(id -u)":"$(id -g)" "$SCRIPTS"
|
||||
chmod a+x "$SCRIPTS"
|
||||
else
|
||||
bashio::log.warning "Script executed with user $(id -u):$(id -g), things can break and chown won't work"
|
||||
# Disable chown and chmod in scripts
|
||||
sed -i "s/^chown /true # chown /g" "$SCRIPTS"
|
||||
sed -i "s/ chown / true # chown /g" "$SCRIPTS"
|
||||
sed -i "s/^chmod /true # chmod /g" "$SCRIPTS"
|
||||
sed -i "s/ chmod / true # chmod /g" "$SCRIPTS"
|
||||
fi
|
||||
|
||||
# Get current shebang, if not available use another
|
||||
currentshebang="$(sed -n '1{s/^#![[:blank:]]*//p;q}' "$SCRIPTS")"
|
||||
if [ ! -f "${currentshebang%% *}" ]; then
|
||||
for shebang in "/command/with-contenv bashio" "/usr/bin/env bashio" "/usr/bin/bashio" "/bin/bash" "/bin/sh"; do if [ -f "${shebang%% *}" ]; then break; fi; done
|
||||
sed -i "s|$currentshebang|$shebang|g" "$SCRIPTS"
|
||||
fi
|
||||
|
||||
# Use source to share env variables when requested
|
||||
if [ "${ha_entry_source:-null}" = true ] && command -v "source" &> /dev/null; then
|
||||
# Exit cannot be used with source
|
||||
sed -i "s/(.*\s|^)exit ([0-9]+)/\1 return \2 || exit \2/g" "$SCRIPTS"
|
||||
sed -i "s/bashio::exit.nok/return 1/g" "$SCRIPTS"
|
||||
sed -i "s/bashio::exit.ok/return 0/g" "$SCRIPTS"
|
||||
# shellcheck source=/dev/null
|
||||
source "$SCRIPTS" || echo -e "\033[0;31mError\033[0m : $SCRIPTS exiting $?"
|
||||
else
|
||||
# Support for posix only shell
|
||||
/."$SCRIPTS" || echo -e "\033[0;31mError\033[0m : $SCRIPTS exiting $?"
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
rm "$SCRIPTS"
|
||||
done
|
||||
|
||||
######################
|
||||
# Starting container #
|
||||
######################
|
||||
|
||||
echo " "
|
||||
echo -e "\033[0;32mStarting the upstream container\033[0m"
|
||||
echo " "
|
||||
|
||||
# Launch lsio mods
|
||||
if [ -f /docker-mods ]; then exec /docker-mods; fi
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"github_beta": "false",
|
||||
"github_fulltag": "false",
|
||||
"last_update": "12-04-2025",
|
||||
"last_update": "05-06-2026",
|
||||
"paused": true,
|
||||
"repository": "alexbelgium/hassio-addons",
|
||||
"slug": "paperless_ng",
|
||||
"source": "github",
|
||||
"upstream_repo": "paperless-ngx/paperless-ngx",
|
||||
"upstream_version": "2.15.1"
|
||||
"upstream_version": "2.20.15"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user