From 028c71e5a99a66930bee86f6bcbd6d9dc82ae50c Mon Sep 17 00:00:00 2001 From: Michael Sloan <89812914+Michael-A-Sloan@users.noreply.github.com> Date: Mon, 23 Nov 2026 21:47:54 -0500 Subject: [PATCH] Add a Private Community Apps template for the Fluxer stack. Unraid Apps installs one container, so the template supervises the official compose bundle instead of pretending Fluxer is a single image. --- .gitattributes | 2 ++ README.md | 35 ++++++++++++++++++-- docs/WORKING-NOTES.md | 16 ++++++++-- scripts/ca-bootstrap.sh | 58 ++++++++++++++++++++++++++++++++++ scripts/install-ca-template.sh | 43 +++++++++++++++++++++++++ unraid/fluxer.xml | 55 ++++++++++++++++++++++++++++++++ unraid/icon.svg | 5 +++ 7 files changed, 210 insertions(+), 4 deletions(-) create mode 100644 scripts/ca-bootstrap.sh create mode 100644 scripts/install-ca-template.sh create mode 100644 unraid/fluxer.xml create mode 100644 unraid/icon.svg diff --git a/.gitattributes b/.gitattributes index 68165a0..c8ffaa7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,5 @@ *.yml text eol=lf *.md text eol=lf *.conf text eol=lf +*.xml text eol=lf +*.svg text eol=lf diff --git a/README.md b/README.md index e8e4147..791c214 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,40 @@ docker compose version You want 2.24 or newer. -## Install +## Install from Community Apps -Run this on the Unraid server, not on your PC. Do not clone onto the USB flash drive (`/boot`). +Unraid's public app catalog only indexes GitHub, so this template is a Private app on your server. It shows up in the Apps tab after the template is copied onto the flash drive. One container, `fluxer-stack`, then starts the real Fluxer compose stack. + +On the Unraid terminal: + +```bash +mkdir -p /boot/config/plugins/community.applications/private/fluxer +curl -fsSL -o /boot/config/plugins/community.applications/private/fluxer/fluxer.xml \ + https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid/raw/main/unraid/fluxer.xml +``` + +If you already cloned this repo on the server, `sh scripts/install-ca-template.sh` copies that same file. + +Then: + +1. Open **Apps** and refresh the page. +2. Open **Private** and install **fluxer-stack**. +3. Set **Hostname** to your real domain. Leave **Edge mode** at `proxy` when Nginx Proxy Manager, SWAG, or Traefik already uses ports 80 and 443. +4. Apply. + +The supervisor clones this repo into `/mnt/user/appdata/fluxer-selfhost`, stores Fluxer's data in `/mnt/user/appdata/fluxer`, and publishes the web UI on port **18080**. Stopping `fluxer-stack` stops Fluxer. Starting it brings Fluxer back. + +The setup token is in the supervisor log path and in this file: + +```bash +awk -F= '$1=="FLUXER_SETUP_TOKEN"{print $2}' /mnt/user/appdata/fluxer-selfhost/stack/.env +``` + +Point the proxy at `http://YOUR_UNRAID_IP:18080` and use [unraid/npm-advanced.conf](unraid/npm-advanced.conf). Forward TCP 7881 and UDP 7882 for voice. The other `fluxer-*` containers belong to Compose. Leave them alone. + +## Install from the Unraid terminal + +Use this when you would rather not put a supervisor container in front of Compose. Run it on the Unraid server, not on your PC. Do not clone onto the USB flash drive (`/boot`). ```bash mkdir -p /mnt/user/appdata diff --git a/docs/WORKING-NOTES.md b/docs/WORKING-NOTES.md index 29cd6ad..34c7749 100644 --- a/docs/WORKING-NOTES.md +++ b/docs/WORKING-NOTES.md @@ -163,7 +163,7 @@ The bundle was downloaded and read before the override was written, so the volum - No domain, LAN IP, proxy brand, RAM size, or CGNAT fact was supplied. The script takes the domain as an argument. Proxy mode is the default. Nothing was invented for DNS. - Email, Stripe, ClamAV, Cloudflare cache purge, extra voice regions, and an external S3 bucket are in the environment page and were left at the bundle defaults (off or empty). - `rust-server.compose.yml` collapses the Rust services into one container and might use less RAM. It was not turned on. Combining it with the Unraid volume file needs a `docker compose config` against that exact release before it is the default. -- No Community Apps template, no `rexctl` install, no copy of Fluxer's images into a private registry. +- No `rexctl` install, and no copy of Fluxer's images into a private registry. The Community Apps entry uses the public `docker:28-cli` image only as a supervisor. ## How to extend this without making a mess @@ -172,8 +172,20 @@ The bundle was downloaded and read before the override was written, so the volum - Do not commit `stack/.env`, `stack/`, or `backups/`. They hold the database keys and the admin setup token. - If the install is later handed to `rexctl`, point `rexctl takeover` at `stack/` and keep the same project name. +## Community Apps + +The Apps tab does not accept a custom repository URL. That setting was removed in Unraid 6.10. The public catalog at ca.unraid.net only scans a public GitHub repo with `ca_profile.xml`. This project lives on Gitea, so the template is installed into the server's Private list: + +`/boot/config/plugins/community.applications/private/fluxer/fluxer.xml` + +Community Apps can only create one container per template. Fluxer is a compose project of about twenty containers, so the template does not pretend that `fluxer-api` alone is the product. `fluxer-stack` is `docker:28-cli` with the Docker socket mounted. Its command installs git and openssl, downloads `scripts/ca-bootstrap.sh`, clones this repo, and runs `prepare-unraid.sh` through the host engine. Paths inside the container match the host paths, because Compose sends those paths to the host daemon. Stopping the supervisor sends SIGTERM, and the script's trap runs `docker compose stop`. + +The socket mount is root on the Docker engine. That is the trade for having Start and Stop in the Apps and Docker pages. The terminal install further down in the README does not need it. + +`bash` is required for `prepare-unraid.sh`. Alpine's `sh` is not bash, so the bootstrap calls `bash` on purpose. `coreutils` is installed first so `sort -V` in the Compose version check exists. + ## Publishing Target remote: `https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid` public. -On 2026-11-23, before the first push, `https://git.masengr.com/` returned HTTP 502 for the site, `/api/v1/version`, and `git ls-remote` of the existing Neon Sign Converter repo. A 502 is the host being down, not a missing repository. Push again once that URL returns something other than 502. +On 2026-11-23 the site first returned HTTP 502, so the first push did not run. A later check returned HTTP 200 for the site. The repository URL was still 404 because nothing had been pushed. diff --git a/scripts/ca-bootstrap.sh b/scripts/ca-bootstrap.sh new file mode 100644 index 0000000..6df034f --- /dev/null +++ b/scripts/ca-bootstrap.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +# Runs inside the fluxer-stack container from the Community Apps template. +# Clones this repo onto the Unraid host, prepares the official compose bundle, +# and starts it through the host Docker socket. Stopping this container stops +# the Fluxer stack. Starting it brings the stack back. + +set -euo pipefail + +REPO_URL="${FLUXER_REPO_URL:-https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid.git}" +ROOT="${FLUXER_REPO:-/mnt/user/appdata/fluxer-selfhost}" +APPDATA="${FLUXER_APPDATA:-/mnt/user/appdata/fluxer}" +DOMAIN="${FLUXER_DOMAIN:-}" +MODE="$(printf '%s' "${FLUXER_MODE:-proxy}" | tr '[:upper:]' '[:lower:]')" +STACK="" + +stop_stack() { + if [[ -n "$STACK" && -f "$STACK/docker-compose.yml" ]]; then + echo "Stopping the Fluxer compose stack." + docker compose --project-directory "$STACK" stop || true + fi + exit 0 +} + +if [[ -z "$DOMAIN" || "$DOMAIN" == "chat.example.com" ]]; then + echo "Set FLUXER_DOMAIN to your real hostname, not chat.example.com, then start this container again." >&2 + exit 1 +fi + +case "$MODE" in + proxy|direct) ;; + *) + echo "FLUXER_MODE must be proxy or direct. It is: $MODE" >&2 + exit 1 + ;; +esac + +mkdir -p "$ROOT" "$APPDATA" + +if [[ ! -f "$ROOT/scripts/prepare-unraid.sh" ]]; then + echo "Cloning $REPO_URL into $ROOT" + git clone --depth 1 "$REPO_URL" "$ROOT" +fi + +STACK="$ROOT/stack" +export FLUXER_ALLOW_ANY_PATH=1 +export FLUXER_APPDATA="$APPDATA" +export FLUXER_STACK="$STACK" + +echo "Preparing Fluxer for $DOMAIN ($MODE)" +bash "$ROOT/scripts/prepare-unraid.sh" "$DOMAIN" "--$MODE" +docker compose --project-directory "$STACK" up -d + +echo "Fluxer is up. This container stays running so Unraid shows the app as started." +echo "The setup token is FLUXER_SETUP_TOKEN in $STACK/.env" +trap stop_stack TERM INT +while true; do + sleep 3600 +done diff --git a/scripts/install-ca-template.sh b/scripts/install-ca-template.sh new file mode 100644 index 0000000..c3c59b6 --- /dev/null +++ b/scripts/install-ca-template.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# Copy the Fluxer template into Community Apps' Private folder, and into the +# Docker template dropdown. Run this on the Unraid server. +set -euo pipefail + +cd "$(dirname "$0")/.." + +SRC="unraid/fluxer.xml" +PRIVATE_DIR="/boot/config/plugins/community.applications/private/fluxer" +PRIVATE="${PRIVATE_DIR}/fluxer.xml" +USER_DIR="/boot/config/plugins/dockerMan/templates-user" +USER="${USER_DIR}/my-fluxer.xml" + +if [[ ! -f "$SRC" ]]; then + echo "Missing $SRC" >&2 + exit 1 +fi + +if [[ ! -d /boot/config/plugins ]]; then + echo "Unraid flash config was not found. Run this on the Unraid server." >&2 + exit 1 +fi + +first="$(head -n 1 "$SRC")" +if [[ "$first" != '' ]]; then + echo "Template does not start with an XML declaration." >&2 + exit 1 +fi + +mkdir -p "$PRIVATE_DIR" "$USER_DIR" +cp "$SRC" "$PRIVATE" +cp "$SRC" "$USER" + +echo "Installed:" +echo " $PRIVATE" +echo " $USER" +echo +echo "Next:" +echo " 1. Open Apps and refresh the page." +echo " 2. Open the Private section and install Fluxer Stack." +echo " 3. Set FLUXER_DOMAIN to your hostname, then Apply." +echo +echo "The Docker page template dropdown also lists my-fluxer after a refresh." diff --git a/unraid/fluxer.xml b/unraid/fluxer.xml new file mode 100644 index 0000000..515d6a2 --- /dev/null +++ b/unraid/fluxer.xml @@ -0,0 +1,55 @@ + + + fluxer-stack + Self-hosted Fluxer chat for Unraid. This app is the supervisor. It clones the installer, downloads Fluxer's official compose bundle, and starts the stack. Chat is served to your existing proxy on port 18080. Voice uses TCP 7881 and UDP 7882. + + Network:Messenger + https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid/raw/main/unraid/icon.svg + http://[IP]:18080/ + https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid/raw/main/unraid/fluxer.xml + https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid + https://hub.docker.com/_/docker + docker:28-cli + bridge + + sh + false + https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid + Host Docker socket. The supervisor uses it to run the Fluxer compose stack. + --entrypoint /bin/sh + -c 'apk add --no-cache bash git curl openssl coreutils && curl -fsSL https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid/raw/main/scripts/ca-bootstrap.sh -o /tmp/ca-bootstrap.sh && bash /tmp/ca-bootstrap.sh' + + + + + false + false + + + false + + proxy + /mnt/user/appdata/fluxer + /mnt/user/appdata/fluxer-selfhost + /var/run/docker.sock + /mnt/user/appdata/fluxer + /mnt/user/appdata/fluxer-selfhost + diff --git a/unraid/icon.svg b/unraid/icon.svg new file mode 100644 index 0000000..605dd99 --- /dev/null +++ b/unraid/icon.svg @@ -0,0 +1,5 @@ + + + + +