scripts: FileBrowser volumes controller-managed, remove drive auto-discovery
- docker-setup.sh install_filebrowser(): removed /mnt/* auto-discovery; FileBrowser now installed with no drive volumes. Initial config.yaml written with /srv fallback. Controller's SyncFileBrowserMounts() takes over on first startup and manages volumes/config going forward. - Added ./config.yaml bind mount to initial docker-compose.yml so FileBrowser starts correctly before controller syncs. - Fixed ((step_num++)) → step_num=$(( step_num + 1 )) to prevent set -euo pipefail trap when var starts at 0 (same class of bug as the found_mounts fix in the previous commit). - scripts/README.md: step 7 updated to reflect controller-managed volumes. - CHANGELOG.md: added entry for all scripts changes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,24 @@
|
|||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### scripts — Hub Mode + FileBrowser Controller-Managed Volumes (2026-02-22)
|
||||||
|
|
||||||
|
#### `scripts/docker-setup.sh` — v6.0.0
|
||||||
|
- **Hub mode** (`--hub-customer` / `--hub-password`): downloads `controller.yaml` from Hub API early in setup, extracts `domain`, `email`, `cf_api_token`, `cf_tunnel_token` and auto-populates all infrastructure settings. Single one-liner deploys fully configured Traefik + TLS + Cloudflare Tunnel with no additional flags needed. CLI flags always override hub values.
|
||||||
|
- **`yaml_get()` helper**: strips leading whitespace before key comparison — required because Go's `yaml.v3` uses 4-space indentation.
|
||||||
|
- **`apply_hub_config()`**: called before `print_banner` in `main()` so hub-sourced values are reflected in the plan display.
|
||||||
|
- **FileBrowser initial install**: removed drive auto-discovery from `install_filebrowser()`. FileBrowser is now installed with no drive volumes and a minimal `config.yaml` with `/srv` fallback. Drive volumes are managed entirely by the controller (`SyncFileBrowserMounts()`) after storage is registered via the dashboard.
|
||||||
|
- **Bug fix**: `((found_mounts++))` → `found_mounts=$(( found_mounts + 1 ))` — `set -euo pipefail` traps post-increment when var=0 (exit code 1). Same fix applied to `step_num` in `install_filebrowser()`.
|
||||||
|
|
||||||
|
#### `scripts/felhom-wipe.sh`
|
||||||
|
- **`cleanup_scan_dir()`**: removes `/mnt/.felhom-scan/` (ephemeral DR scan directory) — called from `full` level onwards.
|
||||||
|
- **`cleanup_raw_mounts()`**: removes raw helper mount infrastructure (`/mnt/.felhom-raw/`) at `nuclear` level: unmounts bind mounts first, then raw mounts, strips fstab entries, removes empty directories. Physical drive data untouched.
|
||||||
|
|
||||||
|
#### `scripts/README.md`
|
||||||
|
- Hub mode quick start simplified to one-liner
|
||||||
|
- Updated installation steps table: step 7 reflects controller-managed FileBrowser volumes
|
||||||
|
- Added "Raw helper mounts" section explaining two-level mount architecture
|
||||||
|
- Updated wipe levels table for `full` (scan dir) and `nuclear` (raw mounts + scan dir)
|
||||||
|
|
||||||
### v0.26.0 — Storage Namespace `felhom-data/` + Test Node Wipe Script (2026-02-22)
|
### v0.26.0 — Storage Namespace `felhom-data/` + Test Node Wipe Script (2026-02-22)
|
||||||
|
|
||||||
All felhom-managed data on external drives now lives under a `felhom-data/` subdirectory, cleanly separating controller-managed data from user files. Plus a multi-level wipe script for repeatable test node cleanup.
|
All felhom-managed data on external drives now lives under a `felhom-data/` subdirectory, cleanly separating controller-managed data from user files. Plus a multi-level wipe script for repeatable test node cleanup.
|
||||||
|
|||||||
+1
-1
@@ -69,7 +69,7 @@ The script runs these steps in order:
|
|||||||
| 4b | `install_cloudflare_tunnel()` | Deploy Cloudflare Tunnel (optional, only if tunnel token provided in wizard). |
|
| 4b | `install_cloudflare_tunnel()` | Deploy Cloudflare Tunnel (optional, only if tunnel token provided in wizard). |
|
||||||
| 5 | `generate_self_signed_cert()` | Generate self-signed CA + wildcard cert (optional, if `--self-signed-cert` flag set). |
|
| 5 | `generate_self_signed_cert()` | Generate self-signed CA + wildcard cert (optional, if `--self-signed-cert` flag set). |
|
||||||
| 6 | `run_config_wizard()` | Interactive wizard or Hub download. Generates `controller.yaml` with customer settings. |
|
| 6 | `run_config_wizard()` | Interactive wizard or Hub download. Generates `controller.yaml` with customer settings. |
|
||||||
| 7 | `install_filebrowser()` | Deploy FileBrowser Quantum with auto-discovered drive mounts (optional). |
|
| 7 | `install_filebrowser()` | Deploy FileBrowser Quantum with no drive volumes (optional). Drive volumes are managed by the controller via `SyncFileBrowserMounts()` after storage is registered. |
|
||||||
| 8 | `install_controller()` | Deploy felhom-controller (privileged container with system access). |
|
| 8 | `install_controller()` | Deploy felhom-controller (privileged container with system access). |
|
||||||
| 9 | `install_tools_and_configure()` | Install ctop, lazydocker, Docker shell aliases. |
|
| 9 | `install_tools_and_configure()` | Install ctop, lazydocker, Docker shell aliases. |
|
||||||
|
|
||||||
|
|||||||
+52
-33
@@ -1268,43 +1268,18 @@ install_filebrowser() {
|
|||||||
|
|
||||||
# Calculate step number dynamically
|
# Calculate step number dynamically
|
||||||
local step_num=5
|
local step_num=5
|
||||||
[[ "$SELF_SIGNED_CERT" == true ]] && ((step_num++))
|
[[ "$SELF_SIGNED_CERT" == true ]] && step_num=$(( step_num + 1 ))
|
||||||
[[ -n "${CF_TUNNEL_TOKEN:-}" ]] && ((step_num++))
|
[[ -n "${CF_TUNNEL_TOKEN:-}" ]] && step_num=$(( step_num + 1 ))
|
||||||
log_step "${step_num}/$(get_total_steps) - Installing FileBrowser Quantum..."
|
log_step "${step_num}/$(get_total_steps) - Installing FileBrowser Quantum..."
|
||||||
|
|
||||||
# Discover drive mounts for FileBrowser volumes
|
# Note: FileBrowser drive volumes are managed entirely by the controller.
|
||||||
local volume_lines=""
|
# SyncFileBrowserMounts() runs on controller startup and regenerates
|
||||||
local mount_comment=""
|
# docker-compose.yml + config.yaml whenever storage paths are added/removed.
|
||||||
local found_mounts=0
|
# docker-setup.sh writes an empty initial config; the controller takes over immediately.
|
||||||
|
|
||||||
# Scan /mnt/ for existing mount points (e.g., /mnt/hdd_1, /mnt/sys_drive)
|
|
||||||
if [[ -d /mnt ]]; then
|
|
||||||
for mp in /mnt/*/; do
|
|
||||||
[[ ! -d "$mp" ]] && continue
|
|
||||||
local name
|
|
||||||
name=$(basename "$mp")
|
|
||||||
# Skip hidden dirs and raw mount dirs
|
|
||||||
[[ "$name" == .* ]] && continue
|
|
||||||
[[ "$name" == .felhom-raw ]] && continue
|
|
||||||
volume_lines+=" - \"${mp%/}:/srv/${name}\""$'\n'
|
|
||||||
mount_comment+=" # ${mp%/} → /srv/${name}"$'\n'
|
|
||||||
found_mounts=$(( found_mounts + 1 ))
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Note: system_data_path is now configured via the web setup wizard,
|
|
||||||
# FileBrowser mounts will be synced by the controller after setup completes.
|
|
||||||
|
|
||||||
if [[ $found_mounts -eq 0 ]]; then
|
|
||||||
log_warn "No mount points found in /mnt/ — FileBrowser will have no drive volumes."
|
|
||||||
log_warn "Drives can be attached later via the controller dashboard."
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$DRY_RUN" == true ]]; then
|
if [[ "$DRY_RUN" == true ]]; then
|
||||||
echo -e "${CYAN}[DRY-RUN]${NC} Would install FileBrowser Quantum at files.${BASE_DOMAIN}"
|
echo -e "${CYAN}[DRY-RUN]${NC} Would install FileBrowser Quantum at files.${BASE_DOMAIN}"
|
||||||
if [[ $found_mounts -gt 0 ]]; then
|
echo -e "${CYAN}[DRY-RUN]${NC} Drive volumes managed by controller (empty on initial install)"
|
||||||
echo -e "${CYAN}[DRY-RUN]${NC} Would mount ${found_mounts} drive(s)"
|
|
||||||
fi
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1331,7 +1306,9 @@ services:
|
|||||||
- TZ=Europe/Budapest
|
- TZ=Europe/Budapest
|
||||||
volumes:
|
volumes:
|
||||||
- filebrowser_data:/home/filebrowser/data
|
- filebrowser_data:/home/filebrowser/data
|
||||||
${volume_lines} networks:
|
- ./config.yaml:/home/filebrowser/config.yaml:ro
|
||||||
|
# Storage volumes are auto-managed by felhom-controller (SyncFileBrowserMounts)
|
||||||
|
networks:
|
||||||
- traefik-public
|
- traefik-public
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
@@ -1360,6 +1337,48 @@ networks:
|
|||||||
external: true
|
external: true
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# Create initial config.yaml (no storage sources — controller syncs on startup)
|
||||||
|
cat > "${FILEBROWSER_DIR}/config.yaml" << 'CONFIGEOF'
|
||||||
|
# FileBrowser Quantum — managed by felhom-controller
|
||||||
|
# WARNING: This file is auto-generated. Manual edits will be overwritten.
|
||||||
|
|
||||||
|
server:
|
||||||
|
port: 80
|
||||||
|
baseURL: "/"
|
||||||
|
database: "/home/filebrowser/data/database.db"
|
||||||
|
logging:
|
||||||
|
- levels: "info|warning|error"
|
||||||
|
sources:
|
||||||
|
- path: "/srv"
|
||||||
|
userDefaults:
|
||||||
|
stickySidebar: true
|
||||||
|
darkMode: true
|
||||||
|
viewMode: "normal"
|
||||||
|
showHidden: false
|
||||||
|
dateFormat: false
|
||||||
|
gallerySize: 3
|
||||||
|
themeColor: "var(--blue)"
|
||||||
|
preview:
|
||||||
|
disableHideSidebar: false
|
||||||
|
highQuality: true
|
||||||
|
image: true
|
||||||
|
video: true
|
||||||
|
motionVideoPreview: true
|
||||||
|
office: true
|
||||||
|
popup: true
|
||||||
|
autoplayMedia: true
|
||||||
|
folder: true
|
||||||
|
permissions:
|
||||||
|
api: false
|
||||||
|
admin: false
|
||||||
|
modify: false
|
||||||
|
share: false
|
||||||
|
realtime: false
|
||||||
|
delete: false
|
||||||
|
create: false
|
||||||
|
download: true
|
||||||
|
CONFIGEOF
|
||||||
|
|
||||||
# Create .felhom.yml metadata
|
# Create .felhom.yml metadata
|
||||||
cat > "${FILEBROWSER_DIR}/.felhom.yml" << 'METAEOF'
|
cat > "${FILEBROWSER_DIR}/.felhom.yml" << 'METAEOF'
|
||||||
display_name: Filebrowser
|
display_name: Filebrowser
|
||||||
|
|||||||
Reference in New Issue
Block a user