create-freeholder 0.2.0-beta.4 → 0.2.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/template/.changeset/blog-playground-content.md +4 -0
  2. package/dist/template/.changeset/blog-wordpress-structure.md +6 -0
  3. package/dist/template/.changeset/managed-preview-assistant.md +4 -0
  4. package/dist/template/.changeset/native-linux-install.md +6 -0
  5. package/dist/template/.changeset/public-beta-5.md +4 -0
  6. package/dist/template/.changeset/public-beta-6.md +4 -0
  7. package/dist/template/.github/ISSUE_TEMPLATE/bug_report.yml +1 -1
  8. package/dist/template/.github/workflows/release-tarballs.yml +117 -0
  9. package/dist/template/AGENTS.md +15 -2
  10. package/dist/template/Dockerfile +3 -0
  11. package/dist/template/MASTER.md +114 -11
  12. package/dist/template/README.md +1 -1
  13. package/dist/template/app/(admin)/admin/assistant/page.tsx +9 -1
  14. package/dist/template/app/(admin)/admin/blog/PostSettings.tsx +26 -0
  15. package/dist/template/app/(admin)/admin/blog/[kind]/page.tsx +53 -0
  16. package/dist/template/app/(admin)/admin/blog/actions.ts +186 -6
  17. package/dist/template/app/(admin)/admin/blog/comments/page.tsx +25 -0
  18. package/dist/template/app/(admin)/admin/blog/page.tsx +21 -5
  19. package/dist/template/app/(admin)/admin/imports/[id]/page.tsx +2 -0
  20. package/dist/template/app/(admin)/admin/pages/[id]/page.tsx +3 -0
  21. package/dist/template/app/(admin)/assistant-actions.ts +13 -6
  22. package/dist/template/app/(public)/[[...slug]]/ReaderComments.tsx +25 -0
  23. package/dist/template/app/(public)/[[...slug]]/blog-parts.tsx +153 -0
  24. package/dist/template/app/(public)/[[...slug]]/comment-actions.ts +16 -0
  25. package/dist/template/app/(public)/[[...slug]]/page.tsx +182 -18
  26. package/dist/template/app/api/chat/assistant/call/route.ts +35 -0
  27. package/dist/template/db/migrations/0061_blog_structure.sql +89 -0
  28. package/dist/template/db/migrations/0062_blog_reader_comments.sql +24 -0
  29. package/dist/template/db/migrations/meta/_journal.json +14 -0
  30. package/dist/template/deploy/README.md +26 -9
  31. package/dist/template/deploy/blog-wordpress-2026-11-07.md +146 -0
  32. package/dist/template/deploy/docker-selfhost/.env.example +11 -1
  33. package/dist/template/deploy/docker-selfhost/README.md +79 -50
  34. package/dist/template/deploy/docker-selfhost/infra/backup.sh +81 -0
  35. package/dist/template/deploy/docker-selfhost/infra/compose.https.yml +37 -1
  36. package/dist/template/deploy/docker-selfhost/infra/compose.yml +37 -1
  37. package/dist/template/deploy/docker-selfhost/migrate.md +8 -5
  38. package/dist/template/deploy/docker-selfhost/recipe.yaml +9 -10
  39. package/dist/template/deploy/docker-selfhost/selfhost.sh +206 -0
  40. package/dist/template/deploy/docker-selfhost/verify.md +11 -4
  41. package/dist/template/deploy/f-criteria-matrix.md +89 -0
  42. package/dist/template/deploy/linux/.env.example +28 -0
  43. package/dist/template/deploy/linux/README.md +181 -0
  44. package/dist/template/deploy/linux/freeholder +655 -0
  45. package/dist/template/deploy/linux/install.sh +173 -0
  46. package/dist/template/deploy/linux/migrate.md +17 -0
  47. package/dist/template/deploy/linux/recipe.yaml +50 -0
  48. package/dist/template/deploy/linux/share/Caddyfile.template +19 -0
  49. package/dist/template/deploy/linux/share/systemd/freeholder-backup.service +13 -0
  50. package/dist/template/deploy/linux/share/systemd/freeholder-backup.timer +12 -0
  51. package/dist/template/deploy/linux/share/systemd/freeholder.service +41 -0
  52. package/dist/template/deploy/linux/verify.md +22 -0
  53. package/dist/template/deploy/managed-preview-assistant.md +99 -0
  54. package/dist/template/eslint.config.mjs +3 -1
  55. package/dist/template/gitignore.template +1 -0
  56. package/dist/template/locales/ar.json +85 -6
  57. package/dist/template/locales/en.json +83 -4
  58. package/dist/template/locales/es.json +83 -4
  59. package/dist/template/locales/fr.json +85 -6
  60. package/dist/template/next.config.ts +2 -0
  61. package/dist/template/package.json +3 -2
  62. package/dist/template/packages/cli/package.json +1 -1
  63. package/dist/template/packages/create-freeholder/package.json +1 -1
  64. package/dist/template/packages/freeholder-app/package.json +1 -1
  65. package/dist/template/packages/mobile-app/package.json +1 -1
  66. package/dist/template/packages/plugin-kit/package.json +1 -1
  67. package/dist/template/packages/sdk/package.json +1 -1
  68. package/dist/template/packages/sdk/src/generated.ts +177 -9
  69. package/dist/template/packages/sdk/src/version.ts +1 -1
  70. package/dist/template/packages/templates/package.json +1 -1
  71. package/dist/template/proxy.ts +18 -1
  72. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/NOTICE.txt +117 -0
  73. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/audio-output-processor.js +267 -0
  74. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/decoderWorker.min.js +847 -0
  75. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/decoderWorker.min.wasm +0 -0
  76. package/dist/template/public/managed-assistant/0.1.10/duplex-codec/encoderWorker.min.js +1 -0
  77. package/dist/template/public/managed-assistant/0.1.10/manifest.json +12 -0
  78. package/dist/template/public/managed-assistant/0.1.10/pm-ai-duplex-client.js +1376 -0
  79. package/dist/template/scripts/build-release.d.mts +4 -0
  80. package/dist/template/scripts/build-release.mjs +171 -0
  81. package/dist/template/scripts/launch-prepare.mjs +6 -3
  82. package/dist/template/scripts/license-headers.mjs +3 -0
  83. package/dist/template/scripts/recipe-matrix.sh +22 -7
  84. package/dist/template/scripts/verify-wordpress-migration.d.mts +8 -0
  85. package/dist/template/scripts/verify-wordpress-migration.mjs +105 -0
  86. package/dist/template/security/adversarial-audit-2026-10-08.md +1 -1
  87. package/dist/template/src/adapters/ai/types.ts +5 -0
  88. package/dist/template/src/adapters/paradise/assistant.ts +37 -0
  89. package/dist/template/src/adapters/paradise/http.ts +4 -3
  90. package/dist/template/src/adapters/storage/local-mode.ts +54 -0
  91. package/dist/template/src/adapters/storage/local.ts +53 -26
  92. package/dist/template/src/core/contract/json-schema.ts +8 -0
  93. package/dist/template/src/core/demo/playground-inserts.ts +29 -0
  94. package/dist/template/src/core/demo/playground-policy.ts +9 -0
  95. package/dist/template/src/core/doctor/index.ts +19 -10
  96. package/dist/template/src/core/env.ts +8 -1
  97. package/dist/template/src/core/http/csp.ts +10 -2
  98. package/dist/template/src/core/http/csrf-client.ts +10 -0
  99. package/dist/template/src/core/import/service.ts +217 -12
  100. package/dist/template/src/core/import/wordpress.ts +80 -15
  101. package/dist/template/src/core/notifications/service.ts +1 -0
  102. package/dist/template/src/core/retention/registry.ts +2 -0
  103. package/dist/template/src/core/search/registry.ts +2 -0
  104. package/dist/template/src/core/seo/feeds.ts +2 -0
  105. package/dist/template/src/core/seo/jsonld.ts +46 -2
  106. package/dist/template/src/core/seo/legacy-proxy.ts +53 -0
  107. package/dist/template/src/core/seo/meta.ts +10 -7
  108. package/dist/template/src/core/seo/service.ts +14 -1
  109. package/dist/template/src/core/update/preflight.ts +3 -2
  110. package/dist/template/src/core/update/release-declaration.json +1 -1
  111. package/dist/template/src/core/update/service.ts +7 -17
  112. package/dist/template/src/modules/assistant/contract.ts +1 -1
  113. package/dist/template/src/modules/assistant/limits.ts +3 -0
  114. package/dist/template/src/modules/assistant/preview.ts +124 -0
  115. package/dist/template/src/modules/assistant/provider.ts +7 -0
  116. package/dist/template/src/modules/assistant/service.ts +21 -5
  117. package/dist/template/src/modules/cms/blocks/PreviewAssistantCall.tsx +176 -0
  118. package/dist/template/src/modules/cms/blocks/SiteChatClient.tsx +10 -4
  119. package/dist/template/src/modules/cms/blocks/surfaces.tsx +10 -0
  120. package/dist/template/src/modules/cms/blog-comments-schema.ts +27 -0
  121. package/dist/template/src/modules/cms/blog-comments.ts +111 -0
  122. package/dist/template/src/modules/cms/blog-schema.ts +146 -0
  123. package/dist/template/src/modules/cms/blog-service.ts +999 -0
  124. package/dist/template/src/modules/cms/blog.tsx +245 -25
  125. package/dist/template/src/modules/cms/manifest.ts +7 -1
  126. package/dist/template/src/modules/cms/read.ts +18 -0
  127. package/dist/template/src/modules/cms/service.ts +22 -4
  128. package/dist/template/src/modules/cms/tables.ts +2 -0
  129. package/dist/template/src/modules/seed/launch.ts +31 -3
  130. package/dist/template/tests/browser/blog-structure.spec.ts +69 -0
  131. package/dist/template/tests/core/agent-launch.test.ts +7 -2
  132. package/dist/template/tests/core/analytics-consent.test.ts +1 -1
  133. package/dist/template/tests/core/blog-playground.test.ts +106 -0
  134. package/dist/template/tests/core/blog-structure-comments.test.ts +166 -0
  135. package/dist/template/tests/core/client-readiness-security.test.ts +3 -1
  136. package/dist/template/tests/core/csp.test.ts +1 -1
  137. package/dist/template/tests/core/deploy-recipe.test.ts +54 -4
  138. package/dist/template/tests/core/internal-services.test.ts +4 -0
  139. package/dist/template/tests/core/legacy-redirect-proxy.test.ts +59 -0
  140. package/dist/template/tests/core/linux-install.test.ts +169 -0
  141. package/dist/template/tests/core/local-storage-mode.test.ts +29 -0
  142. package/dist/template/tests/core/locale-routing.test.ts +1 -1
  143. package/dist/template/tests/core/playground-cache.test.ts +1 -1
  144. package/dist/template/tests/core/playground.test.ts +3 -3
  145. package/dist/template/tests/core/preview-assistant-call.test.ts +88 -0
  146. package/dist/template/tests/core/private-preview-webhooks.test.ts +1 -1
  147. package/dist/template/tests/core/private-preview.test.ts +1 -1
  148. package/dist/template/tests/core/proxy-locale.test.ts +1 -1
  149. package/dist/template/tests/core/sdk-schema.test.ts +20 -0
  150. package/dist/template/tests/core/seo.test.ts +1 -1
  151. package/dist/template/tests/core/site-chat-client.test.ts +50 -0
  152. package/dist/template/tests/core/storage.test.ts +38 -2
  153. package/dist/template/tests/core/wordpress-import-flow.test.ts +81 -18
  154. package/dist/template/tests/core/wordpress-import.test.ts +25 -12
  155. package/dist/template/tests/core/wordpress-migration-verification.test.ts +37 -0
  156. package/dist/template/tests/modules/preview-assistant.test.ts +164 -0
  157. package/dist/template-manifest.json +490 -175
  158. package/package.json +1 -1
@@ -0,0 +1,206 @@
1
+ #!/bin/sh
2
+ # Copyright (C) 2026 Tony Aly
3
+ # SPDX-License-Identifier: Apache-2.0
4
+ #
5
+ # C3.44: run the Docker Compose recipe with only Docker and openssl on the
6
+ # host: no Node, pnpm or `pnpm install`. Run it from anywhere in a checkout:
7
+ #
8
+ # deploy/docker-selfhost/selfhost.sh prepare [--domain example.com] [--storage local|s3]
9
+ # deploy/docker-selfhost/selfhost.sh start
10
+ # deploy/docker-selfhost/selfhost.sh claim-link
11
+ #
12
+ # `pnpm launch:prepare --target docker-selfhost` writes the same .env and still
13
+ # works; this script exists so a server needs neither.
14
+ set -eu
15
+
16
+ here=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)
17
+ ENV_FILE="$here/.env"
18
+ REPOSITORY="CampDenman/freeholder"
19
+
20
+ say() { printf 'freeholder: %s\n' "$*"; }
21
+ warn() { printf 'freeholder: warning: %s\n' "$*" >&2; }
22
+ die() { printf 'freeholder: error: %s\n' "$*" >&2; exit 1; }
23
+
24
+ env_get() { [ -f "$ENV_FILE" ] && sed -n "s/^$1=//p" "$ENV_FILE" | tail -n 1 | sed -e 's/^"//' -e 's/"$//' || true; }
25
+ env_set() {
26
+ case "$2" in *[[:space:]\"\'\\]*) die "refusing to store a value for $1 with spaces, quotes or backslashes" ;; esac
27
+ tmp="$ENV_FILE.tmp.$$"
28
+ ( umask 077; if [ -f "$ENV_FILE" ]; then grep -v "^$1=" "$ENV_FILE" > "$tmp" || true; else : > "$tmp"; fi )
29
+ printf '%s=%s\n' "$1" "$2" >> "$tmp"
30
+ chmod 600 "$tmp"
31
+ mv "$tmp" "$ENV_FILE"
32
+ }
33
+ ensure_secret() { [ -n "$(env_get "$1")" ] || env_set "$1" "$(openssl rand -hex 32)"; }
34
+
35
+ release_version() {
36
+ sed -n 's/^ "version": "\(.*\)",$/\1/p' "$here/../../package.json" | head -n 1
37
+ }
38
+
39
+ compose_file() {
40
+ case "$(env_get APP_URL)" in
41
+ https://*) echo "$here/infra/compose.https.yml" ;;
42
+ *) echo "$here/infra/compose.yml" ;;
43
+ esac
44
+ }
45
+ compose() { docker compose --env-file "$ENV_FILE" -f "$(compose_file)" "$@"; }
46
+
47
+ private_ipv4() {
48
+ case "$1" in
49
+ 10.*|192.168.*|127.*|169.254.*|172.1[6-9].*|172.2[0-9].*|172.3[01].*) return 0 ;;
50
+ 100.6[4-9].*|100.[7-9][0-9].*|100.1[01][0-9].*|100.12[0-7].*) return 0 ;;
51
+ esac
52
+ return 1
53
+ }
54
+ public_ipv4() {
55
+ ip=$(ip -4 route get 1.1.1.1 2>/dev/null | awk '{for (i = 1; i < NF; i++) if ($i == "src") {print $(i + 1); exit}}' || true)
56
+ if [ -z "$ip" ] || private_ipv4 "$ip"; then
57
+ ip=$(curl -4 -fsS --max-time 10 https://checkip.amazonaws.com 2>/dev/null | tr -d '[:space:]' || true)
58
+ fi
59
+ case "$ip" in *.*.*.*) printf '%s\n' "$ip" ;; *) return 1 ;; esac
60
+ }
61
+ sslip_host() { printf '%s.sslip.io\n' "$(printf '%s' "$1" | tr . -)"; }
62
+
63
+ cmd_prepare() {
64
+ domain="" storage="" local_only=""
65
+ while [ $# -gt 0 ]; do
66
+ case "$1" in
67
+ --domain) domain=$2; shift 2 ;;
68
+ --storage) storage=$2; shift 2 ;;
69
+ --localhost) local_only=1; shift ;;
70
+ *) die "prepare: unknown option $1" ;;
71
+ esac
72
+ done
73
+ command -v openssl >/dev/null 2>&1 || die "openssl is required"
74
+ [ -f "$ENV_FILE" ] || { ( umask 077; : > "$ENV_FILE" ); }
75
+ chmod 600 "$ENV_FILE"
76
+ ensure_secret POSTGRES_PASSWORD
77
+ ensure_secret BOOTSTRAP_SECRET
78
+ ensure_secret SESSION_SECRET
79
+ ensure_secret CREDENTIAL_KEY
80
+ if [ -n "$local_only" ]; then
81
+ env_set APP_URL http://localhost:3000
82
+ elif [ -n "$domain" ] || [ -z "$(env_get FREEHOLDER_DOMAIN)" ]; then
83
+ if [ -z "$domain" ]; then
84
+ ip=$(public_ipv4) || die "could not find this server's public IPv4 address; pass --domain"
85
+ domain=$(sslip_host "$ip")
86
+ say "using the temporary address https://$domain (move to your domain later with: prepare --domain example.com && start)"
87
+ fi
88
+ env_set FREEHOLDER_DOMAIN "$domain"
89
+ env_set APP_URL "https://$domain"
90
+ fi
91
+ [ -n "$(env_get FREEHOLDER_SEED_DEMO)" ] || env_set FREEHOLDER_SEED_DEMO 0
92
+ [ -n "$(env_get FREEHOLDER_IMAGE)" ] || env_set FREEHOLDER_IMAGE "ghcr.io/campdenman/freeholder:$(release_version)"
93
+ case "${storage:-$(env_get FREEHOLDER_STORAGE)}" in
94
+ ""|local) env_set FREEHOLDER_STORAGE local ;;
95
+ s3)
96
+ env_set FREEHOLDER_STORAGE s3
97
+ for name in S3_ENDPOINT S3_REGION S3_BUCKET S3_ACCESS_KEY_ID S3_SECRET_ACCESS_KEY; do
98
+ [ -n "$(env_get "$name")" ] || warn "add $name to $ENV_FILE before starting"
99
+ done ;;
100
+ *) die "--storage is local or s3" ;;
101
+ esac
102
+ say "wrote $ENV_FILE (mode 600; secrets generated with openssl)"
103
+ say "start it with: $0 start"
104
+ }
105
+
106
+ cmd_start() {
107
+ [ -f "$ENV_FILE" ] || die "run '$0 prepare' first"
108
+ # Release tags do not move, so pull only what is not here yet (a locally
109
+ # built FREEHOLDER_IMAGE is never pulled).
110
+ compose up -d --wait --pull missing
111
+ url=$(env_get APP_URL)
112
+ say "waiting for $url"
113
+ i=0
114
+ until curl -fsS --max-time 10 -o /dev/null "$url/api/health"; do
115
+ i=$((i + 1)); [ "$i" -lt 60 ] || { warn "$url is not answering yet; check DNS and ports 80/443, then: $0 check"; break; }
116
+ sleep 3
117
+ done
118
+ say "Your private owner claim link (open it yourself):"
119
+ cmd_claim_link
120
+ }
121
+
122
+ cmd_claim_link() {
123
+ url=$(env_get APP_URL); secret=$(env_get BOOTSTRAP_SECRET)
124
+ [ -n "$url" ] && [ -n "$secret" ] || die "run '$0 prepare' first"
125
+ printf '%s/setup#claim=%s\n' "$url" "$secret"
126
+ }
127
+
128
+ cmd_check() {
129
+ failures=0
130
+ url=$(env_get APP_URL)
131
+ compose ps
132
+ for service in app db backup; do
133
+ state=$(docker inspect -f '{{.State.Status}}{{if .State.Health}}/{{.State.Health.Status}}{{end}}' "$(compose ps -q "$service")" 2>/dev/null || echo missing)
134
+ case "$state" in running|running/healthy) printf ' ok %s %s\n' "$service" "$state" ;; *) printf ' FAIL %s %s\n' "$service" "$state"; failures=$((failures + 1)) ;; esac
135
+ done
136
+ if curl -fsS --max-time 15 -o /dev/null "$url/api/health"; then printf ' ok %s/api/health\n' "$url"; else printf ' FAIL %s/api/health\n' "$url"; failures=$((failures + 1)); fi
137
+ latest=$(compose exec -T backup sh -c 'ls -1 /backups 2>/dev/null | grep -v partial | sort | tail -n 1' || true)
138
+ printf ' info latest backup: %s\n' "${latest:-none yet}"
139
+ [ "$failures" -eq 0 ] || { echo "$failures check(s) failed. Logs: docker compose --env-file $ENV_FILE -f $(compose_file) logs app"; return 1; }
140
+ echo "All checks passed."
141
+ }
142
+
143
+ cmd_backup() { compose exec -T backup sh /usr/local/bin/freeholder-backup now; }
144
+
145
+ cmd_restore() {
146
+ [ $# -eq 1 ] || die "usage: $0 restore NAME (see: $0 backups)"
147
+ name=$1
148
+ [ "$name" != latest ] || name=$(compose exec -T backup sh -c 'ls -1 /backups | grep -v partial | sort | tail -n 1')
149
+ say "taking a safety backup first"
150
+ cmd_backup
151
+ compose stop app
152
+ compose exec -T backup sh /usr/local/bin/freeholder-backup restore "$name" || { compose start app; die "restore failed; the current data was kept"; }
153
+ compose start app
154
+ compose up -d --wait app
155
+ say "restored $name"
156
+ }
157
+
158
+ cmd_update() {
159
+ [ $# -eq 1 ] || die "usage: $0 update VERSION (see https://github.com/$REPOSITORY/releases)"
160
+ version=${1#v}
161
+ case "$version" in *[!0-9A-Za-z.-]*) die "not a release version: $version" ;; esac
162
+ previous=$(env_get FREEHOLDER_IMAGE)
163
+ say "backing up before the update"
164
+ cmd_backup
165
+ env_set PREVIOUS_FREEHOLDER_IMAGE "$previous"
166
+ env_set FREEHOLDER_IMAGE "ghcr.io/campdenman/freeholder:$version"
167
+ compose pull --quiet app
168
+ if compose up -d --wait app; then
169
+ say "updated to $version; previous image kept as PREVIOUS_FREEHOLDER_IMAGE"
170
+ else
171
+ warn "$version did not become healthy; switching back to $previous"
172
+ env_set FREEHOLDER_IMAGE "$previous"
173
+ compose up -d --wait app
174
+ die "update failed; restore the pre-update backup if it had migrated the database: $0 restore NAME"
175
+ fi
176
+ }
177
+
178
+ usage() {
179
+ cat <<USAGE
180
+ Usage: $0 COMMAND
181
+ prepare [--domain NAME] [--storage local|s3] [--localhost]
182
+ write deploy/docker-selfhost/.env (secrets from openssl)
183
+ start pull the release image, start, print the claim link
184
+ claim-link print the private owner claim link
185
+ check container health, /api/health over HTTPS, latest backup
186
+ backup back up the database and media now (also runs nightly)
187
+ backups list backups
188
+ restore NAME restore a backup (or 'latest'), after a safety backup
189
+ update VERSION switch to a release image, backing up first
190
+ USAGE
191
+ }
192
+
193
+ command=${1:-help}
194
+ [ $# -eq 0 ] || shift
195
+ case "$command" in
196
+ prepare) cmd_prepare "$@" ;;
197
+ start) cmd_start ;;
198
+ claim-link) cmd_claim_link ;;
199
+ check|status) cmd_check ;;
200
+ backup) cmd_backup ;;
201
+ backups) compose exec -T backup ls -1 /backups ;;
202
+ restore) cmd_restore "$@" ;;
203
+ update) cmd_update "$@" ;;
204
+ logs) compose logs -f app ;;
205
+ *) usage ;;
206
+ esac
@@ -3,7 +3,14 @@
3
3
  Complete the shared [Tier-1 verification](../recipe-verification.md), then the
4
4
  platform checks below.
5
5
 
6
- - [ ] `docker compose ps` shows app and postgres healthy.
7
- - [ ] `/api/health` returns `ok` and `version`.
8
- - [ ] Doctor is green.
9
- - [ ] Production storage is not the local disk adapter.
6
+ - [ ] `deploy/docker-selfhost/selfhost.sh check` passes: app, db and backup
7
+ running, the app healthy, and `/api/health` answering over HTTPS with a
8
+ valid certificate.
9
+ - [ ] `/api/health` returns `ok` and the release `version` you installed
10
+ (`FREEHOLDER_IMAGE` is a release tag, not `edge`).
11
+ - [ ] Doctor is green; with local storage it reports media on
12
+ `/var/lib/freeholder/media`.
13
+ - [ ] Upload an image, `docker compose ... up -d --force-recreate app`, and it
14
+ is still there (it is on the `media` volume).
15
+ - [ ] `selfhost.sh backup` then `selfhost.sh restore latest` brings back the
16
+ same pages and media.
@@ -1208,6 +1208,51 @@ v2.
1208
1208
  - **F11** — Beta release notes: `.changeset/customer-self-service.md`; scope and remaining acceptance: `deploy/customer-surfaces-2026-10-07.md`.
1209
1209
  - **F12** — Composed software journeys: `tests/browser/customer-surfaces.spec.ts`, `tests/modules/customer-surfaces.test.ts`; actual provider acceptance remains open in `MASTER.md`.
1210
1210
 
1211
+ ## C2.27 — Blog categories and tags
1212
+
1213
+ - **F01** — Additive blog and reader-comment schema: `db/migrations/0061_blog_structure.sql`, `db/migrations/0062_blog_reader_comments.sql`.
1214
+ - **F02** — Shared typed services: `src/modules/cms/blog-service.ts`, `src/modules/cms/blog-comments.ts`; refusal and published-only checks in `tests/core/blog-structure-comments.test.ts`.
1215
+ - **F03** — Contact resolution, merge/undo, export and erasure: `src/modules/cms/blog-comments.ts`, `tests/core/blog-structure-comments.test.ts`; author contact details stay private.
1216
+ - **F04** — Owner blog, taxonomy, author and moderation screens: `app/(admin)/admin/blog/page.tsx`, `app/(admin)/admin/blog/[kind]/page.tsx`, `app/(admin)/admin/blog/comments/page.tsx`.
1217
+ - **F05** — Registry HTTP/MCP projections and generated SDK: `src/modules/cms/service.ts`, `packages/sdk/src/generated.ts`.
1218
+ - **F06** — Four locale catalogs and semantic tokens: `locales/en.json`, `locales/fr.json`, `locales/es.json`, `locales/ar.json`; browser acceptance remains pending in `deploy/blog-wordpress-2026-11-07.md`.
1219
+ - **F07** — Public email exclusion, moderated publication, honeypot, closed comments, contact merge and erasure: `tests/core/blog-structure-comments.test.ts`.
1220
+ - **F08** — Migration/rollback regressions: `tests/core/wordpress-import-flow.test.ts`; parser regressions: `tests/core/wordpress-import.test.ts`; redirect projection: `tests/core/legacy-redirect-proxy.test.ts`.
1221
+ - **F09** — Explicit operational limits, source crawl and cutover review: `deploy/blog-wordpress-2026-11-07.md`.
1222
+ - **F10** — Bounded redirect lookup, no cookie forwarding and outage fallback: `src/core/seo/legacy-proxy.ts`, `tests/core/legacy-redirect-proxy.test.ts`; scale acceptance remains pending.
1223
+ - **F11** — Release notes and qualified claims: `.changeset/blog-wordpress-structure.md`, `deploy/blog-wordpress-2026-11-07.md`.
1224
+ - **F12** — Partial software evidence: `tests/core/wordpress-import-flow.test.ts`, `tests/core/blog-structure-comments.test.ts`; deployment and source URL acceptance remain open in `deploy/blog-wordpress-2026-11-07.md`.
1225
+
1226
+ ## C2.28 — Blog author profiles
1227
+
1228
+ - **F01** — Additive blog and reader-comment schema: `db/migrations/0061_blog_structure.sql`, `db/migrations/0062_blog_reader_comments.sql`.
1229
+ - **F02** — Shared typed services: `src/modules/cms/blog-service.ts`, `src/modules/cms/blog-comments.ts`; refusal and published-only checks in `tests/core/blog-structure-comments.test.ts`.
1230
+ - **F03** — Contact resolution, merge/undo, export and erasure: `src/modules/cms/blog-comments.ts`, `tests/core/blog-structure-comments.test.ts`; author contact details stay private.
1231
+ - **F04** — Owner blog, taxonomy, author and moderation screens: `app/(admin)/admin/blog/page.tsx`, `app/(admin)/admin/blog/[kind]/page.tsx`, `app/(admin)/admin/blog/comments/page.tsx`.
1232
+ - **F05** — Registry HTTP/MCP projections and generated SDK: `src/modules/cms/service.ts`, `packages/sdk/src/generated.ts`.
1233
+ - **F06** — Four locale catalogs and semantic tokens: `locales/en.json`, `locales/fr.json`, `locales/es.json`, `locales/ar.json`; browser acceptance remains pending in `deploy/blog-wordpress-2026-11-07.md`.
1234
+ - **F07** — Public email exclusion, moderated publication, honeypot, closed comments, contact merge and erasure: `tests/core/blog-structure-comments.test.ts`.
1235
+ - **F08** — Migration/rollback regressions: `tests/core/wordpress-import-flow.test.ts`; parser regressions: `tests/core/wordpress-import.test.ts`; redirect projection: `tests/core/legacy-redirect-proxy.test.ts`.
1236
+ - **F09** — Explicit operational limits, source crawl and cutover review: `deploy/blog-wordpress-2026-11-07.md`.
1237
+ - **F10** — Bounded redirect lookup, no cookie forwarding and outage fallback: `src/core/seo/legacy-proxy.ts`, `tests/core/legacy-redirect-proxy.test.ts`; scale acceptance remains pending.
1238
+ - **F11** — Release notes and qualified claims: `.changeset/blog-wordpress-structure.md`, `deploy/blog-wordpress-2026-11-07.md`.
1239
+ - **F12** — Partial software evidence: `tests/core/wordpress-import-flow.test.ts`, `tests/core/blog-structure-comments.test.ts`; deployment and source URL acceptance remain open in `deploy/blog-wordpress-2026-11-07.md`.
1240
+
1241
+ ## C2.29 — Moderated public reader comments
1242
+
1243
+ - **F01** — Additive blog and reader-comment schema: `db/migrations/0061_blog_structure.sql`, `db/migrations/0062_blog_reader_comments.sql`.
1244
+ - **F02** — Shared typed services: `src/modules/cms/blog-service.ts`, `src/modules/cms/blog-comments.ts`; refusal and published-only checks in `tests/core/blog-structure-comments.test.ts`.
1245
+ - **F03** — Contact resolution, merge/undo, export and erasure: `src/modules/cms/blog-comments.ts`, `tests/core/blog-structure-comments.test.ts`; author contact details stay private.
1246
+ - **F04** — Owner blog, taxonomy, author and moderation screens: `app/(admin)/admin/blog/page.tsx`, `app/(admin)/admin/blog/[kind]/page.tsx`, `app/(admin)/admin/blog/comments/page.tsx`.
1247
+ - **F05** — Registry HTTP/MCP projections and generated SDK: `src/modules/cms/service.ts`, `packages/sdk/src/generated.ts`.
1248
+ - **F06** — Four locale catalogs and semantic tokens: `locales/en.json`, `locales/fr.json`, `locales/es.json`, `locales/ar.json`; browser acceptance remains pending in `deploy/blog-wordpress-2026-11-07.md`.
1249
+ - **F07** — Public email exclusion, moderated publication, honeypot, closed comments, contact merge and erasure: `tests/core/blog-structure-comments.test.ts`.
1250
+ - **F08** — Migration/rollback regressions: `tests/core/wordpress-import-flow.test.ts`; parser regressions: `tests/core/wordpress-import.test.ts`; redirect projection: `tests/core/legacy-redirect-proxy.test.ts`.
1251
+ - **F09** — Explicit operational limits, source crawl and cutover review: `deploy/blog-wordpress-2026-11-07.md`.
1252
+ - **F10** — Bounded redirect lookup, no cookie forwarding and outage fallback: `src/core/seo/legacy-proxy.ts`, `tests/core/legacy-redirect-proxy.test.ts`; scale acceptance remains pending.
1253
+ - **F11** — Release notes and qualified claims: `.changeset/blog-wordpress-structure.md`, `deploy/blog-wordpress-2026-11-07.md`.
1254
+ - **F12** — Partial software evidence: `tests/core/wordpress-import-flow.test.ts`, `tests/core/blog-structure-comments.test.ts`; deployment and source URL acceptance remain open in `deploy/blog-wordpress-2026-11-07.md`.
1255
+
1211
1256
  ## C3.01 — Add required output schemas to every service and validate
1212
1257
 
1213
1258
  - **F01** — No item-dedicated migration is named in §43; schema is owned per-module and applied through `db/migrations/0000_reviewed-baseline.sql` (reviewed baseline, C10.19); database coverage in `tests/core/service-output.test.ts`.
@@ -1847,6 +1892,50 @@ v2.
1847
1892
  - **F11** — `deploy/doc-claim-mapping.md`: strike S11 records the gap in MASTER §26 item 3; changeset when it ships.
1848
1893
  - **F12** — `tests/core/plugins-lifecycle.test.ts`: Pending — publisher signs → registry index verified → plugin installed and verified.
1849
1894
 
1895
+ ## C3.44 — WordPress-easy manual install on any host, native first, Docker optional
1896
+
1897
+ - **F01** — N/A — no schema change; media rows are unchanged and local-disk objects keep their storage keys as paths.
1898
+ - **F02** — `src/adapters/storage/local-mode.ts`: one rule for the persistent local-disk mode, used by `src/adapters/storage/local.ts`, Doctor and the update screen and preflight; `tests/core/local-storage-mode.test.ts`, `tests/core/storage.test.ts`.
1899
+ - **F03** — N/A — no contact or money record; media stays behind `authorizeObjectDelivery` in `app/media/[...key]/route.ts`.
1900
+ - **F04** — N/A as a new screen — Doctor and `/admin/updates` report the storage mode; the operator surface is `deploy/linux/freeholder` (`status`, `backup`, `restore`, `update`, `rollback`, `domain`, `claim-link`).
1901
+ - **F05** — `deploy/linux/install.sh`, `deploy/linux/freeholder` and `deploy/docker-selfhost/selfhost.sh` are the operator interfaces; no service change.
1902
+ - **F06** — N/A — operator shell output in English; no product copy changed.
1903
+ - **F07** — `tests/core/linux-install.test.ts` covers checksum-before-unpack, private secrets, safety backup before restore, and rollback of release and database after a failed update.
1904
+ - **F08** — `.github/workflows/release-tarballs.yml` installs each tarball with `install.sh` on x64 and arm64 runners against real PostgreSQL, then backs up and restores it; `tests/core/deploy-recipe.test.ts` pins the Docker volume and backup service.
1905
+ - **F09** — `deploy/linux/README.md` and `deploy/docker-selfhost/README.md`: nightly database and media backups with checksums, restore into a scratch database, the replaced database kept, and offsite copies.
1906
+ - **F10** — N/A — local reads go through the existing `/media` route; no new per-request work.
1907
+ - **F11** — `GETTING_STARTED.md`, `AGENTS.md`, `deploy/README.md`, `deploy/linux/README.md`; changeset `native-linux-install.md`.
1908
+ - **F12** — `.github/workflows/release-tarballs.yml`: Pending — a release carrying the tarballs, then the documented steps on a fresh server (HTTPS, claim, publish, backup, restore).
1909
+
1910
+ ## C3.45 — Managed PM-hosted preview assistant
1911
+
1912
+ - **F01** — N/A — no new Freeholder table; existing assistant settings/turns and canonical chat messages remain authoritative. PM owns the separate backend migration.
1913
+ - **F02** — `src/modules/assistant/preview.ts`, `src/modules/assistant/service.ts`, `src/adapters/paradise/assistant.ts`; visitor binding, owner permission and budget behavior in `tests/modules/preview-assistant.test.ts`.
1914
+ - **F03** — `src/modules/assistant/service.ts`, `src/modules/assistant/preview.ts`: text and explicitly browser-observed captions use existing conversation messages; actual managed list-price receipts settle the assistant turn meter. No invoice or consent is created by captions.
1915
+ - **F04** — `app/(admin)/admin/assistant/page.tsx`, `src/modules/cms/blocks/PreviewAssistantCall.tsx`; Pending — real approved media and owner-control acceptance.
1916
+ - **F05** — Registered `assistant.previewCall`, `assistant.managedDetails`, `assistant.syncManagedSettings`; HTTP uses the same service objects. `tests/core/registry-completeness.test.ts`, `tests/core/sdk.test.ts`.
1917
+ - **F06** — Four shipped locales, `tests/core/i18n-gate.test.ts`, `tests/core/locale-quality.test.ts`; Pending — dedicated keyboard/axe proof of the call widget.
1918
+ - **F07** — `tests/modules/preview-assistant.test.ts`: cross-visitor cookie binding, off/End, exact origins, unknown-charge holds and concurrent budget claims. No chatbot age gate.
1919
+ - **F08** — `tests/modules/preview-assistant.test.ts`, existing `tests/modules/assistant.test.ts`, `tests/core/launch-template.test.ts`; native PostgreSQL and pinned shared transport/codec hashes.
1920
+ - **F09** — `src/core/messaging/chat.ts`, `src/modules/assistant/preview.ts`: existing messaging privacy/retention spine applies; no separate transcript store. Pending — real call lifecycle and full product export/erase acceptance.
1921
+ - **F10** — `deploy/managed-preview-assistant.md`; scoped server-side integration and explicit text fallback. No unrelated page opens worker origins.
1922
+ - **F11** — `MASTER.md` C3.45 and `.changeset/managed-preview-assistant.md`; coordinated backend/consumer release order is documented.
1923
+ - **F12** — `deploy/managed-preview-assistant.md`: Pending — protected exact-head CI, deployed compatible consumer/backend, text fallback, owner controls, approved media readiness, ordinary End, worker stop and one settlement. Sienna listening/asset clearance is still required.
1924
+ ## C3.46 — SEO-safe WordPress migration
1925
+
1926
+ - **F01** — Additive blog and reader-comment schema: `db/migrations/0061_blog_structure.sql`, `db/migrations/0062_blog_reader_comments.sql`.
1927
+ - **F02** — Shared typed services: `src/modules/cms/blog-service.ts`, `src/modules/cms/blog-comments.ts`; refusal and published-only checks in `tests/core/blog-structure-comments.test.ts`.
1928
+ - **F03** — Contact resolution, merge/undo, export and erasure: `src/modules/cms/blog-comments.ts`, `tests/core/blog-structure-comments.test.ts`; author contact details stay private.
1929
+ - **F04** — Owner blog, taxonomy, author and moderation screens: `app/(admin)/admin/blog/page.tsx`, `app/(admin)/admin/blog/[kind]/page.tsx`, `app/(admin)/admin/blog/comments/page.tsx`.
1930
+ - **F05** — Registry HTTP/MCP projections and generated SDK: `src/modules/cms/service.ts`, `packages/sdk/src/generated.ts`.
1931
+ - **F06** — Four locale catalogs and semantic tokens: `locales/en.json`, `locales/fr.json`, `locales/es.json`, `locales/ar.json`; browser acceptance remains pending in `deploy/blog-wordpress-2026-11-07.md`.
1932
+ - **F07** — Public email exclusion, moderated publication, honeypot, closed comments, contact merge and erasure: `tests/core/blog-structure-comments.test.ts`.
1933
+ - **F08** — Migration/rollback regressions: `tests/core/wordpress-import-flow.test.ts`; parser regressions: `tests/core/wordpress-import.test.ts`; redirect projection: `tests/core/legacy-redirect-proxy.test.ts`.
1934
+ - **F09** — Explicit operational limits, source crawl and cutover review: `deploy/blog-wordpress-2026-11-07.md`.
1935
+ - **F10** — Bounded redirect lookup, no cookie forwarding and outage fallback: `src/core/seo/legacy-proxy.ts`, `tests/core/legacy-redirect-proxy.test.ts`; scale acceptance remains pending.
1936
+ - **F11** — Release notes and qualified claims: `.changeset/blog-wordpress-structure.md`, `deploy/blog-wordpress-2026-11-07.md`.
1937
+ - **F12** — Partial software evidence: `tests/core/wordpress-import-flow.test.ts`, `tests/core/blog-structure-comments.test.ts`; deployment and source URL acceptance remain open in `deploy/blog-wordpress-2026-11-07.md`.
1938
+
1850
1939
  ## C4.01 — Build the work board, task tree/dependency view, assignment
1851
1940
 
1852
1941
  - **F01** — No item-dedicated migration is named in §43; schema is owned per-module and applied through `db/migrations/0000_reviewed-baseline.sql` (reviewed baseline, C10.19); database coverage in `tests/core/agents-board.test.ts`.
@@ -0,0 +1,28 @@
1
+ # Copyright (C) 2026 Tony Aly
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ # /etc/freeholder/freeholder.env on a native install. `freeholder setup`
4
+ # writes it (root:freeholder, mode 640) and generates every secret with
5
+ # `openssl rand -hex 32`; you never need to fill it in by hand. Shown here so
6
+ # you know what is in it. Never use this example as a live file.
7
+ APP_URL=https://example.com
8
+ DATABASE_URL=postgres://freeholder:GENERATED@127.0.0.1:5432/freeholder
9
+ POSTGRES_PASSWORD=GENERATED
10
+ BOOTSTRAP_SECRET=GENERATED
11
+ SESSION_SECRET=GENERATED
12
+ CREDENTIAL_KEY=GENERATED
13
+ TRUSTED_CLIENT_IP_HEADER=x-freeholder-client-ip
14
+ FREEHOLDER_SEED_DEMO=0
15
+ # Media on this server's disk (default), included in the nightly backup.
16
+ FREEHOLDER_STORAGE=local
17
+ LOCAL_STORAGE_ROOT=/var/lib/freeholder/media
18
+ # Or S3-compatible storage: `freeholder setup --storage s3` asks for these.
19
+ # FREEHOLDER_STORAGE=s3
20
+ # S3_ENDPOINT=
21
+ # S3_REGION=
22
+ # S3_BUCKET=
23
+ # S3_ACCESS_KEY_ID=
24
+ # S3_SECRET_ACCESS_KEY=
25
+ # Optional: Let's Encrypt contact address, backups kept, offsite copy.
26
+ # ACME_EMAIL=
27
+ # BACKUP_KEEP=14
28
+ # BACKUP_RCLONE_REMOTE=offsite:my-backup-bucket/freeholder
@@ -0,0 +1,181 @@
1
+ # Linux server, no Docker (Tier 2)
2
+
3
+ Freeholder on one Ubuntu or Debian server: a release tarball that carries its
4
+ own Node.js runtime, PostgreSQL from the distribution, Caddy for automatic
5
+ HTTPS, and systemd. No Docker, Node, pnpm or source checkout on the server,
6
+ and no AI assistant needed. This is the WordPress-style install: download it,
7
+ run it, open the link.
8
+
9
+ ## What you need
10
+
11
+ - A server running **Ubuntu 22.04 or newer, or Debian 12 or newer**, on x86_64
12
+ or arm64, with root access over SSH. 2 GB of memory works while the site is
13
+ small; 4 GB (2 vCPUs) is comfortable. Any provider works: DigitalOcean,
14
+ Hetzner, Linode, Vultr, OVH, AWS Lightsail, a box under your desk.
15
+ - Ports 80 and 443 open to the internet (Caddy needs both for the
16
+ certificate).
17
+ - Optionally, a domain. Without one, the site starts at a temporary
18
+ `https://<ip>.sslip.io` address with a real certificate, and you move it to
19
+ your domain later.
20
+
21
+ ## Install
22
+
23
+ ```sh
24
+ curl -fsSLO https://github.com/CampDenman/freeholder/releases/download/v0.2.0-beta.6/install.sh
25
+ less install.sh # optional: read what it does
26
+ sudo sh install.sh # asks for your domain; Enter = temporary address
27
+ ```
28
+
29
+ `--domain example.com` skips the question. If that domain does not point at
30
+ the server yet, the installer starts on the temporary address and tells you the
31
+ command for later. It finishes in a few minutes and prints your private owner
32
+ claim link. Open it yourself, create the owner account and save the recovery
33
+ codes. Get the link again any time with `sudo freeholder claim-link`.
34
+
35
+ The installer, in order:
36
+
37
+ 1. installs PostgreSQL (the distribution's package, or the official
38
+ PostgreSQL apt repository when the distribution's is older than 15), Caddy
39
+ (from Caddy's official apt repository), `curl` and `openssl`;
40
+ 2. creates a `freeholder` system user;
41
+ 3. downloads `freeholder-VERSION-linux-ARCH.tar.gz` from the GitHub release,
42
+ checks it against the published `.sha256`, and unpacks it to
43
+ `/opt/freeholder/releases/VERSION` with `/opt/freeholder/current` pointing
44
+ at it;
45
+ 4. runs `freeholder setup` from that release, which creates the database and
46
+ role, writes `/etc/freeholder/freeholder.env` with secrets from
47
+ `openssl rand -hex 32`, installs the systemd units and the nightly backup
48
+ timer, writes `/etc/caddy/Caddyfile`, opens 80/443 if `ufw` is active, and
49
+ starts everything.
50
+
51
+ Running it again is safe: secrets, data and settings are kept. To check what
52
+ you downloaded came from this repository's release workflow, run
53
+ `gh attestation verify freeholder-*.tar.gz --repo CampDenman/freeholder`.
54
+
55
+ ## Where everything is
56
+
57
+ | Path | What |
58
+ |---|---|
59
+ | `/opt/freeholder/releases/VERSION` | Unpacked releases (root-owned, read-only to the app) |
60
+ | `/opt/freeholder/current` | Symlink to the running release |
61
+ | `/etc/freeholder/freeholder.env` | Settings and secrets (`root:freeholder`, mode 640) |
62
+ | `/var/lib/freeholder/media` | Uploaded media (local storage) |
63
+ | `/var/lib/freeholder/backups` | Nightly backups (root only) |
64
+ | `/etc/caddy/Caddyfile` | HTTPS proxy, rewritten by `freeholder setup` and `freeholder domain` |
65
+ | `freeholder.service`, `freeholder-backup.timer` | systemd units |
66
+
67
+ The app listens on `127.0.0.1:3000` only and PostgreSQL on localhost only;
68
+ Caddy is the only way in. Migrations run when the service starts, before it
69
+ reports ready.
70
+
71
+ ## Day to day
72
+
73
+ ```sh
74
+ sudo freeholder status # service, database, HTTPS certificate, storage, backups
75
+ sudo freeholder logs # follow the application log
76
+ sudo freeholder claim-link # the owner claim link, until the owner exists
77
+ ```
78
+
79
+ `freeholder status` is this recipe's health check (the Doctor): it needs no
80
+ Node, pnpm or checkout.
81
+
82
+ ## Media storage: local disk or S3
83
+
84
+ By default uploaded media is stored on the server in
85
+ `/var/lib/freeholder/media` and served through Freeholder, which checks access
86
+ on every request (private galleries, paid files and trashed media stay
87
+ private). It is in every backup.
88
+
89
+ | | Local disk (default) | S3-compatible bucket |
90
+ |---|---|---|
91
+ | Setup | Nothing to do | Create a private bucket and a key scoped to it |
92
+ | Cost | Server disk | A few dollars a month |
93
+ | Survives losing the server | Only through your backups, so copy them off the server | Yes, media lives elsewhere |
94
+ | More than one app server | No | Yes |
95
+ | Large uploads | Through the app | Direct, resumable browser uploads |
96
+
97
+ To start with S3: `sudo sh install.sh --storage s3` (it asks for the endpoint,
98
+ region, bucket and key). To move an existing site to S3 later, copy the media
99
+ directory to the bucket with the same paths
100
+ (`rclone copy /var/lib/freeholder/media remote:bucket`), then run
101
+ `sudo freeholder setup --storage s3`.
102
+
103
+ ## Backups and restore
104
+
105
+ `freeholder-backup.timer` runs `freeholder backup` every night at about 03:15
106
+ server time. Each backup is a directory in `/var/lib/freeholder/backups`:
107
+
108
+ - `database.dump`: the whole database (`pg_dump` custom format);
109
+ - `media.tar.gz`: the media directory (local storage only);
110
+ - `RELEASE.json`, `BACKUP`: the version and why it was taken;
111
+ - `SHA256SUMS`: checked before any restore.
112
+
113
+ The newest 14 are kept (`BACKUP_KEEP` in the env file). Backups do not contain
114
+ `/etc/freeholder/freeholder.env`; keep a copy of it somewhere safe once,
115
+ because `CREDENTIAL_KEY` is needed to read stored provider credentials.
116
+
117
+ **Keep a copy off the server.** A backup on the same disk does not survive
118
+ losing the server. Install `rclone`, configure a remote (`rclone config`, for
119
+ example an S3-compatible bucket), and set `BACKUP_RCLONE_REMOTE=remote:bucket/path`
120
+ in `/etc/freeholder/freeholder.env`; every backup is then copied there too.
121
+
122
+ Restore:
123
+
124
+ ```sh
125
+ sudo ls /var/lib/freeholder/backups
126
+ sudo freeholder restore latest # or a directory name from the list
127
+ ```
128
+
129
+ It verifies the checksums, takes a safety backup of the current data, restores
130
+ the database into a scratch database and swaps it in (the replaced one is kept
131
+ as `freeholder_previous`), restores the media (the replaced directory is kept
132
+ as `/var/lib/freeholder/media.previous`), restarts and waits until the site is
133
+ ready. To restore on a new server, install Freeholder there, copy the old
134
+ `freeholder.env` secrets you kept (at least `CREDENTIAL_KEY`) into the new
135
+ `/etc/freeholder/freeholder.env`, copy the backup directory over, and run
136
+ `sudo freeholder restore /path/to/it`.
137
+
138
+ ## Updates
139
+
140
+ ```sh
141
+ sudo freeholder update latest # or: sudo freeholder update 0.2.0-beta.6
142
+ sudo freeholder rollback # undo the last update
143
+ ```
144
+
145
+ `update` downloads the release, checks its SHA-256, unpacks it beside the
146
+ current one, takes a backup, switches `current`, restarts and waits for
147
+ `/api/health`. If the new release does not become ready it switches back and
148
+ restores the database from that pre-update backup, because the new release
149
+ may already have migrated it. `rollback` does the same on request. The three
150
+ newest releases are kept. Release notes are on the
151
+ [releases page](https://github.com/CampDenman/freeholder/releases).
152
+
153
+ ## Moving to your real domain
154
+
155
+ Point the domain's `A` record at the server, wait until `dig +short
156
+ example.com` shows its address, then:
157
+
158
+ ```sh
159
+ sudo freeholder domain example.com
160
+ ```
161
+
162
+ Passkeys belong to the address they were created on. After the move, sign in
163
+ with your password at the new address and add a passkey again under
164
+ Settings → Security.
165
+
166
+ ## Removing it
167
+
168
+ ```sh
169
+ sudo systemctl disable --now freeholder freeholder-backup.timer
170
+ sudo rm -rf /opt/freeholder /etc/freeholder /etc/systemd/system/freeholder*.service \
171
+ /etc/systemd/system/freeholder-backup.timer /usr/local/bin/freeholder
172
+ sudo -u postgres dropdb freeholder; sudo -u postgres dropuser freeholder
173
+ # Your data and backups stay in /var/lib/freeholder until you delete it.
174
+ ```
175
+
176
+ ## Building the tarball yourself
177
+
178
+ From a checkout on Linux of the architecture you want:
179
+ `pnpm install --frozen-lockfile && pnpm build && pnpm release:build`. It writes
180
+ `dist/release/freeholder-VERSION-linux-ARCH.tar.gz`, its `.sha256` and
181
+ `install.sh`; install it with `sudo sh install.sh --tarball FILE`.