Refresh deploy/ and bin/ from the boilerplate at 09e144d (the release split between the distro and Windows, wsl-setup, the server config, USER 1000, python:3.15-slim) with roledesk's facts put back: no frontend stage, desk, plugins and seed copied, the extras passkeys, embeddings and llm, roles as the table the backup and the importer require, bin/pull.sh and bin/worker.sh with their profile commands, and Install Server.md and Install WSL.md as copies in place of the five old deployment docs
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
83e965dfeb
commit
a1f281a23a
40 files changed
+2226
-1287
No files matched your search
@@ -0,0 +1,86 @@
|
||||
# shellcheck shell=bash
|
||||
# Shared plumbing for the release scripts that run in WSL. Source it; do not
|
||||
# run it.
|
||||
#
|
||||
# Sourcing runs in the caller's shell, so everything defined here ($root,
|
||||
# SETTINGS, setting, require_setting, die, step, run_or_die) is the caller's
|
||||
# afterwards. The Windows half (steps 2 and 3) reads the same release.env with
|
||||
# _common.ps1, which parses the same KEY=VALUE lines. The caller sets
|
||||
# `set -euo pipefail` first.
|
||||
|
||||
#: The directory of these scripts and the repository root above it, worked out
|
||||
#: from this file rather than from the working directory, so the scripts can be
|
||||
#: run from anywhere.
|
||||
here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
# shellcheck disable=SC2034 # read by the scripts that source this file
|
||||
root=$(dirname "$here")
|
||||
|
||||
die() { printf 'error: %s\n' "$*" >&2; exit 1; }
|
||||
|
||||
step() { printf '\n== %s\n' "$*"; }
|
||||
|
||||
# Runs a command and, when it fails, stops with the step's name and its exit
|
||||
# code: `run_or_die 'git archive' git archive ...`.
|
||||
run_or_die() {
|
||||
local what=$1 rc=0
|
||||
shift
|
||||
"$@" || rc=$?
|
||||
((rc == 0)) || die "$what failed (exit $rc)"
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------- release.env
|
||||
|
||||
# Read, not sourced: sourcing would run whatever the file says and would break
|
||||
# on a space in a value. A line is blank, a comment, or KEY=VALUE; anything else
|
||||
# is a typo and is reported here rather than as an empty variable later. Keys
|
||||
# and values are trimmed and surrounding double quotes are dropped. A CRLF file
|
||||
# (saved from a Windows editor) reads the same as an LF one.
|
||||
trim() {
|
||||
local s=$1
|
||||
s=${s#"${s%%[![:space:]]*}"}
|
||||
s=${s%"${s##*[![:space:]]}"}
|
||||
printf '%s' "$s"
|
||||
}
|
||||
|
||||
declare -A SETTINGS=()
|
||||
env_file=$here/release.env
|
||||
[[ -f $env_file ]] || die "no deploy/release.env - copy deploy/release.env.example and fill it in"
|
||||
while IFS= read -r line || [[ -n $line ]]; do
|
||||
line=${line%$'\r'}
|
||||
[[ $line =~ ^[[:space:]]*(#|$) ]] && continue
|
||||
[[ $line == *=* ]] || die "release.env: not a KEY=VALUE line: $line"
|
||||
key=$(trim "${line%%=*}")
|
||||
value=$(trim "${line#*=}")
|
||||
while [[ $value == \"* ]]; do value=${value#\"}; done
|
||||
while [[ $value == *\" ]]; do value=${value%\"}; done
|
||||
SETTINGS[$key]=$value
|
||||
done < "$env_file"
|
||||
unset line key value
|
||||
|
||||
# setting NAME [DEFAULT]: the value, or the default when unset or empty.
|
||||
setting() {
|
||||
local value=${SETTINGS[$1]-}
|
||||
if [[ -n $value ]]; then printf '%s' "$value"; else printf '%s' "${2-}"; fi
|
||||
}
|
||||
|
||||
# require_setting NAME: the value, or a stop naming the missing setting.
|
||||
require_setting() {
|
||||
local value
|
||||
value=$(setting "$1")
|
||||
[[ -n $value ]] || die "set $1 in deploy/release.env"
|
||||
printf '%s' "$value"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------- shared checks
|
||||
|
||||
need_git() {
|
||||
command -v git >/dev/null 2>&1 || die "git is not on PATH"
|
||||
}
|
||||
|
||||
# The commit a branch or ref points at, or a stop saying which one did not
|
||||
# resolve.
|
||||
resolve_commit() {
|
||||
local commit
|
||||
commit=$(git rev-parse --verify "$1^{commit}") || die "resolve $2 commit failed"
|
||||
printf '%s' "$commit"
|
||||
}
|
||||
Reference in new issue
Block a user