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:
1 parent
028c71e5a9
commit
a19983df7b
10 files changed
+437
-9
No files matched your search
@@ -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" != *..* ]]
|
||||
}
|
||||
@@ -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 ==="
|
||||
@@ -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 ==="
|
||||
Reference in new issue
Block a user