#!/usr/bin/env bash # # Vornik Community Edition — one-command quickstart. # # Verified install (recommended) — pin a release and check the script against # its published checksum before running it. This catches tampering in transit # or a compromised get.vornik.io redirect; it is NOT a signature (someone who # controls the tag could rewrite both files together), so also skim the script: # REF= # a tag from github.com/EaseIT-cz/vornik/releases that ships quickstart.sh.sha256 # base="https://raw.githubusercontent.com/EaseIT-cz/vornik/$REF/deployments/podman" # curl -fsSLO "$base/quickstart.sh" && curl -fsSLO "$base/quickstart.sh.sha256" # sha256sum -c quickstart.sh.sha256 && VORNIK_REF="$REF" bash quickstart.sh # # Convenience one-liner (trusts TLS + GitHub; no checksum step). It pins to the # release tag baked in below, NOT to a moving branch: # curl -fsSL https://get.vornik.io | bash # # Topology: the Vornik daemon runs ON THE HOST as a rootless # `systemctl --user` service; only PostgreSQL+pgvector (and, in Enterprise, # the scraper) run in containers. The daemon spawns each task's agent as a # sibling container via your rootless podman, so the daemon, its exec # scratch, the agent workspaces, and the agent containers all share one # filesystem view. (The previous daemon-in-a-container design broke here: # the host podman could not statfs bind-mount sources that existed only # inside the daemon container.) See # https://docs.vornik.io # # What it does, in order: # 1. Installs podman + a compose provider + git (if missing). # 2. Fetches this repo (build context + config seed). # 3. Builds the `vornik` + `vornikctl` binaries in an ephemeral golang # container (no host Go toolchain) and installs them to ~/.local/bin. # 4. Builds the agent image into your rootless podman storage. # 5. Seeds ~/.config/vornik (config.yaml + vornik.env + configs/) and # ~/.local/share/vornik (data) on first run. # 6. Brings up PostgreSQL (+ scraper on Enterprise) via podman compose. # 7. Installs + starts the `vornik` user service (schema migrates on boot). # 8. Waits for readiness and prints how to connect. # # Re-running is safe (idempotent; existing config is never clobbered). # Tunables via environment: # VORNIK_REPO_URL git URL to clone (default: https://github.com/EaseIT-cz/vornik) # VORNIK_REF branch/tag to check out (default: pinned release tag; 'main' for bleeding-edge) # VORNIK_DIR where to place the checkout (default: $HOME/vornik) # VORNIK_SKIP_FETCH 1 = use VORNIK_DIR as-is, no clone/pull (offline/dev) # VORNIK_HTTP_PORT host port for the UI/API (default: 8080) # POSTGRES_PORT host port for PostgreSQL (default: 5432) # VORNIK_PUBLIC_HOSTNAME DNS name for an optional HTTPS front door: a host # Caddy (preinstalled) terminates TLS; Vornik's own login # stays the sign-in (GitHub #839) # if [ "${VORNIK_QUICKSTART_SOURCED:-}" = 1 ]; then set -eu else set -euo pipefail fi REPO_URL="${VORNIK_REPO_URL:-https://github.com/EaseIT-cz/vornik}" # DEFAULT_VORNIK_REF is stamped to the release tag at release/export time # (`make quickstart-stamp-ref REF=`), so the PUBLISHED installer pins a # concrete release rather than a moving branch. Keep it a real, recent tag in # the repo. Override at runtime with VORNIK_REF (e.g. VORNIK_REF=main). DEFAULT_VORNIK_REF="2026.11.8" REF="${VORNIK_REF:-$DEFAULT_VORNIK_REF}" DIR="${VORNIK_DIR:-$HOME/vornik}" HTTP_PORT="${VORNIK_HTTP_PORT:-8080}" PG_PORT="${POSTGRES_PORT:-5432}" GO_IMAGE="${VORNIK_GO_IMAGE:-docker.io/library/golang:1.26.11}" c_blue=$'\033[1;36m'; c_yellow=$'\033[1;33m'; c_red=$'\033[1;31m'; c_green=$'\033[1;32m'; c_off=$'\033[0m' log() { printf '%s==>%s %s\n' "$c_blue" "$c_off" "$*"; } ok() { printf '%s ok%s %s\n' "$c_green" "$c_off" "$*"; } warn() { printf '%s !!%s %s\n' "$c_yellow" "$c_off" "$*" >&2; } die() { printf '%s xx%s %s\n' "$c_red" "$c_off" "$*" >&2; exit 1; } # --- install-failure reporting (2026-07-25) --------------------------------- # On ANY non-zero exit, print a prefilled EaseIT-cz/vornik issue URL the user can # open + submit with their own GitHub account. The installer is the only actor # pre-install, so it carries its own (deliberately aggressive) secret scrubber. # It posts ONLY low-risk structured context (version/platform/exit + the scrubbed # failing command) — NOT an arbitrary log tail — and asks the user to add detail # after reviewing it. sourceable by quickstart_test.sh (VORNIK_QUICKSTART_SOURCED=1). # vornik_scrub — strip likely secrets AND identifiers from stdin before they # enter a PUBLIC issue. Mirrors the Go scrubber (internal/report) so the # installer path is no weaker than daemon-up reporting (review-20260725-7530 #3): # secrets first, then email / IPv4 / home-&-tilde paths (whole path, tail and # all — a surviving tail leaks project names), base64 last (after paths collapse). vornik_scrub() { sed -E \ -e 's/(Bearer|token|secret|password|passwd|api[_-]?key|access[_-]?key)([=: ]+)[^[:space:]"'"'"']+/\1\2/Ig' \ -e 's/eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{4,}//g' \ -e 's/\bsk-[A-Za-z0-9_-]{12,}//g' \ -e 's/\bAKIA[0-9A-Z]{12,}//g' \ -e 's/([?&](token|key|api_key|secret|password|access_key)=)[^&[:space:]]+/\1/Ig' \ -e 's/-----BEGIN[^-]+-----[^-]*-----END[^-]+-----//g' \ -e 's#[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}##g' \ -e 's#\b([0-9]{1,3}\.){3}[0-9]{1,3}\b##g' \ -e 's#(/var)?/home/[^[:space:]/]+(/[^[:space:],;)]*)?##g' \ -e 's#/Users/[^[:space:]/]+(/[^[:space:],;)]*)?##g' \ -e 's#/root(/[^[:space:],;)]*)?##g' \ -e 's#~/[^[:space:],;)]*##g' \ -e 's#\b[A-Za-z0-9+/]{32,}={0,2}\b##g' } # vornik_urlencode — percent-encoder (no jq/python dependency; awk is POSIX # base). Everything above the source guard must parse under /bin/sh, because # quickstart_test.sh sources this file with dash in CI — so no C-style for, # no `+=`, no `printf -v`. The input arrives via the environment, not `awk -v`, # which would expand backslash escapes in a failing command line; LC_ALL=C # makes length/substr byte-wise so multibyte UTF-8 is encoded per byte, as # RFC 3986 requires. vornik_urlencode() { VORNIK_URLENCODE_IN="$1" LC_ALL=C awk ' BEGIN { for (i = 0; i < 256; i++) ord[sprintf("%c", i)] = i s = ENVIRON["VORNIK_URLENCODE_IN"] n = length(s) for (i = 1; i <= n; i++) { c = substr(s, i, 1) if (c ~ /^[A-Za-z0-9._~-]$/) printf "%s", c else printf "%%%02X", ord[c] } }' } # vornik_replace_all — literal (non-regex) # replace-all. sed would treat the needle as a BRE, and hostnames carry dots. vornik_replace_all() { vra_rest="$1" vra_needle="$2" vra_repl="$3" vra_out='' if [ -z "$vra_needle" ]; then printf '%s' "$vra_rest"; return 0; fi while :; do case "$vra_rest" in *"$vra_needle"*) vra_pre="${vra_rest%%"$vra_needle"*}" vra_out="$vra_out$vra_pre$vra_repl" vra_rest="${vra_rest#"$vra_pre$vra_needle"}" ;; *) printf '%s' "$vra_out$vra_rest"; return 0 ;; esac done } # report_install_failure — no-op on success; else print the URL. report_install_failure() { local ec="${1:-0}" os arch cmd hn title body url case "$ec" in ''|0) return 0 ;; esac os="$(uname -s 2>/dev/null || echo unknown)" arch="$(uname -m 2>/dev/null || echo unknown)" cmd="$(printf '%s' "${BASH_COMMAND:-}" | vornik_scrub)" # This machine's hostname is only known at runtime, so strip it here (after # the stdin scrubber): a literal replace, hostnames carry no glob chars. hn="$(uname -n 2>/dev/null || hostname 2>/dev/null || true)" if [ -n "$hn" ]; then cmd="$(vornik_replace_all "$cmd" "$hn" '')"; fi # This installer only ever clones EaseIT-cz/vornik, so an install failure is a # Community Edition failure by construction — nothing here can be EE. Marking it # (body AND title, matching `vornikctl report`) is what lets triage tell which # build a reporter was running (operator report 2026-08-03: a CE customer's # report named neither edition nor build). title="[CE] Install failure: exit ${ec}" body="vornik quickstart install failed. - version (REF): ${REF:-unknown} - edition: community (CE) - platform: ${os}/${arch} - exit code: ${ec} - failing command: ${cmd} " url="https://github.com/EaseIT-cz/vornik/issues/new?labels=$(vornik_urlencode 'bug,install')&title=$(vornik_urlencode "$title")&body=$(vornik_urlencode "$body")" printf '\n%s xx%s installation failed (exit %s).\n' "${c_red:-}" "${c_off:-}" "$ec" >&2 printf 'Report it — this opens a prefilled, anonymized GitHub issue you review + submit:\n %s\n\n' "$url" >&2 } # Fire the hook on any non-zero exit — but NOT when merely sourced by the test. if [ "${VORNIK_QUICKSTART_SOURCED:-}" != 1 ]; then trap 'report_install_failure "$?"' EXIT fi # --- detection / selection helpers (sourced by quickstart_test.sh) ------- # Kept here, above the install body, so a test harness can source just # these functions with VORNIK_QUICKSTART_SOURCED=1 without triggering the # podman/git/build steps below. have_compose() { podman compose version >/dev/null 2>&1 || command -v podman-compose >/dev/null 2>&1; } is_immutable() { [ -f /run/ostree-booted ] || command -v rpm-ostree >/dev/null 2>&1; } # install_sys — best-effort system package install. brew first # (immutable-friendly, no root), then the classic distro managers. Returns # non-zero WITHOUT dying so the caller can fall back or print guidance. install_sys() { if command -v brew >/dev/null 2>&1; then brew install "$@" elif command -v dnf >/dev/null 2>&1; then sudo dnf install -y "$@" elif command -v apt-get >/dev/null 2>&1; then sudo apt-get update && sudo apt-get install -y "$@" elif command -v zypper >/dev/null 2>&1; then sudo zypper install -y "$@" elif command -v pacman >/dev/null 2>&1; then sudo pacman -Sy --noconfirm "$@" else return 1 fi } # Compose provider: podman's `compose` subcommand just shells out to whatever # provider is on PATH. Prefer pip --user (no root, no reboot — works on # immutable hosts), then pipx, then a system package. ensure_compose() { have_compose && return 0 log "Setting up a podman compose provider..." if command -v pipx >/dev/null 2>&1 && pipx install podman-compose >/dev/null 2>&1; then have_compose && return 0 fi if command -v python3 >/dev/null 2>&1; then python3 -m pip --version >/dev/null 2>&1 || python3 -m ensurepip --user >/dev/null 2>&1 || true if python3 -m pip install --user podman-compose >/dev/null 2>&1; then export PATH="$HOME/.local/bin:$PATH" have_compose && return 0 fi fi install_sys podman-compose >/dev/null 2>&1 || true have_compose } # configure_anonymous_telemetry # Applies the first-install choice. Enabled is the implicit default, so only # opt-out writes YAML. Environment values make automation deterministic. configure_anonymous_telemetry() { local config_path="$1" interactive="${2:-0}" choice="${VORNIK_TELEMETRY:-}" normalized normalized="$(printf '%s' "$choice" | tr '[:upper:]' '[:lower:]')" case "$normalized" in 0|false|no|off) printf '\n# Anonymous lifecycle telemetry opt-out (default is enabled).\ntelemetry:\n enabled: false\n' >>"$config_path" ok "Anonymous telemetry disabled in $config_path" return 0 ;; 1|true|yes|on) return 0 ;; "") ;; *) warn "Invalid VORNIK_TELEMETRY value; telemetry is disabled." printf '\n# Anonymous lifecycle telemetry opt-out (invalid environment value; fail closed).\ntelemetry:\n enabled: false\n' >>"$config_path" return 0 ;; esac if [ "$interactive" != 1 ]; then printf '%s\n' "Anonymous telemetry is enabled. Set VORNIK_TELEMETRY=off now, or telemetry.enabled: false later, to disable it." return 0 fi while :; do cat >/dev/tty <<'EOF' Anonymous usage telemetry Vornik reports successful installs and project creations. No IDs, names, paths, prompts, config, keys, or model/provider details are sent. Your IP is visible while telemetry.vornik.io handles the request, but is not included in the payload and must not be retained by the service. Send anonymous telemetry? [Y/n/s=show sample] EOF IFS= read -r choice >"$config_path" ok "Anonymous telemetry disabled in $config_path" return 0 ;; s|sample) cat >/dev/tty <<'EOF' Example URL: https://telemetry.vornik.io/v1/collect.json?e=install_succeeded&sv=1&v=2026.7.4&os=linux&arch=amd64&source=quickstart Example body: {"schema_version":1,"event":"install_succeeded","vornik_version":"2026.7.4","platform":{"os":"linux","arch":"amd64"},"source":"quickstart"} After install, run: vornikctl telemetry sample EOF ;; *) warn "Please answer y, n, or s." ;; esac done } # require_safe_checkout_dir — quickstart may delete and re-clone the # repo checkout, so refuse dangerous targets after resolving path traversal. require_safe_checkout_dir() { dir="$1" [ -n "$dir" ] || die "Refusing empty VORNIK_DIR. Set VORNIK_DIR to a dedicated checkout directory." case "$dir" in "~"|"~/"*|"."|".."|*/.|*/..|*/./*|*/../*) die "Refusing unsafe VORNIK_DIR value: '$dir'. Set VORNIK_DIR to a dedicated checkout directory." ;; esac case "$dir" in /*) abs="$dir" ;; *) abs="$(pwd -P)/$dir" ;; esac while [ "$abs" != "/" ] && [ "${abs%/}" != "$abs" ]; do abs="${abs%/}" done parent="${abs%/*}" base="${abs##*/}" [ -n "$parent" ] || parent="/" [ -n "$base" ] || die "Refusing unsafe VORNIK_DIR value: '$dir'. Set VORNIK_DIR to a dedicated checkout directory." [ -d "$parent" ] || die "Parent directory for VORNIK_DIR does not exist: '$parent'" parent_real="$(cd "$parent" && pwd -P)" if [ "$parent_real" = "/" ]; then target_real="/$base" else target_real="$parent_real/$base" fi home_real="$(cd "$HOME" && pwd -P)" case "$target_real" in "/"|"$home_real"|/*) if [ "$target_real" = "/" ] || [ "${target_real%/*}" = "" ]; then die "Refusing unsafe VORNIK_DIR value: '$dir'. Set VORNIK_DIR to a dedicated checkout directory." fi ;; esac case "$home_real/" in "$target_real/"*) die "Refusing unsafe VORNIK_DIR value: '$dir'. Set VORNIK_DIR to a dedicated checkout directory." ;; esac } # print_success_footer — post-install guidance (F5): a failing first task # should point users at diagnostics + reporting, not leave them stranded. print_success_footer() { printf '\nIf a task fails, run:\n' printf ' vornikctl doctor # checks agent-LLM topology, image uid, upstream key, +more\n' printf ' vornikctl report # opens an anonymized issue you review + submit\n' } # ensure_linger — verify `loginctl enable-linger` actually took (F6). The # unprivileged call can be silently denied on some hosts; when that happens # linger stays off and the daemon (a `systemctl --user` unit) dies the moment # no login session remains. Escalate to sudo before giving up. ensure_linger() { local u; u="$(id -un)" if [ "$(loginctl show-user "$u" --property=Linger 2>/dev/null)" = "Linger=yes" ]; then return 0 fi loginctl enable-linger "$u" >/dev/null 2>&1 || true if [ "$(loginctl show-user "$u" --property=Linger 2>/dev/null)" != "Linger=yes" ]; then # Unprivileged enable was denied on this host; escalate. sudo loginctl enable-linger "$u" >/dev/null 2>&1 || true fi if [ "$(loginctl show-user "$u" --property=Linger 2>/dev/null)" != "Linger=yes" ]; then warn "could not enable login lingering — the daemon and Postgres will stop when you log out. Run: sudo loginctl enable-linger $u" fi } # enable_podman_restart — Postgres autostarts after a reboot (F7). Rootless # `restart: always` (deps.compose.yaml) recovers crashes but NOT host # reboots; the user's podman-restart.service (with linger from # ensure_linger) restarts restart-policy containers at boot. Guard on the # unit existing so hosts without it warn instead of hard-failing. enable_podman_restart() { if systemctl --user list-unit-files podman-restart.service >/dev/null 2>&1; then systemctl --user enable podman-restart.service >/dev/null 2>&1 \ || warn "could not enable podman-restart.service — Postgres may not autostart after a reboot (run: systemctl --user enable podman-restart.service)" else warn "podman-restart.service not found — Postgres may not autostart after a reboot." fi } # rand_hex — 32 random bytes as 64 hex chars. od reads a finite input, so no # stage of the pipe is cut short (pipefail-safe). rand_hex() { head -c 32 /dev/urandom | od -An -tx1 | tr -d ' \n' } # ensure_api_key — the seeded config requires an API key # (vornik.host.yaml api.auth_enabled: true; hardened by default since the # 2026-10-01 external scan). Writes one to /secrets/api.env # (0600) unless a non-empty VORNIK_API_KEY is already set in a file the # daemon's loader reads. secrets/*.env is the location both the daemon # (internal/config/secrets_env.go) and shell-env.sh source, so vornikctl and # the daemon share ONE copy. Never prints the key. ensure_api_key() { _cfg="$1" for _f in "$_cfg/vornik.env" "$_cfg/secrets/env" "$_cfg"/secrets/*.env; do [ -r "$_f" ] || continue if grep -Eq '^(export[[:space:]]+)?VORNIK_API_KEY=["'"'"']?[^"'"'"'[:space:]]' "$_f"; then return 0 fi done mkdir -p "$_cfg/secrets" chmod 700 "$_cfg/secrets" ( umask 077; printf '# Operator API key: log in to the UI with it; vornikctl reads it\n# via shell-env.sh. Generated by quickstart.sh.\nVORNIK_API_KEY=%s\n' "$(rand_hex)" > "$_cfg/secrets/api.env" ) chmod 600 "$_cfg/secrets/api.env" ok "Generated an API key in $_cfg/secrets/api.env (0600)" } # db_volume_absent — true only when podman lists volumes and none is # vornik-postgres-data, i.e. no local database can hold a password yet # (Postgres fixes it when the volume is first initialised). A podman that # cannot list volumes answers "present": the safe direction. db_volume_absent() { _vols="$(podman volume ls --format '{{.Name}}' 2>/dev/null)" || return 1 case "$_vols" in *vornik-postgres-data*) return 1 ;; esac return 0 } # fresh_db_install — true only when nothing can already hold # the database password: the deps .env does not exist yet AND no # vornik-postgres-data volume exists (db_volume_absent). fresh_db_install() { [ -e "$1" ] && return 1 db_volume_absent } # known_default_db_password — true for a shipped constant: a value an # installer, example or test lane has shipped, plus the generic guesses. This # list MUST equal knownDefaultDBPasswords in internal/api/doctor_db_credentials.go # (TestDoctor412_QuickstartKnownDefaultsMatchDoctor fails when they differ). The # doctor also flags a password equal to the role or database name; that is not # checked here. known_default_db_password() { _kd="$1" # One pair of surrounding quotes is not part of the password: systemd's # EnvironmentFile and compose's .env both strip it. case "$_kd" in \"*\"|\'*\') _kd="${_kd#?}"; _kd="${_kd%?}" ;; esac case "$(printf '%s' "$_kd" | tr '[:upper:]' '[:lower:]')" in vornik|swarmd|postgres|vornik_dev_password|password|changeme|secret|admin|test|your-secure-password) return 0 ;; esac return 1 } # env_get — the last value of KEY=... in an env file ("" if none). env_get() { [ -r "$1" ] || return 0 sed -n "s/^$2=//p" "$1" | tail -n 1 } # env_set — set KEY=value in an env file, replacing every # existing KEY= line or appending one, keeping the file's other lines. The value # reaches awk through the environment, not the program text or a sed # replacement, so a password holding |, & or \ is written byte-exact and never # interpreted (#412). A value with a line break is refused (it would split the # line); the file is then left unchanged. Lines are written with LF endings. env_set() { # A literal newline: $(printf '\n') would strip it and match every value. _es_nl=' ' _es_cr="$(printf '\r')" case "$3" in *"$_es_nl"*|*"$_es_cr"*) return 1 ;; esac _es_tmp="$1.tmp.$$" ( umask 077 ES_KEY="$2" ES_VAL="$3" awk ' BEGIN { k = ENVIRON["ES_KEY"]; v = ENVIRON["ES_VAL"]; done = 0 } index($0, k "=") == 1 { if (!done) { print k "=" v; done = 1 } ; next } { print } END { if (!done) print k "=" v } ' "$1" > "$_es_tmp" ) || { rm -f "$_es_tmp"; return 1; } chmod 600 "$_es_tmp" && mv "$_es_tmp" "$1" } # db_host_local — true when the daemon's database is this host's # deps Postgres. The host is VORNIK_DATABASE_HOST in vornik.env (the daemon's # env override), else database.host in config.yaml, else the daemon's compiled # default, localhost. Local means: the compose service name, localhost, or a # loopback/unspecified address. Only then does the local vornik-postgres-data # volume say anything about which password the database holds. A host this # script cannot read (an unreadable config.yaml, a flow-style database block, # an empty host value) counts as NOT local, the safe direction: the caller then # keeps the value and warns rather than regenerate it (review round 3, F1). db_host_local() { _dh="$(env_get "$1/vornik.env" VORNIK_DATABASE_HOST)" if [ -z "$_dh" ] && [ -e "$1/config.yaml" ]; then [ -r "$1/config.yaml" ] || return 1 # Prints "H " for a block-style host, "?" for a form it cannot read, # nothing when the database block or its host key is absent. _dh="$(awk ' /^database:/ { v = $0; sub(/^database:[[:space:]]*/, "", v); sub(/[[:space:]]*#.*/, "", v) if (v != "") { print "?"; exit } ; f = 1; next } f && /^[^[:space:]#]/ { f = 0 } f && $1 == "host:" { if (NF < 2 || substr($2, 1, 1) == "#") print "?"; else print "H " $2; exit } ' "$1/config.yaml")" case "$_dh" in "") _dh=localhost ;; "?") return 1 ;; *) _dh="$(printf '%s' "${_dh#H }" | tr -d "\"'")"; [ -n "$_dh" ] || return 1 ;; esac fi case "${_dh:-localhost}" in postgres|localhost|127.*|::1|"[::1]"|0.0.0.0|::) return 0 ;; esac return 1 } # seed_db_password — keep the # daemon's VORNIK_DATABASE_PASSWORD (/vornik.env) and the deps # compose POSTGRES_PASSWORD () on ONE value, and never write a # constant (GitHub #412; quickstart design §3.3, hygiene design §2.1 D1, §2.6): # both set, differ stop: the daemon could not log in # a known default, no volume, local database host # nothing holds it (Postgres fixes the password when the # volume is first initialised), so a new value is # generated into BOTH files, whichever file held it # a known default otherwise (a kept volume, or an external database host) # kept so the install keeps working, with a warning # one set copy it to the other # both set, equal keep both # neither, no volume generate one into both # neither, a volume stop: no value this script could write is known to # open it # This function owns : it creates it from the example (0600) when # absent. The password is never printed. seed_db_password() { _sd_cfg="$1/vornik.env"; _sd_deps="$2"; _sd_ex="$3" _sd_runbook="docs/operator/2026-10-21-database-credential-retrofit.md (retrofit runbook)" _sd_v="$(env_get "$_sd_cfg" VORNIK_DATABASE_PASSWORD)" _sd_d="$(env_get "$_sd_deps" POSTGRES_PASSWORD)" if [ -n "$_sd_v" ] && [ -n "$_sd_d" ] && [ "$_sd_v" != "$_sd_d" ]; then die "VORNIK_DATABASE_PASSWORD in $_sd_cfg and POSTGRES_PASSWORD in $_sd_deps differ, so the daemon cannot log in to its database. Set both to the password the database was created with, then re-run. Rotating it: $_sd_runbook." fi _sd_val="${_sd_v:-$_sd_d}" _sd_regen="" if [ -n "$_sd_val" ] && known_default_db_password "$_sd_val" && db_host_local "$1" && db_volume_absent; then _sd_val=""; _sd_regen=1 # a shipped default that no database holds yet fi if [ -z "$_sd_val" ]; then db_volume_absent || die "An existing vornik-postgres-data volume (or a podman that cannot list volumes) may hold a database password that neither $_sd_cfg nor $_sd_deps records. Set VORNIK_DATABASE_PASSWORD in $_sd_cfg to the password that volume was created with (an install made before 2026-10-21 used vornik_dev_password), then re-run. Rotating it: $_sd_runbook." _sd_val="$(rand_hex)" [ ${#_sd_val} -eq 64 ] || die "could not generate a database password (/dev/urandom unreadable?)" _sd_msg="Generated a per-install database password (vornik.env + deps .env, 0600)" else _sd_msg="Database password: one value in vornik.env and the deps .env" known_default_db_password "$_sd_val" && warn "The database password is a shipped default that other installs share. It was kept because a database may already use it; rotate it: $_sd_runbook." fi if [ ! -f "$_sd_deps" ]; then ( umask 077; cp "$_sd_ex" "$_sd_deps" ) || die "cannot create $_sd_deps" fi env_set "$_sd_deps" POSTGRES_PASSWORD "$_sd_val" || die "cannot write $_sd_deps" if [ -z "$_sd_v" ] || [ -n "$_sd_regen" ]; then env_set "$_sd_cfg" VORNIK_DATABASE_PASSWORD "$_sd_val" || die "cannot write $_sd_cfg" fi ok "$_sd_msg" } # warn_auth_disabled — a re-run never edits an existing config; # it says so when that config still serves the API without a key. # seed_configs : the registry tree the daemon reads. # A fresh install gets the whole repo tree (projects included); every run then # deploys the assets the release added, preserve-existing, and stamps the # template baseline. Before 2026-10-02 only the first run copied anything, so # a re-run never delivered a new subtree such as agent-templates # (image-freshness design §15.5). seed_configs() { sc_repo="$1"; sc_dir="$2" if [ -z "$(ls -A "$sc_dir/configs" 2>/dev/null)" ]; then mkdir -p "$sc_dir/configs" cp -r "$sc_repo/configs/." "$sc_dir/configs/" ok "Seeded $sc_dir/configs from the repo registry" fi if VORNIK_DEPLOY_REVISION="$(git -C "$sc_repo" rev-parse HEAD 2>/dev/null)" \ "$sc_repo/scripts/config-deploy.sh" "$sc_dir" >/dev/null; then ok "Deployed the release's config assets into $sc_dir/configs (existing files kept)" else warn "Deploying the release's config assets reported a problem; re-run: $sc_repo/scripts/config-deploy.sh $sc_dir" fi } warn_auth_disabled() { if grep -Eq '^[[:space:]]*auth_enabled:[[:space:]]*false' "$1" 2>/dev/null; then warn "$1 has api.auth_enabled: false — the API and UI accept requests without a key." warn " Set api.auth_enabled: true and api.api_keys: [\"\${VORNIK_API_KEY}\"] (the key is in secrets/api.env), then: systemctl --user restart vornik" fi } # --- Optional HTTPS front door (VORNIK_PUBLIC_HOSTNAME; GitHub #839 part A, # quickstart design amendment 2026-11-19). Caddy terminates TLS; login stays # Vornik's own, one session per person. No Python, no YAML rewrite, and a # re-run never edits an existing config. # https_hostname_ok — a DNS name: letters, digits, dots and hyphens, # no empty label, no label starting or ending with a hyphen. It is pasted # into a Caddyfile, so nothing else may get through. https_hostname_ok() { case "$1" in ''|*[!A-Za-z0-9.-]*|.*|*.|*..*|-*|*-.*|*.-*|*-) return 1 ;; esac return 0 } # https_render_site