betterNAS/scripts/agent-bootstrap
Harivansh Rathi b5f8ea9c52 Make control-plane the real mount authority
Split node enrollment from export sync and issue Finder-compatible DAV
credentials so the stack proves the real backend seam before any web UI
consumes it.
2026-04-01 17:46:50 +00:00

45 lines
1.1 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
env_file="$repo_root/.env.agent"
if [[ ! -f "$env_file" ]]; then
# shellcheck disable=SC1091
source "$repo_root/scripts/lib/agent-env.sh"
betternas_write_agent_env_file "$env_file" "$repo_root"
fi
# shellcheck disable=SC1091
source "$repo_root/scripts/lib/runtime-env.sh"
mkdir -p "$BETTERNAS_EXPORT_PATH"
if [[ ! -f "$BETTERNAS_EXPORT_PATH/README.txt" ]]; then
cat >"$BETTERNAS_EXPORT_PATH/README.txt" <<EOF
betterNAS export
clone=${BETTERNAS_CLONE_NAME}
mount_url=${BETTERNAS_EXAMPLE_MOUNT_URL}
EOF
fi
pnpm install --frozen-lockfile
go work sync
cat <<EOF
Agent bootstrap complete for ${BETTERNAS_CLONE_NAME}
Env file: ${env_file}
Control plane: http://localhost:${BETTERNAS_CONTROL_PLANE_PORT}
Node agent: http://localhost:${BETTERNAS_NODE_AGENT_PORT}
Nextcloud: ${NEXTCLOUD_BASE_URL}
Export path: ${BETTERNAS_EXPORT_PATH}
Example mount URL: ${BETTERNAS_EXAMPLE_MOUNT_URL}
Mount credentials are issued by the control plane.
Next:
pnpm verify
pnpm stack:up
pnpm stack:verify
EOF