diff --git a/maintainerr/CHANGELOG.md b/maintainerr/CHANGELOG.md new file mode 100644 index 000000000..4e7782de4 --- /dev/null +++ b/maintainerr/CHANGELOG.md @@ -0,0 +1,8 @@ +# Changelog + +## 3.0.1 + +- Initial release of Maintainerr addon +- Based on upstream image `ghcr.io/maintainerr/maintainerr:3.0.1` +- Persistent data stored in HA addon config directory +- Supports amd64 and aarch64 architectures diff --git a/maintainerr/Dockerfile b/maintainerr/Dockerfile new file mode 100644 index 000000000..7be52aa33 --- /dev/null +++ b/maintainerr/Dockerfile @@ -0,0 +1,137 @@ +#============================# +# ALEXBELGIUM'S DOCKERFILE # +#============================# +# _.------. +# _.-` ('>.-`"""-. +# '.--'` _'` _ .--.) +# -' '-.-';` ` +# ' - _.' ``'--. +# '---` .-'""` +# /` +#=== Home Assistant Addon ===# + +# ARGs used in FROM must be declared before any FROM instruction +ARG BUILD_UPSTREAM="3.0.1" + +############################ +# 0) Tools stage # +############################ +# Build a small payload with gosu (for privilege dropping) and its shared libs +FROM alpine:3.22 AS ha_tools + +RUN apk add --no-cache \ + gosu \ + pax-utils + +RUN set -eux; \ + mkdir -p /out; \ + for bin in /usr/bin/gosu; do \ + mkdir -p "/out$(dirname "$bin")"; \ + cp -a "$bin" "/out$bin"; \ + lddtree -l "$bin" | while read -r dep; do \ + case "$dep" in \ + /lib/ld-musl-*.so.1) \ + continue ;; \ + /*) \ + mkdir -p "/out$(dirname "$dep")"; \ + cp -a "$dep" "/out$(dirname "$dep")/"; \ + ;; \ + esac; \ + done; \ + done + +################# +# 1 Build Image # +################# + +ARG BUILD_FROM +ARG BUILD_VERSION +FROM ghcr.io/maintainerr/maintainerr:${BUILD_UPSTREAM} + +################## +# 2 Modify Image # +################## + +USER root + +# Bring in gosu from tools stage +COPY --from=ha_tools /out/ / + +################## +# 3 Install apps # +################## + +# Add rootfs +COPY rootfs/ / +RUN chmod +x /entrypoint.sh \ + && find /etc/cont-init.d /etc/cont-finish.d -type f -name "*.sh" -exec chmod +x {} \; 2>/dev/null || true + +# Install bashio standalone +RUN BASHIO_VERSION="0.14.3" && \ + mkdir -p /tmp/bashio && \ + curl -f -L -s -S "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" | tar -xzf - --strip 1 -C /tmp/bashio && \ + mv /tmp/bashio/lib /usr/lib/bashio && \ + ln -s /usr/lib/bashio/bashio /usr/bin/bashio && \ + rm -rf /tmp/bashio + +# Modules +ARG MODULES="00-banner.sh 01-custom_script.sh" + +# Automatic modules download +ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/ha_automodules.sh" "/ha_automodules.sh" +RUN chmod 744 /ha_automodules.sh && /ha_automodules.sh "$MODULES" && rm /ha_automodules.sh + +################ +# 4 Entrypoint # +################ + +ADD "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/bashio-standalone.sh" "/usr/local/lib/bashio-standalone.sh" +RUN chmod 0755 /usr/local/lib/bashio-standalone.sh + +# Use our wrapper as entrypoint (replaces original /opt/app/start.sh) +ENTRYPOINT [ "/usr/bin/env" ] +CMD [ "/ha_entrypoint.sh" ] + +############ +# 5 Labels # +############ + +ARG BUILD_ARCH +ARG BUILD_DATE +ARG BUILD_DESCRIPTION +ARG BUILD_NAME +ARG BUILD_REF +ARG BUILD_REPOSITORY +ARG BUILD_VERSION +ENV BUILD_VERSION="${BUILD_VERSION}" +LABEL \ + io.hass.name="${BUILD_NAME}" \ + io.hass.description="${BUILD_DESCRIPTION}" \ + io.hass.arch="${BUILD_ARCH}" \ + io.hass.type="addon" \ + io.hass.version=${BUILD_VERSION} \ + maintainer="alexbelgium (https://github.com/alexbelgium)" \ + org.opencontainers.image.title="${BUILD_NAME}" \ + org.opencontainers.image.description="${BUILD_DESCRIPTION}" \ + org.opencontainers.image.vendor="Home Assistant Add-ons" \ + org.opencontainers.image.authors="alexbelgium (https://github.com/alexbelgium)" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.url="https://github.com/alexbelgium" \ + org.opencontainers.image.source="https://github.com/${BUILD_REPOSITORY}" \ + org.opencontainers.image.documentation="https://github.com/${BUILD_REPOSITORY}/blob/main/README.md" \ + org.opencontainers.image.created=${BUILD_DATE} \ + org.opencontainers.image.revision=${BUILD_REF} \ + org.opencontainers.image.version=${BUILD_VERSION} + +################# +# 6 Healthcheck # +################# + +ENV HEALTH_PORT="6246" \ + HEALTH_URL="" +HEALTHCHECK \ + --interval=5s \ + --retries=5 \ + --start-period=60s \ + --timeout=25s \ + CMD curl -A "HealthCheck: Docker/1.0" -s -f "http://127.0.0.1:${HEALTH_PORT}${HEALTH_URL}" &>/dev/null || exit 1 diff --git a/maintainerr/README.md b/maintainerr/README.md new file mode 100644 index 000000000..8654b452a --- /dev/null +++ b/maintainerr/README.md @@ -0,0 +1,43 @@ +# Home Assistant Add-on: Maintainerr + +_"Looks and smells like Overseerr, does the opposite."_ + +Maintainerr is a rule-based media management tool for your Plex, Jellyfin, or Emby ecosystem. It creates smart collections based on configurable rules (watched status, age, ratings, ...) and can optionally delete unwatched content to keep your library clean. + +## About + +Maintainerr integrates with: +- **Plex / Jellyfin / Emby** — media server +- **Sonarr / Radarr** — to remove media files +- **Overseerr / Jellyseerr** — to reset requests +- **Tautulli** — for advanced watch statistics + +## Installation + +1. Add the repository to Home Assistant. +2. Install the **Maintainerr** add-on. +3. Start the add-on. +4. Open the Web UI on port `6246`. + +## Configuration + +| Option | Description | +|--------|-------------| +| `TZ` | Timezone (e.g. `Europe/Paris`). Defaults to `Europe/London`. | +| `env_vars` | Extra environment variables passed to the container. | + +### Available extra env vars + +| Variable | Default | Description | +|----------|---------|-------------| +| `UI_PORT` | `6246` | Change the listening port | +| `BASE_PATH` | _(empty)_ | Serve under a URL subpath | + +## Data + +Persistent data (database, configuration) is stored in the HA addon config directory and survives add-on updates and reinstalls. + +## Support + +- [Maintainerr upstream project](https://github.com/maintainerr/maintainerr) +- [Addon repository issues](https://github.com/alexbelgium/hassio-addons/issues) diff --git a/maintainerr/apparmor.txt b/maintainerr/apparmor.txt new file mode 100644 index 000000000..cebe37e41 --- /dev/null +++ b/maintainerr/apparmor.txt @@ -0,0 +1,66 @@ +#include + +profile maintainerr_addon flags=(attach_disconnected,mediate_deleted) { + #include + + capability, + file, + signal, + mount, + umount, + remount, + network udp, + network tcp, + network dgram, + network stream, + network inet, + network inet6, + network netlink raw, + network unix dgram, + + capability setgid, + capability setuid, + capability sys_admin, + capability dac_read_search, + # capability dac_override, + # capability sys_rawio, + +# S6-Overlay + /init ix, + /run/{s6,s6-rc*,service}/** ix, + /package/** ix, + /command/** ix, + /run/{,**} rwk, + /dev/tty rw, + /bin/** ix, + /usr/bin/** ix, + /usr/lib/bashio/** ix, + /etc/s6/** rix, + /run/s6/** rix, + /etc/services.d/** rwix, + /etc/cont-init.d/** rwix, + /etc/cont-finish.d/** rwix, + /init rix, + /var/run/** mrwkl, + /var/run/ mrwkl, + /dev/i2c-1 mrwkl, + # Files required + /dev/fuse mrwkl, + /dev/sda1 mrwkl, + /dev/sdb1 mrwkl, + /dev/nvme0 mrwkl, + /dev/nvme1 mrwkl, + /dev/mmcblk0p1 mrwkl, + /dev/* mrwkl, + /tmp/** mrkwl, + + # Data access + /data/** rw, + + # suppress ptrace denials when using 'docker ps' or using 'ps' inside a container + ptrace (trace,read) peer=docker-default, + + # docker daemon confinement requires explict allow rule for signal + signal (receive) set=(kill,term) peer=/usr/bin/docker, + +} diff --git a/maintainerr/build.json b/maintainerr/build.json new file mode 100644 index 000000000..51daa2cdf --- /dev/null +++ b/maintainerr/build.json @@ -0,0 +1,6 @@ +{ + "build_from": { + "aarch64": "ghcr.io/maintainerr/maintainerr:latest", + "amd64": "ghcr.io/maintainerr/maintainerr:latest" + } +} diff --git a/maintainerr/config.yaml b/maintainerr/config.yaml new file mode 100644 index 000000000..2d7a8c31f --- /dev/null +++ b/maintainerr/config.yaml @@ -0,0 +1,91 @@ +arch: + - aarch64 + - amd64 +description: + Rule-based media cleanup tool for Plex, Jellyfin and Emby. Creates collections and optionally deletes unwatched content. +devices: + - /dev/dri + - /dev/dri/card0 + - /dev/dri/card1 + - /dev/dri/renderD128 + - /dev/vchiq + - /dev/video10 + - /dev/video11 + - /dev/video12 + - /dev/video13 + - /dev/video14 + - /dev/video15 + - /dev/video16 + - /dev/ttyUSB0 + - /dev/sda + - /dev/sdb + - /dev/sdc + - /dev/sdd + - /dev/sde + - /dev/sdf + - /dev/sdg + - /dev/nvme + - /dev/nvme0 + - /dev/nvme0n1 + - /dev/nvme0n1p1 + - /dev/nvme0n1p2 + - /dev/nvme0n1p3 + - /dev/nvme1n1 + - /dev/nvme1n1p1 + - /dev/nvme1n1p2 + - /dev/nvme1n1p3 + - /dev/nvme2n1 + - /dev/nvme2n1p1 + - /dev/nvme2n1p2 + - /dev/nvme2n3p3 + - /dev/mmcblk + - /dev/fuse + - /dev/sda1 + - /dev/sdb1 + - /dev/sdc1 + - /dev/sdd1 + - /dev/sde1 + - /dev/sdf1 + - /dev/sdg1 + - /dev/sda2 + - /dev/sdb2 + - /dev/sdc2 + - /dev/sdd2 + - /dev/sde2 + - /dev/sdf2 + - /dev/sdg2 + - /dev/sda3 + - /dev/sdb3 + - /dev/sda4 + - /dev/sdb4 + - /dev/sda5 + - /dev/sda6 + - /dev/sda7 + - /dev/sda8 + - /dev/nvme0 + - /dev/nvme1 + - /dev/nvme2 +image: ghcr.io/alexbelgium/maintainerr-{arch} +ingress: true +ingress_stream: true +init: false +panel_icon: mdi:movie-search +map: + - addon_config:rw +name: Maintainerr +options: + env_vars: [] + TZ: Europe/London +ports: + 6246/tcp: 6246 +ports_description: + 6246/tcp: Web interface +schema: + env_vars: + - name: match(^[A-Za-z0-9_]+$) + value: str? + TZ: str? +slug: maintainerr +url: https://github.com/alexbelgium/hassio-addons/tree/master/maintainerr +version: "3.0.1" +webui: "[PROTO:ssl]://[HOST]:[PORT:6246]" diff --git a/maintainerr/icon.png b/maintainerr/icon.png new file mode 100644 index 000000000..087a0caea Binary files /dev/null and b/maintainerr/icon.png differ diff --git a/maintainerr/logo.png b/maintainerr/logo.png new file mode 100644 index 000000000..087a0caea Binary files /dev/null and b/maintainerr/logo.png differ diff --git a/maintainerr/rootfs/etc/cont-init.d/99-run.sh b/maintainerr/rootfs/etc/cont-init.d/99-run.sh new file mode 100644 index 000000000..ba0dbe693 --- /dev/null +++ b/maintainerr/rootfs/etc/cont-init.d/99-run.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# shellcheck shell=bash +set -e + +############################################################################### +# Home Assistant Addon entrypoint for Maintainerr +# Runs cont-init.d scripts then drops privileges and starts the app. +############################################################################### + +# ─── Source standalone bashio if available ─────────────────────────────────── +if [ -f /usr/local/lib/bashio-standalone.sh ]; then + # shellcheck disable=SC1091 + source /usr/local/lib/bashio-standalone.sh +fi + +# ─── Run cont-init.d scripts ───────────────────────────────────────────────── +if [ -d /etc/cont-init.d ]; then + for script in /etc/cont-init.d/*.sh; do + [ -f "$script" ] || continue + echo "[Maintainerr] Running init script: $script" + # Use bash directly (no S6 with-contenv available) + bash "$script" + done +fi + +# ─── Setup persistent data directory ───────────────────────────────────────── +# /opt/data is a Docker VOLUME in the upstream image and cannot be removed. +# Maintainerr supports the DATA_DIR env var to redirect data storage. +DATA_DIR="/config" +echo "[Maintainerr] Setting up data directory: $DATA_DIR" +mkdir -p "$DATA_DIR" +# Only chown on first run to avoid slow startup on large directories +if [ ! -f "$DATA_DIR/.initialized" ]; then + chown -R node:node "$DATA_DIR" + touch "$DATA_DIR/.initialized" +fi +export DATA_DIR + +# ─── Start Maintainerr as unprivileged node user ───────────────────────────── +echo "[Maintainerr] Starting application on port ${UI_PORT:-6246}..." +exec gosu node /opt/app/start.sh diff --git a/maintainerr/updater.json b/maintainerr/updater.json new file mode 100644 index 000000000..423360397 --- /dev/null +++ b/maintainerr/updater.json @@ -0,0 +1,8 @@ +{ + "last_update": "2026-03-03", + "repository": "alexbelgium/hassio-addons", + "slug": "maintainerr", + "source": "github", + "upstream_repo": "maintainerr/maintainerr", + "upstream_version": "3.0.1" +}