### Bring up the whole stack Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.yml.md Use this to start the entire stack on any Docker host. First copy .env.example to .env and edit PUID/PGID/TZ and DATA_ROOT, then run docker compose up -d. ```bash # Bring up the whole stack on any Docker host cp .env.example .env # edit PUID/PGID/TZ and DATA_ROOT docker compose up -d # Targeted rebuild after editing the file docker compose up -d --force-recreate sonarr radarr ``` -------------------------------- ### Install ArrStack on any Docker host with Docker Compose Source: https://github.com/abarbarich/arrstack/blob/main/README.md Clone the repository, copy the environment template, edit PUID/PGID/TZ and DATA_ROOT in .env, then start the stack with docker compose up -d. This is the standard method for any Docker host. ```bash git clone https://github.com/abarbarich/arrstack.git cd arrstack cp .env.example .env # edit PUID/PGID/TZ and DATA_ROOT docker compose up -d ``` -------------------------------- ### Install ArrStack on Proxmox VE host with one command Source: https://github.com/abarbarich/arrstack/blob/main/README.md Run this command on your Proxmox host as root. It creates a Debian 12 LXC (unprivileged, nesting=1), optionally formats a spare disk as ext4 and bind-mounts it, installs Docker and the Compose plugin, drops the stack in /opt/arrstack, generates .env, and runs docker compose up -d. With a terminal you get a whiptail menu; add -y to take defaults for unattended run. ```bash bash -c "$(curl -fsSL https://raw.githubusercontent.com/abarbarich/arrstack/main/arrstack.sh)" ``` -------------------------------- ### Invocation examples for setup-storage.sh Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/setup-storage.sh.md Shows three ways to run the script: interactive disk pick, non-interactive with a specific disk, and binding an existing directory without formatting. The script must be run on the Proxmox VE host. ```bash scripts/setup-storage.sh --ctid 111 # interactive disk pick ``` ```bash scripts/setup-storage.sh --ctid 111 --disk /dev/sdb # non-interactive ``` ```bash scripts/setup-storage.sh --ctid 111 --existing /tank/media # bind, no format ``` -------------------------------- ### Usage example: provisioning with helpers Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Shows a typical provisioning script using helpers: sourcing the library, checking root, verifying docker, printing headers and messages, detecting architecture, fetching a file, and generating a random password. ```bash . ./lib/helpers.sh need_root have docker || die "docker is required" header "Provisioning" msg_info "Detecting architecture" detect_arch echo "apt arch: ${ARCH_DEB}" msg_info "Fetching helper data" fetch "https://example.com/file.tar.gz" /tmp/file.tar.gz || die "download failed" msg_ok "Password: $(rand_alnum 12)" ``` -------------------------------- ### Start stack with VPN overlay via docker compose command Source: https://github.com/abarbarich/arrstack/blob/main/README.md Pass both compose files explicitly to start the stack with the VPN overlay. The Proxmox installer does this automatically with --vpn. ```bash docker compose -f docker-compose.yml -f docker-compose.vpn.yml up -d ``` -------------------------------- ### Start stack with Jellyfin overlay via docker compose command Source: https://github.com/abarbarich/arrstack/blob/main/README.md Run the stack with the Jellyfin overlay to add a media server that reads /data/media from the same local bind mount as the arr apps. ```bash docker compose -f docker-compose.yml -f docker-compose.jellyfin.yml up -d ``` -------------------------------- ### Full runtime .env example Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/configuration.md Example .env file for arrstack runtime configuration. Includes PUID/PGID, timezone, data and config roots, log levels, Compose file overrides, Jellyfin settings, and VPN settings. Note that DATA_ROOT is written as the in-CT path DATA_MP (/data) and CONFIG_ROOT as /opt/arrstack/config because the Compose project runs inside the container. ```ini PUID=1000 PGID=1000 UMASK=002 TZ=Europe/London DATA_ROOT=/data CONFIG_ROOT=/opt/arrstack/config FLARESOLVERR_LOG_LEVEL=info JELLYSEERR_LOG_LEVEL=info COMPOSE_FILE=docker-compose.yml:docker-compose.vpn.yml:docker-compose.jellyfin.yml JELLYFIN_PUBLISHED_URL=http://192.168.1.50:8096 JELLYFIN_TRANSCODE_TMPFS_SIZE=2g VPN_SERVICE_PROVIDER=mullvad VPN_TYPE=wireguard WIREGUARD_PRIVATE_KEY=… WIREGUARD_ADDRESSES=10.64.0.2/32 OPENVPN_USER= OPENVPN_PASSWORD= VPN_SERVER_COUNTRIES= LAN_SUBNET=192.168.0.0/16 ``` -------------------------------- ### Setup storage script usage Source: https://github.com/abarbarich/arrstack/blob/main/README.md Commands to run scripts/setup-storage.sh on the Proxmox host to format and mount a disk for the container. The script refuses to touch the OS disk or mounted/LVM/ZFS/RAID disks, and requires confirmation for destructive formatting. ```bash # interactive: lists only SAFE, blank disks (hides the OS disk + mounted/LVM/ZFS) scripts/setup-storage.sh --ctid 111 # non-interactive: format a specific disk scripts/setup-storage.sh --ctid 111 --disk /dev/sdb -y # or bind an existing directory instead of formatting anything scripts/setup-storage.sh --ctid 111 --existing /tank/media ``` -------------------------------- ### Bind existing ZFS dir and format fresh disk Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/setup-storage.sh.md Two usage examples: the first binds an existing ZFS directory /tank/media into CT 111 at /data with media owner 1000:1000. The second formats a fresh /dev/sdc for CT 111 without prompting (-y) and sets a custom label arrstack-data. ```bash # Bind an existing ZFS dir into CT 111 at /data, media owner 1000:1000 scripts/setup-storage.sh --ctid 111 --existing /tank/media # Format a fresh /dev/sdc for CT 111 without any prompt (-y), custom label scripts/setup-storage.sh --ctid 111 --disk /dev/sdc --label arrstack-data -y ``` -------------------------------- ### Usage example: error handling and safe tag lookup Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Demonstrates error handling patterns: need_root exits 1 with a [x] line on stderr when not root, and github_latest_tag safely returns empty without failing a set -e script. ```bash # Error handling: every failure path exits 1 with a [x] line on stderr . ./lib/helpers.sh if [ "$(id -u)" -ne 0 ]; then need_root # prints "[x] This script must be run as root." and exits 1 fi # A safe tag lookup that can never kill a `set -e` script: latest="$(github_latest_tag abarbarich/arrstack)" # may be empty, never fails ``` -------------------------------- ### Update ArrStack repository: git pull and recreate containers Source: https://github.com/abarbarich/arrstack/blob/main/README.md Run these commands to update the ArrStack compose files and scripts when the repository changes. Only needed when upstream changes, not day to day. If not installed from a clone, re-fetch files or re-run the installer. ```bash cd /opt/arrstack git pull docker compose up -d ``` -------------------------------- ### github_latest_tag() - get latest GitHub release tag Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Fetches the tag_name of the latest non-prerelease release from GitHub API. Always returns 0, even on failure, making it safe under set -e. ```bash github_latest_tag() { local repo="$1" json="" tag="" have curl || return 0 json="$(curl -fsSL "https://api.github.com/repos/${repo}/releases/latest" 2>/dev/null || true)" tag="$(printf '%s\n' "$json" | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p')" tag="${tag%%$'\n'*}" [ -n "$tag" ] && printf '%s\n' "$tag" return 0 } ``` -------------------------------- ### setup_storage() function definition Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/arrstack.sh.md Dispatches to setup-storage.sh for disk and existing storage modes, building arguments (--ctid, --data-mp, --puid, --pgid, --mount-base, optionally --disk / -y, or --existing -y) and execs it. In skip mode, warns and prints a suggested scripts/setup-storage.sh command, leaving storage to the user. ```bash setup_storage() { case "$STORAGE_MODE" in skip) # warns and prints a suggested scripts/setup-storage.sh command ;; disk|existing) # locates scripts/setup-storage.sh (disk or streamed from RAW_BASE), # builds args (--ctid, --data-mp, --puid, --pgid, --mount-base, # optionally --disk / -y, or --existing -y) and execs it ;; esac } ``` -------------------------------- ### Enable VPN overlay via COMPOSE_FILE in .env Source: https://github.com/abarbarich/arrstack/blob/main/README.md Set COMPOSE_FILE in .env to include the VPN overlay so plain 'docker compose up -d' picks it up. This routes only qBittorrent through gluetun; if the VPN drops, the firewall kills torrent traffic. ```ini COMPOSE_FILE=docker-compose.yml:docker-compose.vpn.yml ``` -------------------------------- ### Bind existing directory with VPN and Jellyfin Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/arrstack.sh.md Runs arrstack.sh with --existing to bind /tank/media, plus --vpn and --jellyfin options. ```bash # Bind an existing directory instead of formatting bash arrstack.sh --existing /tank/media --vpn --jellyfin ``` -------------------------------- ### Load lib/helpers.sh from local clone or curl|bash Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Shows two ways to source the library: from a local clone with '. ./lib/helpers.sh', or in a curl|bash context using 'source <(curl -fsSL ...)' as arrstack.sh does. ```bash # from a local clone . ./lib/helpers.sh # or, in a curl|bash context (as arrstack.sh does) source <(curl -fsSL "${RAW_BASE}/lib/helpers.sh") ``` -------------------------------- ### usage() help text Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/arrstack.sh.md Exact help text printed by the usage() function (arrstack.sh:90–112). Lists all CLI options and key environment variables. Shown when -h/--help is passed. ```bash usage() { cat <.conf on the Proxmox host to pass the iGPU into an unprivileged container, then restart the CT. The in-CT user must also be in the group owning /dev/dri/renderD128. ```ini lxc.cgroup2.devices.allow: c 226:* rwm lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir ``` -------------------------------- ### write_file() Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Writes stdin to the specified file path, creating parent directories as needed. Used for unit files and configs. No output; returns cat's status. ```APIDOC ## write_file() ### Description Writes stdin to the specified file path, creating parent directories as needed. Used for unit files and configs. No output; returns cat's status. ### Signature ```bash write_file() { local path="$1" dir; dir="$(dirname "$path")" mkdir -p "$dir" cat > "$path" } ``` ### Parameters - **$1** (path) - Required - Target file path ### Return Value Returns cat's status. No output. ``` -------------------------------- ### need_root() - require root privileges Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Exits with status 1 via die unless the effective UID is 0. No parameters. ```bash need_root() { [ "$(id -u)" -eq 0 ] || die "This script must be run as root."; } ``` -------------------------------- ### interactive_config() function definition Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/arrstack.sh.md Prompts for hostname, cores, RAM, disk, bridge, storage, timezone, DHCP vs static IP, storage mode, VPN and Jellyfin using whiptail. No-ops when ASSUME_YES=1, stdin is not a TTY, or whiptail is absent. Each inputbox is guarded with || exit 1, so cancel exits the script. Hand-entered answers set CT_CORES_PINNED=1 and CT_RAM_PINNED=1. ```bash interactive_config() { [ "$ASSUME_YES" = "1" ] && return 0 [ -t 0 ] || return 0 have whiptail || return 0 # … whiptail prompts for hostname, cores, RAM, disk, bridge, storage, # timezone, DHCP vs static IP, storage mode, VPN and Jellyfin … } ``` -------------------------------- ### Error handling and interactive path Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/setup-storage.sh.md Shows the script's safety checks: it refuses to format /dev/sda because it is the OS disk, mounted, or an LVM/ZFS/RAID member, exiting 1 without modifying anything. Also shows the interactive path when no blank disks are available, prompting to attach a disk or use --existing. ```bash # Error handling: the safety checks refuse unsafe targets before touching them scripts/setup-storage.sh --ctid 111 --disk /dev/sda -y # [x] Refusing to format /dev/sda: it is the OS disk, mounted, or an LVM/ZFS/RAID member. # (exit 1) — nothing was modified. # Interactive path with no blank disks available: scripts/setup-storage.sh --ctid 111 # [x] No safe, unmounted, empty disks found. Attach a disk, or use --existing . ``` -------------------------------- ### qbittorrent service override in docker-compose.vpn.yml Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.overlays.md Overrides the qbittorrent service to share gluetun's network namespace. Uses `network_mode: "service:gluetun"` and `!reset` to clear inherited ports and networks, as a service with network_mode cannot declare its own. All qBittorrent traffic goes through the VPN tunnel. ```yaml qbittorrent: # Share gluetun's network namespace: all qBittorrent traffic goes through # the tunnel. !reset clears the ports/networks inherited from the base file # (a service using network_mode may not declare its own ports or networks). network_mode: "service:gluetun" ports: !reset [] networks: !reset null depends_on: gluetun: condition: service_started ``` -------------------------------- ### is_safe_disk() - Check device safety Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/setup-storage.sh.md Takes a device path as $1 and returns 0 if the device is not the root disk, has no mounted partitions, and has no LVM/ZFS/RAID/LUKS signatures. Returns 1 otherwise. ```bash is_safe_disk() { local dev="$1" [ "$dev" = "$root_disk" ] && return 1 # Any child (or the disk itself) mounted? Part of LVM/raid/crypt? -> unsafe. local mnts fstypes mnts="$(lsblk -rno MOUNTPOINT "$dev" 2>/dev/null | grep -c . || true)" [ "${mnts:-0}" -gt 0 ] && return 1 fstypes="$(lsblk -rno FSTYPE "$dev" 2>/dev/null | grep -iE 'LVM2_member|zfs_member|linux_raid|crypto_LUKS' || true)" [ -n "$fstypes" ] && return 1 return 0 } ``` -------------------------------- ### qbittorrent service definition Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.yml.md Defines the qbittorrent torrent client with WebUI on port 8080 and BitTorrent ports 6881 (TCP and UDP). Mounts config and data volumes. In the VPN overlay, port mappings move to gluetun. ```yaml qbittorrent: <<: *common image: lscr.io/linuxserver/qbittorrent:latest container_name: qbittorrent environment: <<: *common-env WEBUI_PORT: 8080 volumes: - ${CONFIG_ROOT:-./config}/qbittorrent:/config - ${DATA_ROOT:-./data}/torrents:/data/torrents ports: - "8080:8080" # WebUI - "6881:6881" # BitTorrent (TCP) - "6881:6881/udp" # BitTorrent (UDP) networks: [arr] ``` -------------------------------- ### Verify VPN exit IP with docker exec Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.overlays.md Runs wget inside the gluetun container to fetch the public IP from ipinfo.io, showing the VPN exit IP. Useful to confirm the tunnel is active. ```bash docker exec gluetun wget -qO- https://ipinfo.io/ip # shows the VPN exit IP ``` -------------------------------- ### Unattended run with defaults and disk formatting Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/arrstack.sh.md Runs arrstack.sh non-interactively with environment variables for CTID, RAM, cores, timezone, and formats /dev/sdb as the data disk. ```bash # Unattended, defaults from env, format /dev/sdb as the data disk CTID=111 CT_RAM=2048 CT_CORES=2 STACK_TZ=Europe/London \ bash arrstack.sh -y --disk /dev/sdb ``` -------------------------------- ### Jellyfin service configuration in docker-compose.jellyfin.yml Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.overlays.md Defines the jellyfin service with restart policy, logging, image, environment variables, volumes, ports, and commented hardware transcoding options. The media library is mounted read-only, and transcoding uses a tmpfs in RAM. Ports 8096 and 7359/udp are exposed; HTTPS and DLNA are commented out. ```yaml jellyfin: restart: unless-stopped logging: driver: json-file options: max-size: "10m" max-file: "3" image: lscr.io/linuxserver/jellyfin:latest container_name: jellyfin environment: PUID: ${PUID:-1000} PGID: ${PGID:-1000} TZ: ${TZ:-Etc/UTC} UMASK: ${UMASK:-002} # Tells clients found via auto-discovery which URL to actually connect to. JELLYFIN_PublishedServerUrl: ${JELLYFIN_PUBLISHED_URL:-} volumes: - ${CONFIG_ROOT:-./config}/jellyfin:/config # The library, READ-ONLY: Jellyfin never needs to write to it (metadata # and artwork live in /config). Deleting from the Jellyfin UI won't work # — drop the ":ro" if you want that. - ${DATA_ROOT:-./data}/media:/data/media:ro # Transcoding scratch space in RAM: keeps the churn off the disk (and off # an SSD's write budget). Needs headroom — size it to your RAM. - type: tmpfs target: /transcode tmpfs: size: ${JELLYFIN_TRANSCODE_TMPFS_SIZE:-2g} ports: - "8096:8096" # HTTP web UI / API — the one that matters # - "8920:8920" # HTTPS, only if you terminate TLS in Jellyfin - "7359:7359/udp" # client auto-discovery on the LAN # - "1900:1900/udp" # DLNA, only if you enable DLNA in Jellyfin # ── Hardware transcoding ──────────────────────────────────────────────── # devices: # - /dev/dri:/dev/dri # Intel QuickSync / AMD VAAPI (uncomment) # deploy: # resources: # reservations: # devices: # - capabilities: [gpu] # NVIDIA (NVENC) alternative networks: [arr] ``` -------------------------------- ### ensure_sysuser() Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Creates a no-login system user and group idempotently. If the group does not exist, it is created as a system group. If the user does not exist, it is created with the specified home directory and no-login shell. No output; returns the last command's status. ```APIDOC ## ensure_sysuser() ### Description Creates a no-login system user and group idempotently. If the group does not exist, it is created as a system group. If the user does not exist, it is created with the specified home directory and no-login shell. No output; returns the last command's status. ### Signature ```bash ensure_sysuser() { local user="$1" group="${2:-$1}" home="${3:-/var/lib/$1}" getent group "$group" >/dev/null 2>&1 || groupadd --system "$group" if ! getent passwd "$user" >/dev/null 2>&1; then useradd --system --home-dir "$home" --no-create-home \ --shell /usr/sbin/nologin --gid "$group" "$user" fi } ``` ### Parameters - **$1** (string) - Required - User name - **$2** (string) - Optional - Group name (defaults to $1) - **$3** (path) - Optional - Home directory (defaults to /var/lib/$1) ### Return Value Returns the last command's status. No output. ``` -------------------------------- ### Invocation: remote one-liner and local run Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/arrstack.sh.md Shows how to run arrstack.sh either via a remote curl one-liner (default branch 'main') or from a local clone. The script sources lib/helpers.sh from disk when a local clone is detected, otherwise streams it from the repo. ```bash # remote one-liner (installs from the repo, default branch "main") bash -c "$(curl -fsSL https://raw.githubusercontent.com/abarbarich/arrstack/main/arrstack.sh)" # or from a local clone bash arrstack.sh [options] ``` -------------------------------- ### jellyfin_sizing() function definition Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/arrstack.sh.md Raises CT_CORES and CT_RAM to Jellyfin defaults only when the caller did not pin them (CT_CORES_PINNED=0 and CT_RAM_PINNED=0). Warns when CT_RAM is less than 6144 because /transcode tmpfs draws from CT RAM. ```bash jellyfin_sizing() { [ "$JELLYFIN_ENABLED" = "1" ] || return 0 if [ "$CT_CORES_PINNED" = "0" ] && [ "$CT_CORES" -lt "$CT_CORES_JELLYFIN" ]; then CT_CORES="$CT_CORES_JELLYFIN" # … fi if [ "$CT_RAM_PINNED" = "0" ] && [ "$CT_RAM" -lt "$CT_RAM_JELLYFIN" ]; then CT_RAM="$CT_RAM_JELLYFIN" # … fi if [ "$CT_RAM" -lt 6144 ]; then # warns that /transcode tmpfs draws from CT RAM fi } ``` -------------------------------- ### Update Docker apps: pull images and recreate containers Source: https://github.com/abarbarich/arrstack/blob/main/README.md Run these commands to update the Docker images for the ArrStack apps. The config volumes persist, so no data is lost. The image is the version, so ignore the apps' built-in update screens. ```bash cd /opt/arrstack docker compose pull # fetch newer images docker compose up -d # recreate only the containers that changed docker image prune -f # optional: reclaim old image layers ``` -------------------------------- ### next_mp_index() - Find lowest free mountpoint slot Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/setup-storage.sh.md Reads the global CTID variable and returns the lowest mountpoint index (0, 1, ...) not present in 'pct config "$CTID"'. Called at setup-storage.sh:102 and :202. ```bash next_mp_index() { local i=0 while pct config "$CTID" | grep -q "^mp${i}:"; do i=$(( i + 1 )); done printf '%s' "$i" } ``` -------------------------------- ### jellyseerr service definition Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.yml.md Defines the jellyseerr request front-end using the seerr-team/seerr image. Uses init: true, sets LOG_LEVEL, TZ, and PORT 5055, and mounts config volume. ```yaml jellyseerr: <<: *common image: ghcr.io/seerr-team/seerr:latest container_name: jellyseerr init: true environment: LOG_LEVEL: ${JELLYSEERR_LOG_LEVEL:-info} TZ: ${TZ:-Etc/UTC} PORT: 5055 volumes: - ${CONFIG_ROOT:-./config}/jellyseerr:/app/config ports: - "5055:5055" networks: [arr] ``` -------------------------------- ### bazarr service definition Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.yml.md Defines the bazarr subtitle manager. Mounts only the media directory, not the downloads, so it sees only the finished library. ```yaml bazarr: <<: *common image: lscr.io/linuxserver/bazarr:latest container_name: bazarr environment: <<: *common-env volumes: - ${CONFIG_ROOT:-./config}/bazarr:/config - ${DATA_ROOT:-./data}/media:/data/media ports: - "6767:6767" networks: [arr] ``` -------------------------------- ### Update the apps without touching config volumes Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.yml.md Use this to update the applications (image = version) without touching config volumes. Run docker compose pull, then docker compose up -d, and finally docker image prune -f. ```bash # Update the apps (image = version) without touching config volumes docker compose pull docker compose up -d docker image prune -f ``` -------------------------------- ### sonarr service definition Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.yml.md Defines the sonarr service, one of the *arr apps. Mounts the whole DATA_ROOT at /data to enable hardlink imports from /data/torrents to /data/media. ```yaml sonarr: <<: *common image: lscr.io/linuxserver/sonarr:latest container_name: sonarr environment: <<: *common-env volumes: - ${CONFIG_ROOT:-./config}/sonarr:/config - ${DATA_ROOT:-./data}:/data ports: - "8989:8989" networks: [arr] ``` -------------------------------- ### write_file function definition Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Writes stdin to the specified path, creating parent directories first. Used for unit files and configs. No output; returns cat's status. ```bash write_file() { local path="$1" dir; dir="$(dirname "$path")" mkdir -p "$dir" cat > "$path" } ``` -------------------------------- ### header() - print section header Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Prints a section header in bold cyan to stdout, formatted as '== =='. ```bash header() { printf '\n%s%s== %s ==%s\n' "$C_BOLD" "$C_CYN" "$*" "$C_RESET"; } ``` -------------------------------- ### Restart Caddy after editing Caddyfile Source: https://github.com/abarbarich/arrstack/blob/main/docs/SETUP.md Run this command after editing caddy/Caddyfile to apply changes. Requires Docker Compose. ```bash docker compose restart caddy ``` -------------------------------- ### Top-level declarations with YAML anchors Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.yml.md Defines the Compose project name and two YAML anchors: x-common-env for shared LinuxServer.io environment variables (PUID, PGID, TZ, UMASK) with defaults, and x-common for restart and logging policies. These anchors are reused across services. ```yaml name: arrstack # Shared LinuxServer.io environment (PUID/PGID/TZ/UMASK) — anchored once, reused. x-common-env: &common-env PUID: ${PUID:-1000} PGID: ${PGID:-1000} TZ: ${TZ:-Etc/UTC} UMASK: ${UMASK:-002} # Shared restart/logging defaults for every service. x-common: &common restart: unless-stopped logging: driver: json-file options: max-size: "10m" max-file: "3" ``` -------------------------------- ### Network and volumes declarations Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.yml.md Defines the user-defined bridge network 'arr' and two named volumes for Caddy's data and config persistence. ```yaml networks: arr: name: arr driver: bridge volumes: caddy_data: caddy_config: ``` -------------------------------- ### die() - print error and exit Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Prints an error message to stderr using msg_err and exits with status 1. This is the project's single failure primitive. ```bash die() { msg_err "$*"; exit 1; } ``` -------------------------------- ### caddy service definition Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.yml.md Defines the caddy service as an internal reverse proxy for http://<app>.home names. Uses the caddy:2 image, exposes ports 80 and 443, and mounts the Caddyfile and data volumes. ```yaml caddy: <<: *common image: caddy:2 container_name: caddy ports: - "80:80" - "443:443" volumes: - ./caddy/Caddyfile:/etc/caddy/Caddyfile:ro - caddy_data:/data - caddy_config:/config networks: [arr] ``` -------------------------------- ### ensure_sysuser function definition Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Creates a no-login system user and group idempotently. Uses getent to check existence, then groupadd/useradd with system flags. No output; returns the last command's status. ```bash ensure_sysuser() { local user="$1" group="${2:-$1}" home="${3:-/var/lib/$1}" getent group "$group" >/dev/null 2>&1 || groupadd --system "$group" if ! getent passwd "$user" >/dev/null 2>&1; then useradd --system --home-dir "$home" --no-create-home \ --shell /usr/sbin/nologin --gid "$group" "$user" fi } ``` -------------------------------- ### Message formatting functions: msg_info, msg_ok, msg_warn, msg_err Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md These functions print formatted messages with color codes. msg_info and msg_ok write to stdout, while msg_warn and msg_err write to stderr. They accept all arguments joined by spaces as the message text. ```bash msg_info() { printf '%s[i]%s %s\n' "$C_BLU" "$C_RESET" "$*"; } msg_ok() { printf '%s[OK]%s %s\n' "$C_GRN" "$C_RESET" "$*"; } msg_warn() { printf '%s[!]%s %s\n' "$C_YLW" "$C_RESET" "$*" >&2; } msg_err() { printf '%s[x]%s %s\n' "$C_RED" "$C_RESET" "$*" >&2; } ``` -------------------------------- ### have() - check command existence Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Returns 0 if the given command exists on PATH, 1 otherwise. Uses command -v with output suppressed. ```bash have() { command -v "$1" >/dev/null 2>&1; } ``` -------------------------------- ### Caddy reverse proxy route for sonarr.home Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/endpoints.md Representative Caddy site block from caddy/Caddyfile:8–10. It proxies all requests for http://sonarr.home to the sonarr container on port 8989. The http:// prefix prevents Caddy from fetching public TLS certificates. No authentication is enforced at the proxy layer. ```caddy http://sonarr.home { reverse_proxy sonarr:8989 } ``` -------------------------------- ### rand_alnum() - generate random alphanumeric string Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/helpers.sh.md Generates a random alphanumeric string of specified length (default 16). Uses openssl if available, falls back to /dev/urandom. Locale-safe and safe under set -e. ```bash rand_alnum() { local len="${1:-16}" raw="" if have openssl; then raw="$(openssl rand -base64 $(( (len + 2) * 2 )) 2>/dev/null | LC_ALL=C tr -dc 'A-Za-z0-9')" fi if [ "${#raw}" -lt "$len" ]; then raw="$(LC_ALL=C tr -dc 'A-Za-z0-9' </dev/urandom 2>/dev/null | head -c "$((len * 4))" || true)" fi printf '%s' "${raw:0:$len}" } ``` -------------------------------- ### flaresolverr service definition Source: https://github.com/abarbarich/arrstack/blob/main/_autodocs/api-reference/docker-compose.yml.md Defines the flaresolverr service used as a Cloudflare/JS-challenge solver proxy for Prowlarr. Exposes port 8191 and uses configurable log level and timezone. ```yaml flaresolverr: <<: *common image: ghcr.io/flaresolverr/flaresolverr:latest container_name: flaresolverr environment: LOG_LEVEL: ${FLARESOLVERR_LOG_LEVEL:-info} TZ: ${TZ:-Etc/UTC} ports: - "8191:8191" networks: [arr] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.