Add an Unraid plugin with a Settings page for Fluxer.

The stack can be installed from a plugin URL and started from Settings, the same shape as other Unraid plugin installers.
This commit is contained in:
Michael Sloan committed 2026-11-23 22:03:04 -05:00
1 parent 028c71e5a9
commit a19983df7b
10 files changed
+437 -9

No files matched your search

+2
View File
@@ -5,3 +5,5 @@
*.conf text eol=lf
*.xml text eol=lf
*.svg text eol=lf
*.plg text eol=lf
*.page text eol=lf
+23 -2
View File
@@ -30,9 +30,30 @@ docker compose version
You want 2.24 or newer.
## Install from Community Apps
## Install the plugin
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.
This is the same kind of install as a Settings-page plugin. It is not listed in the public Apps catalog until that catalog accepts the repository. The plugin URL works now.
1. Install Docker Compose 2.24 or newer. Unraid 7 includes it. On older Unraid, install Compose Manager from Apps.
2. Open **Plugins → Install Plugin**.
3. Paste this URL and install:
```text
https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid/raw/main/fluxer.plg
```
4. Open **Settings → Fluxer**.
5. Enter your hostname. Leave mode on **proxy** when Nginx Proxy Manager, SWAG, or Traefik already uses ports 80 and 443.
6. Click **Start**. The first image download takes several minutes. Refresh the page to read the log.
7. Click **Show token**, open the site, and create the admin account.
Proxy mode serves Fluxer at `http://YOUR_UNRAID_IP:18080`. Point the proxy at that address and use [unraid/npm-advanced.conf](unraid/npm-advanced.conf). Forward TCP 7881 and UDP 7882 for voice. **Stop** stops the stack and keeps the data. Removing the plugin also keeps `/mnt/user/appdata/fluxer`.
Copy `/mnt/user/appdata/fluxer/stack/.env` somewhere safe after the first start. The Postgres password, Meilisearch key, and VAPID keys cannot be changed after Fluxer has created its data.
## Install from Community Apps Private
The public catalog does not index this Gitea repository. A Docker template can still show under **Apps → Private** on your server. One container, `fluxer-stack`, then starts the real Fluxer compose stack.
On the Unraid terminal:
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<CommunityApplications>
<Profile>Unraid is a registered trademark of Lime Technology, Inc. This installer is not affiliated with Lime Technology or Fluxer.
Fluxer installer with a Settings page. It runs the official Fluxer Compose bundle. The web app can sit behind an existing reverse proxy on port 18080. Calls use TCP 7881 and UDP 7882. Report installer issues in the project repository.</Profile>
<Icon>https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid/raw/main/unraid/icon.svg</Icon>
<WebPage>https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid</WebPage>
<Forum>https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid</Forum>
</CommunityApplications>
+9 -7
View File
@@ -172,17 +172,19 @@ 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
## Community Apps and the plugin
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:
`https://github.com/mvandenbulcke/fluxer-unraid` is an Unraid plugin. Its `.plg` is installed from **Plugins → Install Plugin**, and the package adds **Settings → Fluxer**. Community Applications submission for that project was still pending review. A GitHub release does not by itself create an Apps search hit.
`/boot/config/plugins/community.applications/private/fluxer/fluxer.xml`
This repository now has the same install shape, aimed at the proxy setup already documented here:
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`.
- `fluxer.plg` is the package URL.
- `plugin/Fluxer.page` is the Settings page.
- `templates/fluxer.xml` and `ca_profile.xml` are the catalog files a Community Applications scan expects. The public catalog indexes GitHub. This project is on Gitea, so those files do not put it in the worldwide Apps list by themselves.
- Start and Stop call `scripts/prepare-unraid.sh` on the Unraid host. There is no Docker socket container in this path.
- The older `unraid/fluxer.xml` Docker template remains a Private Apps option.
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.
The plugin does not copy that other project's Cloudflare Tunnel or Traefik setup. Proxy mode still binds port 18080 for the reverse proxy already running on the server.
## Publishing
+80
View File
@@ -0,0 +1,80 @@
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE PLUGIN [
<!ENTITY name "fluxer">
<!ENTITY author "Michael Sloan">
<!ENTITY version "2026.11.23.1">
<!ENTITY launch "Settings/Fluxer">
<!ENTITY gitURL "https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid">
<!ENTITY rawURL "&gitURL;/raw/main">
<!ENTITY pluginURL "&rawURL;/fluxer.plg">
<!ENTITY support "&gitURL;">
]>
<PLUGIN name="&name;" author="&author;" version="&version;" launch="&launch;" pluginURL="&pluginURL;" icon="&rawURL;/unraid/icon.svg" support="&support;" min="6.12.0">
<CHANGES>
### 2026.11.23.1
- Settings, Fluxer page to save a domain and start or stop the official Compose bundle.
- Web UI listens on port 18080 for an existing reverse proxy. Direct HTTPS is optional.
- Voice still needs TCP 7881 and UDP 7882 forwarded to this server.
</CHANGES>
<FILE Run="/bin/bash">
<INLINE>
<![CDATA[
#!/bin/bash
mkdir -p /usr/local/emhttp/plugins/fluxer/scripts \
/usr/local/emhttp/plugins/fluxer/unraid \
/boot/config/plugins/fluxer
]]>
</INLINE>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/fluxer/Fluxer.page">
<URL>&rawURL;/plugin/Fluxer.page</URL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/fluxer/icon.svg">
<URL>&rawURL;/unraid/icon.svg</URL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/fluxer/scripts/common.sh">
<URL>&rawURL;/plugin/scripts/common.sh</URL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/fluxer/scripts/start.sh">
<URL>&rawURL;/plugin/scripts/start.sh</URL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/fluxer/scripts/stop.sh">
<URL>&rawURL;/plugin/scripts/stop.sh</URL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/fluxer/scripts/prepare-unraid.sh">
<URL>&rawURL;/scripts/prepare-unraid.sh</URL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/fluxer/scripts/update-unraid.sh">
<URL>&rawURL;/scripts/update-unraid.sh</URL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/fluxer/scripts/backup-unraid.sh">
<URL>&rawURL;/scripts/backup-unraid.sh</URL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/fluxer/unraid/docker-compose.unraid.yml">
<URL>&rawURL;/unraid/docker-compose.unraid.yml</URL>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/fluxer/unraid/npm-advanced.conf">
<URL>&rawURL;/unraid/npm-advanced.conf</URL>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
<![CDATA[
#!/bin/bash
chmod 755 /usr/local/emhttp/plugins/fluxer/scripts/*.sh
]]>
</INLINE>
</FILE>
<FILE Run="/bin/bash" Method="remove">
<INLINE>
<![CDATA[
#!/bin/bash
rm -rf /usr/local/emhttp/plugins/fluxer
# Appdata and /boot/config/plugins/fluxer/fluxer.cfg are left in place.
]]>
</INLINE>
</FILE>
</PLUGIN>
+208
View File
@@ -0,0 +1,208 @@
Menu="OtherSettings"
Icon="icon.svg"
Title="Fluxer"
---
<?php
$cfg_file = '/boot/config/plugins/fluxer/fluxer.cfg';
$log_file = '/var/log/fluxer-plugin.log';
$plugin_scripts = '/usr/local/emhttp/plugins/fluxer/scripts';
function fluxer_quote(string $value): string
{
return "'" . str_replace("'", "'\\''", $value) . "'";
}
function fluxer_unquote(string $value): string
{
$value = trim($value);
if (strlen($value) >= 2 && $value[0] === "'" && substr($value, -1) === "'") {
return str_replace("'\\''", "'", substr($value, 1, -1));
}
return $value;
}
function fluxer_defaults(): array
{
return [
'DOMAIN' => '',
'MODE' => 'proxy',
'APPDATA' => '/mnt/user/appdata/fluxer',
'STACK' => '/mnt/user/appdata/fluxer/stack',
];
}
function fluxer_read_cfg(string $file): array
{
$cfg = fluxer_defaults();
if (!is_file($file)) {
return $cfg;
}
foreach (file($file, FILE_IGNORE_NEW_LINES) as $line) {
if (!str_contains($line, '=')) {
continue;
}
[$key, $value] = explode('=', $line, 2);
if (array_key_exists($key, $cfg)) {
$cfg[$key] = fluxer_unquote($value);
}
}
return $cfg;
}
function fluxer_valid_domain(string $domain): bool
{
return (bool) preg_match('/^[A-Za-z0-9]([A-Za-z0-9.-]*[A-Za-z0-9])?$/', $domain);
}
function fluxer_valid_path(string $path): bool
{
return str_starts_with($path, '/mnt/') && !str_contains($path, '..') && !str_starts_with($path, '/boot');
}
function fluxer_write_cfg(string $file, array $cfg): void
{
$dir = dirname($file);
if (!is_dir($dir)) {
mkdir($dir, 0700, true);
}
$body = '';
foreach (['DOMAIN', 'MODE', 'APPDATA', 'STACK'] as $key) {
$body .= $key . '=' . fluxer_quote($cfg[$key]) . "\n";
}
$tmp = $file . '.tmp';
file_put_contents($tmp, $body);
rename($tmp, $file);
}
function fluxer_post_ok(): bool
{
if (($_SERVER['REQUEST_METHOD'] ?? '') !== 'POST') {
return false;
}
$expected = $_SESSION['csrf_token'] ?? '';
if ($expected === '') {
return true;
}
$got = $_POST['csrf_token'] ?? '';
return is_string($got) && hash_equals($expected, $got);
}
function fluxer_setup_token(string $env_file): string
{
if (!is_file($env_file)) {
return '';
}
foreach (file($env_file, FILE_IGNORE_NEW_LINES) as $line) {
if (str_starts_with($line, 'FLUXER_SETUP_TOKEN=')) {
return substr($line, strlen('FLUXER_SETUP_TOKEN='));
}
}
return '';
}
$cfg = fluxer_read_cfg($cfg_file);
$notice = '';
$error = '';
$token = '';
$action = $_POST['action'] ?? '';
if ($action !== '' && !fluxer_post_ok()) {
$error = 'The form expired. Reload the page and try again.';
$action = '';
}
if ($action === 'Save' || $action === 'Start' || $action === 'Show token') {
$cfg['DOMAIN'] = trim($_POST['domain'] ?? '');
$cfg['MODE'] = trim($_POST['mode'] ?? 'proxy');
$cfg['APPDATA'] = trim($_POST['appdata'] ?? $cfg['APPDATA']);
$cfg['STACK'] = trim($_POST['stack'] ?? $cfg['STACK']);
if (($action === 'Start' || $cfg['DOMAIN'] !== '') && !fluxer_valid_domain($cfg['DOMAIN'])) {
$error = 'Domain must be a hostname such as chat.example.com, with no https:// and no path.';
} elseif ($cfg['MODE'] !== 'proxy' && $cfg['MODE'] !== 'direct') {
$error = 'Mode must be proxy or direct.';
} elseif (!fluxer_valid_path($cfg['APPDATA']) || !fluxer_valid_path($cfg['STACK'])) {
$error = 'Data and stack paths must stay under /mnt and off the USB flash drive.';
} else {
fluxer_write_cfg($cfg_file, $cfg);
$notice = 'Saved.';
}
}
if ($error === '' && $action === 'Start') {
$cmd = 'nohup /bin/bash ' . escapeshellarg($plugin_scripts . '/start.sh') . ' >/dev/null 2>&1 &';
exec($cmd);
$notice = 'Start is running. The first image download takes several minutes. Refresh this page for the log.';
}
if ($error === '' && $action === 'Stop') {
$cmd = 'nohup /bin/bash ' . escapeshellarg($plugin_scripts . '/stop.sh') . ' >/dev/null 2>&1 &';
exec($cmd);
$notice = 'Stop is running. Refresh this page for the log. Data is kept.';
}
if ($error === '' && $action === 'Show token') {
$token = fluxer_setup_token($cfg['STACK'] . '/.env');
if ($token === '') {
$error = 'No setup token yet. Start Fluxer once, then show the token again.';
}
}
$csrf = $_SESSION['csrf_token'] ?? '';
$ps = '';
if (is_file($cfg['STACK'] . '/docker-compose.yml')) {
$lines = [];
exec('docker compose --project-directory ' . escapeshellarg($cfg['STACK']) . ' ps 2>&1', $lines);
$ps = implode("\n", $lines);
}
$log = '';
if (is_file($log_file)) {
$all = file($log_file, FILE_IGNORE_NEW_LINES);
$log = implode("\n", array_slice($all, -40));
}
?>
<form method="post" autocomplete="off">
<input type="hidden" name="csrf_token" value="<?=htmlspecialchars($csrf, ENT_QUOTES)?>">
<p>This page installs the official Fluxer Compose bundle. Proxy mode serves plain HTTP on port <b>18080</b> for Nginx Proxy Manager, SWAG, or Traefik. Forward <b>TCP 7881</b> and <b>UDP 7882</b> to this server for voice and video.</p>
<?php if ($notice !== ''): ?><p><?=htmlspecialchars($notice, ENT_QUOTES)?></p><?php endif; ?>
<?php if ($error !== ''): ?><p><b><?=htmlspecialchars($error, ENT_QUOTES)?></b></p><?php endif; ?>
<table>
<tr>
<td>Hostname</td>
<td><input type="text" name="domain" value="<?=htmlspecialchars($cfg['DOMAIN'], ENT_QUOTES)?>" placeholder="chat.example.com" style="width:24em"></td>
</tr>
<tr>
<td>Mode</td>
<td>
<select name="mode">
<option value="proxy" <?php if ($cfg['MODE'] === 'proxy') echo 'selected'; ?>>proxy (port 18080)</option>
<option value="direct" <?php if ($cfg['MODE'] === 'direct') echo 'selected'; ?>>direct (ports 80 and 443)</option>
</select>
</td>
</tr>
<tr>
<td>Data path</td>
<td><input type="text" name="appdata" value="<?=htmlspecialchars($cfg['APPDATA'], ENT_QUOTES)?>" style="width:32em"></td>
</tr>
<tr>
<td>Stack path</td>
<td><input type="text" name="stack" value="<?=htmlspecialchars($cfg['STACK'], ENT_QUOTES)?>" style="width:32em"></td>
</tr>
</table>
<p>
<input type="submit" name="action" value="Save">
<input type="submit" name="action" value="Start">
<input type="submit" name="action" value="Stop">
<input type="submit" name="action" value="Show token">
</p>
</form>
<?php if ($token !== ''): ?>
<p>Setup token. It is also <code>FLUXER_SETUP_TOKEN</code> in the stack <code>.env</code>. Copy the <code>.env</code> file somewhere safe before you rely on this server.</p>
<pre><?=htmlspecialchars($token, ENT_QUOTES)?></pre>
<?php endif; ?>
<?php if ($cfg['DOMAIN'] !== ''): ?>
<p>Public address: <a href="https://<?=htmlspecialchars($cfg['DOMAIN'], ENT_QUOTES)?>" target="_blank">https://<?=htmlspecialchars($cfg['DOMAIN'], ENT_QUOTES)?></a></p>
<?php endif; ?>
<h3>Stack</h3>
<pre><?=htmlspecialchars($ps !== '' ? $ps : 'Not started yet.', ENT_QUOTES)?></pre>
<h3>Log</h3>
<pre><?=htmlspecialchars($log !== '' ? $log : 'No log yet.', ENT_QUOTES)?></pre>
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Shared paths for the Fluxer Unraid plugin. Source this file. Do not execute it.
CFG=/boot/config/plugins/fluxer/fluxer.cfg
PLUGIN_ROOT=/usr/local/emhttp/plugins/fluxer
LOG=/var/log/fluxer-plugin.log
LOCK=/var/run/fluxer-plugin.lock
fluxer_load_cfg() {
DOMAIN=""
MODE="proxy"
APPDATA="/mnt/user/appdata/fluxer"
STACK="/mnt/user/appdata/fluxer/stack"
if [[ -f "$CFG" ]]; then
# shellcheck disable=SC1090
source "$CFG"
fi
}
fluxer_valid_domain() {
[[ "$1" =~ ^[A-Za-z0-9]([A-Za-z0-9.-]*[A-Za-z0-9])?$ ]]
}
fluxer_valid_path() {
local path="$1"
[[ "$path" == /mnt/* && "$path" != /boot && "$path" != /boot/* && "$path" != *..* ]]
}
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Start Fluxer from the saved Settings page values.
set -euo pipefail
source /usr/local/emhttp/plugins/fluxer/scripts/common.sh
mkdir -p "$(dirname "$LOG")" "$(dirname "$LOCK")"
exec 9>"$LOCK"
if ! flock -n 9; then
echo "A Fluxer start or stop is already running."
exit 0
fi
exec >>"$LOG" 2>&1
echo "=== $(date -u +%Y-%m-%dT%H:%M:%SZ) start ==="
fluxer_load_cfg
if ! fluxer_valid_domain "$DOMAIN"; then
echo "Set a real hostname on Settings, Fluxer before starting. Current value: ${DOMAIN:-empty}"
exit 1
fi
if ! fluxer_valid_path "$APPDATA" || ! fluxer_valid_path "$STACK"; then
echo "Data and stack paths must be under /mnt and not on the USB flash drive."
exit 1
fi
case "$MODE" in
proxy|direct) ;;
*)
echo "Mode must be proxy or direct."
exit 1
;;
esac
export FLUXER_APPDATA="$APPDATA"
export FLUXER_STACK="$STACK"
bash "$PLUGIN_ROOT/scripts/prepare-unraid.sh" "$DOMAIN" "--$MODE" --up
echo "=== $(date -u +%Y-%m-%dT%H:%M:%SZ) start finished ==="
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# Stop the Fluxer compose project without deleting its data.
set -euo pipefail
source /usr/local/emhttp/plugins/fluxer/scripts/common.sh
mkdir -p "$(dirname "$LOG")" "$(dirname "$LOCK")"
exec 9>"$LOCK"
if ! flock -n 9; then
echo "A Fluxer start or stop is already running."
exit 0
fi
exec >>"$LOG" 2>&1
echo "=== $(date -u +%Y-%m-%dT%H:%M:%SZ) stop ==="
fluxer_load_cfg
if [[ ! -f "$STACK/docker-compose.yml" ]]; then
echo "No stack at $STACK yet."
exit 0
fi
docker compose --project-directory "$STACK" stop
echo "=== $(date -u +%Y-%m-%dT%H:%M:%SZ) stop finished ==="
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Plugin>
<Name>Fluxer for Unraid</Name>
<PluginAuthor>Michael Sloan</PluginAuthor>
<PluginURL>https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid/raw/main/fluxer.plg</PluginURL>
<Project>https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid</Project>
<Support>https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid</Support>
<Overview>Unraid is a registered trademark of Lime Technology, Inc. This installer is not affiliated with Lime Technology or Fluxer.
Settings page for a self-hosted Fluxer instance. It downloads the official Docker Compose bundle, stores data under /mnt/user/appdata/fluxer, and starts the stack. Proxy mode serves the web app on port 18080 for an existing reverse proxy. Direct mode uses ports 80 and 443.
Calls need router forwards for TCP 7881 and UDP 7882. Removing the plugin keeps existing containers and data.</Overview>
<Category>Network:Messenger</Category>
<Icon>https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid/raw/main/unraid/icon.svg</Icon>
<ReadMe>https://git.masengr.com/Michael-A-Sloan/Fluxer-selfhost-unraid</ReadMe>
<Beta>true</Beta>
<MinVer>6.12.0</MinVer>
<MaxVer>7.99.99</MaxVer>
</Plugin>