betterNAS/scripts/agent-bootstrap
Harivansh Rathi f754a217f4 prepare runtime loop
Co-authored-by: Codex <noreply@openai.com>
2026-04-01 05:12:11 +00:00

44 lines
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}
Mount URL: ${BETTERNAS_EXAMPLE_MOUNT_URL}
Next:
pnpm verify
pnpm stack:up
pnpm stack:verify
EOF