@rocket.chat/houston 0.27.0-next.3 → 2.1.9

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 (294) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +109 -15
  3. package/bin/houston +62 -0
  4. package/data/docs/ARCHITECTURE.md +387 -0
  5. package/data/docs/automation.md +107 -0
  6. package/data/docs/e2ee.md +76 -0
  7. package/data/docs/eks.md +258 -0
  8. package/data/docs/gui.md +282 -0
  9. package/data/docs/guide.md +642 -0
  10. package/data/docs/kubernetes.md +138 -0
  11. package/data/docs/loadtest.md +264 -0
  12. package/data/docs/troubleshooting.md +203 -0
  13. package/data/docs/upgrading.md +84 -0
  14. package/data/docs/voice.md +253 -0
  15. package/data/iam/engineer-policy.json +11 -0
  16. package/data/iam/engineer-rbac.yaml +42 -0
  17. package/data/iam/operator-policy.json +211 -0
  18. package/data/loadtest/badbot.js +22 -0
  19. package/data/loadtest/common.js +170 -0
  20. package/data/loadtest/custom.js +20 -0
  21. package/data/loadtest/journey.js +58 -0
  22. package/data/loadtest/login.js +18 -0
  23. package/data/loadtest/messages.js +13 -0
  24. package/data/loadtest/mixed.js +57 -0
  25. package/data/loadtest/read.js +12 -0
  26. package/data/loadtest/webhook.js +20 -0
  27. package/data/monitoring/houston-logs.json +98 -0
  28. package/data/monitoring/k6-loadtest.json +610 -0
  29. package/data/monitoring/mongodb-exporter.json +3007 -0
  30. package/data/monitoring/node-exporter-full.json +16114 -0
  31. package/data/monitoring/rocketchat-metrics.json +6471 -0
  32. package/data/presets/airgapped.yaml +16 -0
  33. package/data/presets/default.yaml +9 -0
  34. package/data/seed/avatar-0.png +0 -0
  35. package/data/seed/avatar-1.png +0 -0
  36. package/data/seed/avatar-2.png +0 -0
  37. package/data/seed/avatar-3.png +0 -0
  38. package/data/seed/avatar-4.png +0 -0
  39. package/data/seed/avatar-5.png +0 -0
  40. package/data/seed/avatar-6.png +0 -0
  41. package/data/seed/avatar-7.png +0 -0
  42. package/data/seed/seed-metrics.csv +3 -0
  43. package/data/seed/seed-preview.png +0 -0
  44. package/data/seed/seed-report.pdf +32 -0
  45. package/data/seed/seed-runbook.txt +3 -0
  46. package/data/skill/SKILL.md +399 -0
  47. package/data/versions.yaml +55 -0
  48. package/data/voice/freeswitch/drachtio.xml +52 -0
  49. package/data/voice/freeswitch/public.xml +87 -0
  50. package/data/webui/app.css +2003 -0
  51. package/data/webui/index.html +678 -0
  52. package/data/webui/js/api.js +561 -0
  53. package/data/webui/js/boot.js +44 -0
  54. package/data/webui/js/clusters-tail.js +1377 -0
  55. package/data/webui/js/clusters.js +896 -0
  56. package/data/webui/js/create.js +276 -0
  57. package/data/webui/js/detail.js +507 -0
  58. package/data/webui/js/jobs.js +636 -0
  59. package/data/webui/js/logs.js +634 -0
  60. package/data/webui/js/main.js +14 -0
  61. package/data/webui/js/options.js +408 -0
  62. package/data/webui/js/people.js +438 -0
  63. package/data/webui/js/perf.js +303 -0
  64. package/data/webui/js/render.js +438 -0
  65. package/data/webui/js/shared.js +3 -0
  66. package/data/webui/js/state.js +583 -0
  67. package/data/webui/js/theme.js +123 -0
  68. package/data/webui/js/util.js +584 -0
  69. package/dist/cli/app.js +593 -0
  70. package/dist/cli/capabilities.js +76 -0
  71. package/dist/cli/cell-widths.js +495 -0
  72. package/dist/cli/entry.js +10 -0
  73. package/dist/cli/error-panel.js +492 -0
  74. package/dist/cli/handlers/actor.js +84 -0
  75. package/dist/cli/handlers/https.js +614 -0
  76. package/dist/cli/handlers/prompt.js +299 -0
  77. package/dist/cli/handlers/users.js +226 -0
  78. package/dist/cli/handlers.js +3694 -0
  79. package/dist/cli/help.js +183 -0
  80. package/dist/cli/index.js +15 -0
  81. package/dist/cli/perf.js +814 -0
  82. package/dist/cli/render.js +254 -0
  83. package/dist/cli/serve.js +858 -0
  84. package/dist/cli/spec-data.js +2599 -0
  85. package/dist/cli/spec-types.js +8 -0
  86. package/dist/cli/usage-error.js +520 -0
  87. package/dist/cli/wire.js +70 -0
  88. package/dist/core/audit.js +346 -0
  89. package/dist/core/backup-compat.js +85 -0
  90. package/dist/core/backup.js +1639 -0
  91. package/dist/core/cluster.js +1398 -0
  92. package/dist/core/configimport.js +345 -0
  93. package/dist/core/data.js +267 -0
  94. package/dist/core/database-of.js +82 -0
  95. package/dist/core/diagnose.js +159 -0
  96. package/dist/core/doctor.js +1518 -0
  97. package/dist/core/edge/acme.js +338 -0
  98. package/dist/core/edge/engine.js +500 -0
  99. package/dist/core/edge/networks.js +174 -0
  100. package/dist/core/edge/paths.js +107 -0
  101. package/dist/core/edge/routes.js +251 -0
  102. package/dist/core/edge/routeyml.js +195 -0
  103. package/dist/core/edge/runtime.js +493 -0
  104. package/dist/core/edge/spec.js +305 -0
  105. package/dist/core/edge/types.js +202 -0
  106. package/dist/core/eks-docs.js +135 -0
  107. package/dist/core/eks.js +2240 -0
  108. package/dist/core/envvars.js +562 -0
  109. package/dist/core/eventlog.js +541 -0
  110. package/dist/core/firstrun.js +153 -0
  111. package/dist/core/journal.js +694 -0
  112. package/dist/core/kube/ask.js +231 -0
  113. package/dist/core/kube/capabilities.js +269 -0
  114. package/dist/core/kube/certmanager.js +452 -0
  115. package/dist/core/kube/chart.js +413 -0
  116. package/dist/core/kube/cluster.js +196 -0
  117. package/dist/core/kube/context.js +545 -0
  118. package/dist/core/kube/endpoints.js +448 -0
  119. package/dist/core/kube/exec.js +195 -0
  120. package/dist/core/kube/forward.js +732 -0
  121. package/dist/core/kube/grafana-ingress.js +110 -0
  122. package/dist/core/kube/ingress.js +218 -0
  123. package/dist/core/kube/manifests.js +361 -0
  124. package/dist/core/kube/monitoring.js +768 -0
  125. package/dist/core/kube/names.js +237 -0
  126. package/dist/core/kube/namespace.js +678 -0
  127. package/dist/core/kube/operator.js +941 -0
  128. package/dist/core/kube/probe.js +202 -0
  129. package/dist/core/kube/reachability.js +163 -0
  130. package/dist/core/kube/release.js +439 -0
  131. package/dist/core/kube/replicaset.js +180 -0
  132. package/dist/core/kube/scale.js +398 -0
  133. package/dist/core/kube/status.js +633 -0
  134. package/dist/core/kube/tools.js +238 -0
  135. package/dist/core/kube/transfer.js +173 -0
  136. package/dist/core/kube/workspace.js +423 -0
  137. package/dist/core/lifecycle/admin.js +64 -0
  138. package/dist/core/lifecycle/create-docker.js +1549 -0
  139. package/dist/core/lifecycle/create-k8s.js +960 -0
  140. package/dist/core/lifecycle/destroy.js +339 -0
  141. package/dist/core/lifecycle/inspect.js +636 -0
  142. package/dist/core/lifecycle/naming.js +298 -0
  143. package/dist/core/lifecycle/notes.js +862 -0
  144. package/dist/core/lifecycle/ownership.js +313 -0
  145. package/dist/core/lifecycle/payload.js +401 -0
  146. package/dist/core/lifecycle/ports.js +388 -0
  147. package/dist/core/lifecycle/preconditions.js +367 -0
  148. package/dist/core/lifecycle/pruning.js +551 -0
  149. package/dist/core/lifecycle/ready.js +818 -0
  150. package/dist/core/lifecycle/request.js +510 -0
  151. package/dist/core/lifecycle/seeding.js +281 -0
  152. package/dist/core/lifecycle/sizing.js +392 -0
  153. package/dist/core/lifecycle/state.js +286 -0
  154. package/dist/core/lifecycle/tlsplan.js +704 -0
  155. package/dist/core/lifecycle/types.js +232 -0
  156. package/dist/core/loadtest.js +1051 -0
  157. package/dist/core/migrate.js +612 -0
  158. package/dist/core/monitor.js +494 -0
  159. package/dist/core/postready.js +976 -0
  160. package/dist/core/promote.js +804 -0
  161. package/dist/core/rcapi.js +1336 -0
  162. package/dist/core/recovery.js +75 -0
  163. package/dist/core/runner/engine.js +394 -0
  164. package/dist/core/runner/host.js +298 -0
  165. package/dist/core/runner/locks.js +129 -0
  166. package/dist/core/runner/paths.js +173 -0
  167. package/dist/core/runner/ports.js +172 -0
  168. package/dist/core/runner/queries.js +612 -0
  169. package/dist/core/runner/record.js +563 -0
  170. package/dist/core/scaleseed.js +271 -0
  171. package/dist/core/seed-db.js +208 -0
  172. package/dist/core/sessions.js +472 -0
  173. package/dist/core/skill.js +326 -0
  174. package/dist/core/sso-identities.js +172 -0
  175. package/dist/core/sso.js +703 -0
  176. package/dist/core/tls-local.js +311 -0
  177. package/dist/core/tls.js +878 -0
  178. package/dist/core/topology.js +482 -0
  179. package/dist/core/upgrade.js +877 -0
  180. package/dist/core/users.js +739 -0
  181. package/dist/lib/audit.js +100 -0
  182. package/dist/lib/close-matches.js +238 -0
  183. package/dist/lib/compose.js +672 -0
  184. package/dist/lib/config.js +1398 -0
  185. package/dist/lib/context.js +18 -0
  186. package/dist/lib/errors.js +305 -0
  187. package/dist/lib/events.js +208 -0
  188. package/dist/lib/float-text.js +126 -0
  189. package/dist/lib/format.js +1320 -0
  190. package/dist/lib/home.js +325 -0
  191. package/dist/lib/journal.js +122 -0
  192. package/dist/lib/json-text.js +733 -0
  193. package/dist/lib/jsonout.js +382 -0
  194. package/dist/lib/lock.js +516 -0
  195. package/dist/lib/login-name.js +202 -0
  196. package/dist/lib/map-limit.js +29 -0
  197. package/dist/lib/mkdir-parents.js +90 -0
  198. package/dist/lib/mongo-kernel.js +67 -0
  199. package/dist/lib/monitoring.js +492 -0
  200. package/dist/lib/platform-name.js +59 -0
  201. package/dist/lib/presets/common.js +390 -0
  202. package/dist/lib/presets/composite.js +326 -0
  203. package/dist/lib/presets/e2ee.js +143 -0
  204. package/dist/lib/presets/email.js +172 -0
  205. package/dist/lib/presets/guides.js +27 -0
  206. package/dist/lib/presets/index.js +490 -0
  207. package/dist/lib/presets/keycloak.js +371 -0
  208. package/dist/lib/presets/ldap.js +1285 -0
  209. package/dist/lib/presets/livechat.js +220 -0
  210. package/dist/lib/presets/multi-instance.js +124 -0
  211. package/dist/lib/presets/oidc.js +161 -0
  212. package/dist/lib/presets/public.js +496 -0
  213. package/dist/lib/presets/registry.js +64 -0
  214. package/dist/lib/presets/s3-minio.js +300 -0
  215. package/dist/lib/presets/saml.js +149 -0
  216. package/dist/lib/presets/scenario.js +51 -0
  217. package/dist/lib/presets/types.js +86 -0
  218. package/dist/lib/presets/voice-pbx.js +320 -0
  219. package/dist/lib/presets/voice.js +345 -0
  220. package/dist/lib/presets/webhooks.js +182 -0
  221. package/dist/lib/redact.js +106 -0
  222. package/dist/lib/seed-options.js +68 -0
  223. package/dist/lib/seed-profiles.js +59 -0
  224. package/dist/lib/targz.js +1383 -0
  225. package/dist/lib/teammode.js +25 -0
  226. package/dist/lib/tempdir.js +162 -0
  227. package/dist/lib/unicode-tables.js +2335 -0
  228. package/dist/lib/version-spec.js +357 -0
  229. package/dist/lib/versions.js +463 -0
  230. package/dist/lib/yaml-dump.js +1361 -0
  231. package/dist/perf/baseline.js +168 -0
  232. package/dist/perf/constrain.js +299 -0
  233. package/dist/perf/k6.js +235 -0
  234. package/dist/perf/mongoprof.js +171 -0
  235. package/dist/perf/rcmetrics.js +191 -0
  236. package/dist/perf/report.js +386 -0
  237. package/dist/perf/resources.js +236 -0
  238. package/dist/perf/slo.js +111 -0
  239. package/dist/perf/timeline.js +187 -0
  240. package/dist/perf/timings.js +85 -0
  241. package/dist/perf/verdict.js +201 -0
  242. package/dist/seams/aws-cli.js +126 -0
  243. package/dist/seams/docker-cli.js +280 -0
  244. package/dist/seams/exec.js +861 -0
  245. package/dist/seams/fs/lock.js +528 -0
  246. package/dist/seams/kubectl.js +83 -0
  247. package/dist/seams/rc-http.js +921 -0
  248. package/dist/seed/apply.js +190 -0
  249. package/dist/seed/assets.js +76 -0
  250. package/dist/seed/check.js +391 -0
  251. package/dist/seed/client.js +172 -0
  252. package/dist/seed/executor.js +726 -0
  253. package/dist/seed/history.js +281 -0
  254. package/dist/seed/kinds.js +91 -0
  255. package/dist/seed/plan.js +432 -0
  256. package/dist/seed/receipt.js +339 -0
  257. package/dist/seed/repairs.js +75 -0
  258. package/dist/seed/verification.js +363 -0
  259. package/dist/seed/wording.js +248 -0
  260. package/dist/web/app.js +326 -0
  261. package/dist/web/jobs.js +510 -0
  262. package/dist/web/route-deps.js +211 -0
  263. package/dist/web/route-table.js +213 -0
  264. package/dist/web/routes/backup.js +244 -0
  265. package/dist/web/routes/clusters.js +303 -0
  266. package/dist/web/routes/data.js +187 -0
  267. package/dist/web/routes/edge.js +82 -0
  268. package/dist/web/routes/index.js +63 -0
  269. package/dist/web/routes/jobs.js +95 -0
  270. package/dist/web/routes/logs.js +297 -0
  271. package/dist/web/routes/meta.js +191 -0
  272. package/dist/web/routes/people.js +151 -0
  273. package/dist/web/routes/perf.js +95 -0
  274. package/dist/web/routes/repros.js +550 -0
  275. package/dist/web/routes/session.js +361 -0
  276. package/dist/web/routes/spa.js +198 -0
  277. package/dist/web/security.js +475 -0
  278. package/dist/web/signin.js +246 -0
  279. package/package.json +70 -32
  280. package/.eslintrc +0 -94
  281. package/.swcrc +0 -18
  282. package/dist/bin.js +0 -3
  283. package/dist/cli.js +0 -184
  284. package/dist/commands/createBranch.js +0 -194
  285. package/dist/outputCI.js +0 -59
  286. package/src/bin.js +0 -4
  287. package/src/cli.ts +0 -25
  288. package/src/commands/createBranch.ts +0 -28
  289. package/src/outputCI.ts +0 -12
  290. package/src-old/logs.js +0 -323
  291. package/src-old/md.js +0 -191
  292. package/src-old/release-table.js +0 -60
  293. package/src-old/set-version.js +0 -614
  294. package/src-old/utils.js +0 -15
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018 Rocket.Chat
3
+ Copyright (c) 2026 Lovekesh Kumar
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,25 +1,119 @@
1
- # Rocket.Chat.Houston
2
- Rocket.Chat internal command line tools for releases
1
+ # houston
3
2
 
4
- This is our primary version of our internal tool to help us on the release process managing merges, version updates in files, history (changelog), commits, pushs, branchs, tags and pull requests.
3
+ houston starts a customer's exact Rocket.Chat version on your machine, so you can
4
+ reproduce their issue in minutes. One command boots that version with a compatible
5
+ MongoDB, and can add LDAP, SAML, OIDC, email, S3 or sample data. When the ticket is
6
+ closed, one command removes it.
5
7
 
6
- It's an inteactive CLI app.
8
+ It is built for Rocket.Chat support engineers. What it starts is for reproducing a
9
+ problem, not for serving real users.
7
10
 
8
- ```
9
- npm i -g @rocket.chat/houston
10
- ```
11
+ ## Before you start
11
12
 
12
- Start release process
13
- ```
14
- houston release
15
- ```
13
+ You need:
14
+
15
+ - **Docker**, with Compose v2 and the daemon running. `docker compose version` should
16
+ print a version.
17
+ - **Node.js 24.10 or newer**. Check with `node --version`.
18
+ - **Internet access**, to pull images and look up which MongoDB a version needs.
19
+ - **Free memory.** A workspace uses about 1.1 GB, and `houston up` refuses to start one
20
+ when the machine does not have room.
21
+
22
+ Kubernetes is optional. The [Kubernetes guide](data/docs/kubernetes.md) covers it.
23
+
24
+ ## Install
16
25
 
17
- Update .github/history.logs
26
+ ```bash
27
+ npm install -g @rocket.chat/houston
28
+ houston doctor
18
29
  ```
19
- houston logs
30
+
31
+ `houston doctor` checks Docker, Compose, disk, memory and ports, and names anything
32
+ that would stop a workspace from starting.
33
+
34
+ Used houston 1.x or rc-repro before? Read [Upgrading](data/docs/upgrading.md) first.
35
+ Your workspaces are kept.
36
+
37
+ ## Your first workspace
38
+
39
+ Start Rocket.Chat 8.5.1 for ticket TICKET-1234:
40
+
41
+ ```bash
42
+ houston up --version 8.5.1 --name TICKET-1234 --wait
20
43
  ```
21
44
 
22
- Update History.md
45
+ - `--version` is the Rocket.Chat version to reproduce on. Give the full version, such
46
+ as `8.5.1`.
47
+ - `--name` is what you call the workspace. Use the ticket id. Names are lowercased, so
48
+ this workspace is `ticket-1234`, and houston says so.
49
+ - `--wait` returns once Rocket.Chat is serving and its setup wizard is done. The first
50
+ run downloads images and can take several minutes. Later runs are faster.
51
+
52
+ Find its address and login:
53
+
54
+ ```bash
55
+ houston info --name TICKET-1234
23
56
  ```
24
- houston md
57
+
58
+ Open the URL it prints in your browser and sign in with the admin login it shows. For
59
+ a workspace on your own machine that is `admin` / `admin123`.
60
+
61
+ When you are finished:
62
+
63
+ ```bash
64
+ houston down --name TICKET-1234 --volumes
25
65
  ```
66
+
67
+ `--volumes` deletes the workspace's data as well, after asking you to confirm. Without
68
+ it, `down` keeps the data, and running the same `up` again brings the workspace back.
69
+
70
+ A workspace only listens on `127.0.0.1`, so nobody else on your network can reach it.
71
+ Keep it that way: every workspace uses the same well-known passwords.
72
+
73
+ ## Day to day
74
+
75
+ | To | Run |
76
+ |---|---|
77
+ | see your workspaces | `houston list` |
78
+ | see a workspace's URL, login and details | `houston info --name <name>` |
79
+ | read its logs | `houston logs --name <name> --tail 100` (add `-f` to follow) |
80
+ | pause it, then resume it | `houston stop --name <name>`, then `houston start --name <name>` |
81
+ | start one with LDAP, SAML, email and so on | `houston up --version 8.5.1 --name <name> --preset ldap --wait` |
82
+ | test an integration or a webhook | `houston up --version 8.5.1 --name <name> --preset webhooks --wait` |
83
+ | fill it with conversations, files and profiles | `houston seed --name <name> --verify-seed` |
84
+ | back it up | `houston backup --name <name>` |
85
+ | upgrade it to another version | `houston upgrade --name <name> --to 8.6.1` |
86
+ | remove it and keep its data | `houston down --name <name>` |
87
+ | remove it and delete its data | `houston down --name <name> --volumes` |
88
+ | use a browser instead of the terminal | `houston serve` |
89
+ | check the machine | `houston doctor` |
90
+
91
+ Every command explains itself with `--help`, for example `houston up --help`.
92
+
93
+ ## Where next
94
+
95
+ | Guide | Read it when |
96
+ |---|---|
97
+ | [User guide](data/docs/guide.md) | you need a preset, sample data, a customer's settings, backups and upgrades, HTTPS, monitoring or the REST API |
98
+ | [Encrypted conversations (E2EE)](data/docs/e2ee.md) | the ticket concerns encrypted DMs, rooms or files |
99
+ | [Voice calls](data/docs/voice.md) | the ticket concerns Voice calls or the SIP integration |
100
+ | [Load testing and capacity](data/docs/loadtest.md) | the ticket is about slowness under load, or how much load a server takes |
101
+ | [Kubernetes](data/docs/kubernetes.md) | the ticket needs Kubernetes, or Rocket.Chat as microservices |
102
+ | [Rocket.Chat on EKS](data/docs/eks.md) | the ticket needs a real cloud cluster. A cluster costs money by the hour, so read the guide before you create one. `houston cluster guide` prints it, and `houston cluster overview` shows what is billing |
103
+ | [Web GUI](data/docs/gui.md) | you prefer a browser, or you share one machine with your team, signing in with Okta or a password |
104
+ | [Scripts and agents](data/docs/automation.md) | a script or a coding agent drives houston: `--json`, exit codes, the agent skill |
105
+ | [Troubleshooting](data/docs/troubleshooting.md) | something does not work |
106
+ | [Upgrading](data/docs/upgrading.md) | you used houston 1.x or rc-repro before |
107
+ | [Contributing](CONTRIBUTING.md) and [Architecture](data/docs/ARCHITECTURE.md) | you want to change houston itself |
108
+
109
+ The guides ship with the package, so they are on every machine houston is installed on.
110
+ `houston cluster guide --path` prints where.
111
+
112
+ ## About
113
+
114
+ houston is maintained by the Rocket.Chat support team and is released under the
115
+ [MIT licence](LICENSE). Report problems at
116
+ [github.com/RocketChat/Rocket.Chat.Houston/issues](https://github.com/RocketChat/Rocket.Chat.Houston/issues).
117
+
118
+ The 1.x source is in the repository's history, in `legacy/` at the
119
+ [v2.1.1 tag](https://github.com/RocketChat/Rocket.Chat.Houston/tree/v2.1.1/legacy).
package/bin/houston ADDED
@@ -0,0 +1,62 @@
1
+ #!/bin/sh
2
+ # houston: the TypeScript build's entry.
3
+ #
4
+ # One implementation, so this file only finds the build and EXECS it. Never a spawn: the
5
+ # build becomes this process, so its exit code IS the caller's, a signal sent to this pid
6
+ # reaches it, and stdin, stdout and stderr (a TTY or not) are the descriptors the caller
7
+ # gave. Node cannot execve; a shell can. The environment below is what the build needs
8
+ # from the process that starts it.
9
+ set -u
10
+
11
+ self=$0
12
+ while [ -h "$self" ]; do
13
+ link=$(readlink "$self") || break
14
+ case $link in
15
+ /*) self=$link ;;
16
+ *) self=$(dirname -- "$self")/$link ;;
17
+ esac
18
+ done
19
+ root=$(CDPATH='' cd -P -- "$(dirname -- "$self")/.." && pwd -P) || {
20
+ printf 'houston: cannot find the directory %s is in. Nothing was run.\n' "$0" >&2
21
+ exit 252
22
+ }
23
+
24
+ # This file's own path, absolute and with its symlinks resolved as $root's are: the command
25
+ # the owner installed, which `serve --print-service` names as its unit's ExecStart (systemd
26
+ # refuses a relative one) rather than the build behind it, so the unit keeps working when
27
+ # the build's location changes. Set on every run, so an inherited value never stands in.
28
+ if here=$(CDPATH='' cd -P -- "$(dirname -- "$self")" && pwd -P); then
29
+ HOUSTON_DISPATCHER=$here/${self##*/}
30
+ export HOUSTON_DISPATCHER
31
+ else
32
+ unset HOUSTON_DISPATCHER
33
+ fi
34
+
35
+ # The network earlier releases reached, by default: they honoured HTTP_PROXY, HTTPS_PROXY
36
+ # and NO_PROXY, and trusted REQUESTS_CA_BUNDLE or CURL_CA_BUNDLE. Node's fetch honours the
37
+ # proxy variables only under NODE_USE_ENV_PROXY, which it reads at startup -- so behind a
38
+ # proxy `versions` fell back to the shipped map where it should have answered from
39
+ # releases.rocket.chat, and doctor called the release endpoint unreachable. A bundle
40
+ # those variables name is added to Node's as NODE_EXTRA_CA_CERTS, which is how a
41
+ # TLS-inspecting proxy's CA reaches both. Either is left as the caller set it.
42
+ NODE_USE_ENV_PROXY=${NODE_USE_ENV_PROXY-1}
43
+ export NODE_USE_ENV_PROXY
44
+ if [ -z "${NODE_EXTRA_CA_CERTS-}" ]; then
45
+ ca=${REQUESTS_CA_BUNDLE:-${CURL_CA_BUNDLE:-}}
46
+ if [ -n "$ca" ]; then NODE_EXTRA_CA_CERTS=$ca; export NODE_EXTRA_CA_CERTS; fi
47
+ fi
48
+
49
+ # A CHECKOUT RUNS ITS SOURCE; AN INSTALLED PACKAGE RUNS THE EMITTED BUILD. The source is
50
+ # what was edited, so on a tree that has src/ it is run through tools/cli.js (swc, no build
51
+ # step); an installed tarball ships dist/ and no src/, so there the emitted build is the
52
+ # only build. Preferring dist/ wherever it existed ran STALE code on a checkout: `yarn
53
+ # build` from before a change left dist/ behind, and a fresh home was claimed with the old
54
+ # marker while `--version`, read from package.json, said the new number. Both are the same
55
+ # code: `tsc` emits dist/ from src/ with no bundler, and the tarball is what `yarn build`
56
+ # is for.
57
+ if [ -f "$root/src/cli/entry.ts" ] && [ -f "$root/tools/cli.js" ]; then
58
+ exec node "$root/tools/cli.js" "$@"
59
+ fi
60
+ if [ -f "$root/dist/cli/entry.js" ]; then exec node "$root/dist/cli/entry.js" "$@"; fi
61
+ printf 'houston: neither src/cli/entry.ts with tools/cli.js nor dist/cli/entry.js is under %s. Nothing was run.\n' "$root" >&2
62
+ exit 252
@@ -0,0 +1,387 @@
1
+ # Architecture
2
+
3
+ Why houston is built the way it is, for a contributor about to change it. Each section is a
4
+ decision and what breaking it costs. [`README.md`](../../README.md) and [`guide.md`](guide.md)
5
+ cover using houston. [`CONTRIBUTING.md`](../../CONTRIBUTING.md) covers setup, the gates and
6
+ writing a preset.
7
+
8
+ ## What houston is
9
+
10
+ houston reproduces a customer's Rocket.Chat issue on their exact version, in minutes. One
11
+ command boots a version-matched Rocket.Chat with a compatible MongoDB, optional backing
12
+ services (LDAP, SAML/OIDC, email, S3, multi-instance) and sample data, and one more removes
13
+ all of it. The Rocket.Chat support team maintains it.
14
+
15
+ ```
16
+ houston up --version 8.5.1 --name TICKET-1234 --wait
17
+ houston down --name TICKET-1234 --volumes
18
+ ```
19
+
20
+ It is TypeScript on Node.js 24.10 or newer. `bin/houston` is a POSIX `sh` script that `exec`s
21
+ `node tools/cli.js` over the source on a checkout (any tree with `src/`) and
22
+ `node dist/cli/entry.js` in an installed package, so a clone needs no build step and never
23
+ runs a stale `dist/`. It `exec`s rather than spawns, so the exit code and signals stay the
24
+ caller's. `tsc` emits `dist/` with no bundler, because a bundler rewrites the `data/` lookup
25
+ in `lib/config.ts`.
26
+
27
+ ## The shape of it
28
+
29
+ **Two front-ends over one service layer.** `houston <cmd>` is the terminal. `houston serve`
30
+ is a browser GUI a support engineer can use without a shell, with named accounts, roles and
31
+ an audit trail.
32
+
33
+ ```
34
+ cli/ web/
35
+ commander app, usage errors Fastify app, guard chain,
36
+ verdicts, handlers, serve ROUTE_ROLES, jobs, SSE/WS
37
+ │ │
38
+ └───────────────────┬───────────────────┘
39
+ ▼
40
+ core/
41
+ the entire behaviour of the product
42
+ lifecycle/ kube/ edge/ runner/ backup doctor eks ...
43
+ with perf/ and seed/ beside it
44
+ │
45
+ ┌────────────┬────────────┼────────────┬─────────────┐
46
+ ▼ ▼ ▼ ▼ ▼
47
+ docker-cli kubectl aws-cli rc-http fs/lock
48
+ docker and kubectl, aws and the only the file
49
+ compose helm, kind eksctl HTTP client lock
50
+ └────────────┴────── seams/exec ───────┴─────────────┘
51
+ the one process-launch boundary
52
+
53
+ lib/ underneath all of it: errors, events, config, lock,
54
+ jsonout, compose, versions, presets/, the contract formatting modules
55
+ ```
56
+
57
+ **Both front-ends call the same `core/` functions.** This is the most important fact about
58
+ the codebase. A change the GUI needs almost always belongs in `core/`, not in `web/routes/`.
59
+ Behaviour placed in one front-end is missing from the other, and because developers use the
60
+ CLI, the GUI is the one that loses it. `cli/serve.ts` builds the app `web/app.ts` exports, so
61
+ `cli/` ranks above `web/`. Service functions are asynchronous, state owners included: `serve`
62
+ is one event loop, and a state owner that blocked on a write would stall every request in it.
63
+
64
+ ### The seams
65
+
66
+ **Six modules touch the outside world, and nothing bypasses them.** Each is thin: it knows
67
+ argv, a timeout, an environment, a URL. The tool-specific ones have a domain half in `core/`.
68
+
69
+ | Seam | Launches | Who may import it |
70
+ |---|---|---|
71
+ | `seams/exec.ts` | every OS process, as an argv tuple, `shell` always false | anything; nothing else may import `child_process` |
72
+ | `seams/docker-cli.ts` | `docker`, `docker compose` | `core/runner/`, `core/edge/`, `core/doctor`, `core/migrate`, `perf/constrain` |
73
+ | `seams/kubectl.ts` | `kubectl`, `helm`, `kind` | `core/kube/exec.ts` alone, which decides which client state a call may see |
74
+ | `seams/aws-cli.ts` | `aws`, `eksctl` | `core/eks.ts` alone, which decides whose account is being spent in |
75
+ | `seams/rc-http.ts` | every HTTP request | `core/rcapi.ts`, where every Rocket.Chat path lives, and `core/sso.ts`, where the identity provider's do |
76
+ | `seams/fs/lock.ts` | the cross-process file lock (Node has no `flock`) | the state owners: `core/runner/locks`, `core/users`, `core/sessions`, `core/eventlog`, `core/promote` |
77
+
78
+ Narrow seams are why the suite runs without Docker, a cluster, an AWS account or the
79
+ network. Error policy stays with the caller: `kubectl` never throws, because a preflight that
80
+ raised on a missing binary would take down `doctor`, the command people run when things are
81
+ missing. `.dependency-cruiser.js` enforces `only-exec-launches-processes`,
82
+ `only-kube-exec-launches-kubectl`, `only-eks-launches-aws` and `only-rcapi-speaks-http`.
83
+ eslint covers what a graph cannot see, `no-restricted-imports` on `child_process` and
84
+ `no-restricted-globals` on `fetch`, each switched off for exactly one file and for tests.
85
+
86
+ ### The layering rule
87
+
88
+ > A module imports only from a strictly lower layer, never sideways within a layer,
89
+ > never upward; anything two siblings both need moves DOWN into their package's
90
+ > layer-0 module; the only permitted upward reference is a registry a lower layer
91
+ > owns and an upper layer registers into.
92
+
93
+ Layers are **ranks**, finer than directories, in the `RANKS` table of
94
+ `tools/dependency-policy.js`. `lib/` fills the bottom and the five seams other than `exec`
95
+ share one rank above it. Then come the tiers of `core/runner/`, `core/edge/`, `core/kube/`,
96
+ `core/lifecycle/`, `perf/` and `seed/`, the services that compose them, `web/`, and `cli/`.
97
+ Two modules in one rank may not import each other. `.dependency-cruiser.js` generates a
98
+ `layer-N-imports-down-only` rule per rank, because a hand-kept n-squared list drifts and a
99
+ drifted layer rule fails open. `tsPreCompilationDeps` makes a type-only import count.
100
+
101
+ The gate fails closed. `yarn depcruise` refuses a module that matches no rank or more than
102
+ one before it cruises a single edge. `yarn depcruise:selftest` plants a cycle, a type-only
103
+ rank-0 to rank-4 edge and a `node:child_process` import, and requires each to be reported:
104
+ dependency-cruiser reports a clean tree when it cannot load `typescript`, and a gate nobody
105
+ has watched fail is a green light with no bulb.
106
+
107
+ **Registries are the one upward reference.** A high module registers into a registry a low
108
+ one owns: `lib/events.ts` for event sinks, `jsonout.onActivate()` for moving prose to stderr,
109
+ and `lib/audit.ts`, `lib/journal.ts` and `lib/teammode.ts`. The real `core/audit`,
110
+ `core/journal` and `core/users` rank above every user of their registry, so the gate refuses
111
+ the direct edge.
112
+
113
+ ### Why `lib/` has its own formatting modules
114
+
115
+ The frozen CLI contract includes exact spellings: how a float prints, where a tie rounds, how
116
+ a truncated JSON file is reported, how a YAML scalar is quoted, which option a typo matches.
117
+ Node answers each one plausibly and differently. So `lib/` carries small, measured
118
+ implementations of exactly those formats (`format`, `float-text`, `json-text`, `yaml-dump`,
119
+ `close-matches`, `mkdir-parents`, `tempdir`, `login-name`, `platform-name`, `home`, `version-spec`,
120
+ `unicode-tables`), and each module's header says where it departs from Node, and why.
121
+
122
+ ## The decisions
123
+
124
+ **Progress is an `Event`, not a print.** `lib/events.ts` defines `Event` and
125
+ `type Emit = (event: Event) => void`, and every long-running service function takes `emit`,
126
+ defaulting to `nullEmit`. The CLI prints events, `web/jobs.ts` buffers them per job and
127
+ `web/routes/jobs.ts` streams them over SSE. A service function that prints instead is
128
+ invisible in the GUI, and a fact returned but never emitted never reaches the GUI's log.
129
+
130
+ **Failure is a raised `ReproError`, not an exit.** `lib/errors.ts` gives every subclass an
131
+ HTTP status for the web layer, a stable `code` for the `--json` envelope and an exit code for
132
+ the CLI, named in `EXIT_CODES`, which `houston capabilities` publishes. A service that ended
133
+ the process would be harmless in a one-shot command and fatal in `serve`, where one bad
134
+ request would take the server down. Nothing under `core/` calls `process.exit`.
135
+
136
+ | Class | HTTP | Exit |
137
+ |---|---|---|
138
+ | `ReproError` | 400 | 1 `internal` |
139
+ | `ValidationError` | 400 | 2 `usage` |
140
+ | `DockerError`, `PreflightError` | 502, 409 | 3 `preflight` |
141
+ | `NotFoundError` (and `MissingRecordError`) | 404 | 4 `not_found` |
142
+ | `NotReadyError` | 409 | 5 `not_ready` |
143
+ | `AuthorityGateError` | 403 | 6 `gate` |
144
+ | `CreateFailedError` | 500 | 7 `create_failed` |
145
+ | `ConflictError` | 409 | 8 `conflict` |
146
+
147
+ **Background jobs are bounded.** `web/jobs.ts` keeps at most `MAX_JOBS = 100` jobs of
148
+ `MAX_EVENTS_PER_JOB = 2000` events, and only the 10 newest finished jobs keep their result. A
149
+ capacity search result is about 118 KB, and `serve` is a long-lived process on a box that runs
150
+ out of RAM first. Job kinds are a closed tuple mapped to pools, so a kind with no pool is a
151
+ compile error.
152
+
153
+ **"I could not ask" is not "it is not there".** This is the rule of `core/kube/`, and the
154
+ costliest to forget. A failed read answered with an empty list looks exactly like "the cluster
155
+ holds none of these", and the teardown or report that acts on it acts on something false. So
156
+ `Answer` (`core/kube/ask.ts`) is `PRESENT`, `ABSENT` or `REFUSED`, and `Reach`
157
+ (`core/kube/reachability.ts`) is `REACH_OK`, `REACH_DENIED`, `REACH_NO_CONTEXT` or
158
+ `REACH_DOWN`. JavaScript lets any object stand in a condition, so eslint's
159
+ `strict-boolean-expressions` disallows objects, and `yarn lint:truthiness` plants
160
+ `if (answer)` to prove the rule is live. `test/core/invariants/kube-source.test.ts` walks the
161
+ package so a new read cannot bring the collapse back, and `core/cluster.ts` shows a fact it
162
+ could not read as `null`, never `0`.
163
+
164
+ **Authorisation is a table, not scattered checks.** `ROUTE_ROLES` in `web/route-table.ts` is
165
+ **DEFAULT DENY**: an unlisted route is refused for everyone with a 403 and an audit line, and
166
+ `installRouteCompleteness` keeps the app from becoming ready while any route is unlisted.
167
+ Reads need readonly. Writes, and reads that hand over credentials (logs, env, a PAT, a raw
168
+ REST call), need member. People management and building or deleting a cloud cluster need
169
+ admin. The table lives in the web layer because the CLI honours `HOUSTON_USER` as given
170
+ (`cli/handlers/actor.ts`), so a check in `core/` would make `HOUSTON_USER=<any admin>` a
171
+ one-word privilege escalation. A policy that must hold at both
172
+ front doors is box configuration, which `core/lifecycle/ownership.ts` reads.
173
+
174
+ **Sessions are server-side so they can be ended.** `core/sessions.ts` issues a 256-bit id and
175
+ stores only its sha256. A session ends after 12h idle or 7d in total. Sign-in is rate-limited
176
+ per client address at `doSignin` in `web/security.ts`, where the scrypt is spent, because
177
+ `core/users.ts` cannot refuse on a counter without also refusing correct passwords. Hashing is
178
+ scrypt from `node:crypto`, with no bcrypt or argon dependency, and an unknown name is checked
179
+ against a dummy hash so it costs what a wrong password costs. `yarn test:timing` measures it.
180
+
181
+ **Okta sign-in is a second way in, never the only one.** `core/sso.ts` runs OpenID Connect
182
+ (authorization code, PKCE, a confidential client) from `GET /signin`, verifies the RS256 ID
183
+ token with `node:crypto`, and resolves the person to an account by the provider's `sub`, kept
184
+ in `core/sso-identities.ts` beside the unchanged `users` file. A first sign-in links an
185
+ account of exactly the same name, or creates a member; an admin account links only after
186
+ `houston users link-sso`, and a different name never links. Every failure is a fixed reason
187
+ code, so a provider that is down or misconfigured costs the button, never `serve`, a password
188
+ sign-in or a live session. Removing an account turns its link into a tombstone in the same
189
+ lock, so the person's next Okta sign-in is refused rather than recreating it.
190
+
191
+ **TLS is a runtime property, not a build-time one.** One Traefik edge holds `:80`/`:443` for
192
+ the box. A workspace gains or loses HTTPS when a route file appears or disappears, never by a
193
+ rebuild. The edge joins each workspace's network live, and each workspace keeps its own
194
+ network, so workspaces still cannot reach each other. `core/lifecycle/tlsplan.ts` makes every
195
+ HTTPS decision before anything is built. Routes address the **container name**, never the
196
+ service alias: every workspace names its service `rocketchat`, so on an edge attached to many
197
+ networks the alias resolves to one of them and would silently serve the wrong workspace.
198
+ `test/core/invariants/edge-and-doctor.test.ts` holds a route to the container.
199
+
200
+ **`--json` is one envelope, and it is the last line.** `lib/jsonout.ts` defines
201
+ `{schema, contract, houston_version, generated_at, ok, data, warnings, error}`. `up` and
202
+ `ready` write NDJSON `houston.event.v1` lines first, then exactly one envelope, failures
203
+ included, so a caller reads to the end and parses one line. stdout carries JSON and nothing
204
+ else: `activate()` moves every human line to stderr, which is how
205
+ `houston info --json > case.json` is a valid document while the person running it still sees
206
+ progress. `PHASES` is closed by the compiler, because `Event.phase` is typed `EmittedPhase`.
207
+
208
+ **Capacity is a preflight that refuses, not a warning.** `checkCapacity()` in
209
+ `core/lifecycle/sizing.ts` reserves host RAM headroom and blocks `up`. houston usually runs on
210
+ a laptop already running other stacks. When memory runs out the kernel picks its own victim,
211
+ and a create that cannot finish leaves a half-made workspace behind.
212
+
213
+ **Everything binds loopback unless told otherwise.** Reproductions ship weak fixed credentials
214
+ (`admin` / `admin123`), so everything binds `DEFAULT_BIND_HOST` (`127.0.0.1`) unless opted out
215
+ with `--bind`, `HOUSTON_BIND_HOST` or `config set bind_host`. A workspace reachable beyond
216
+ loopback gets a generated admin password instead, when it is made: a rebuild keeps the one
217
+ its database holds (`keptAdminPassword`), since Rocket.Chat sets it only on an empty
218
+ database. `PRESET_PORTS` in `lib/config.ts` is the one registry of PREFERRED side ports,
219
+ `MONITOR_PORTS` monitoring's. `core/lifecycle/ports.ts` allocates Rocket.Chat's own port
220
+ and every side and monitoring port under one lock (`claimSidePorts`): preferred first, the
221
+ next free one when another workspace holds it, never another preset's preferred port or a
222
+ voice port. A workspace records only what moved (`extra.side_ports`; monitoring in
223
+ `extra.monitoring_ports`), `runner/record.ts` reads it back (`sidePortsOf`,
224
+ `grafanaPortOf`, `prometheusPortOf`), and the builders take the result as their `ports`
225
+ argument. Only voice's call ports, which phones dial by number, are refused when taken.
226
+
227
+ ## Runtimes and the cloud
228
+
229
+ `core/topology.ts` records the runtime, the deployment and the replicas. `docker` runs on this
230
+ machine as `monolith` or `multi-instance`; `kubernetes` runs on any cluster (kind, k3s, EKS) as
231
+ `microservices` or `monolith`. `api`, `token`, `pat`, `config-import` and ordinary `seed` speak REST to a URL.
232
+ Historical seed creates content through REST, then `core/seed-db.ts` resolves and validates
233
+ the live managed MongoDB target before adjusting only captured message/file timestamps.
234
+ It uses the recorded Docker project or Kubernetes namespace/context and feeds credentials
235
+ through stdin. External or ambiguous databases are refused. Operations that need a compose project call
236
+ `topology.requireCompose()`, which refuses **and names the Kubernetes equivalent**. "Not
237
+ supported" alone leaves the user to find what the author already knew.
238
+
239
+ **The cloud is two verbs at two lifetimes.** `cluster create` runs once per team, takes about
240
+ 20 minutes and bills by the hour from minute one. `up` runs once per ticket, takes minutes
241
+ and is free. **`up` can never create a cloud cluster**, and that is structural: `planCluster()`
242
+ in `core/kube/context.ts` adopts an explicitly named context and never provisions one, and
243
+ `core/kube/cluster.ts` creates only houston's own local cluster. Its `deleteCluster` takes no
244
+ cluster parameter at all. AWS IAM decides who may build a cluster and the cluster's own RBAC
245
+ decides who may use it, so `houston cluster iam-policy` ships three documents from `data/iam/`.
246
+ [`eks.md`](eks.md), which `houston cluster guide` prints, is the procedure.
247
+
248
+ **One answer about clusters, rendered twice.** `cluster.overview()` in `core/cluster.ts`
249
+ reads every AWS context through `status()` (the ledger: nodes, workspaces, cost, who
250
+ built it from the cluster's own tags, expiry, whether it is prepared and whether its DNS
251
+ zone answers) and every other with a glance (whether it answers, its distribution and
252
+ its workspaces); `whereOf()` decides which, from the context name and the API server,
253
+ never a probe. It adds the AWS totals and the preflight, and asks `nextStep()` for the
254
+ AWS stage, a pure table over the six stages every screen names. `houston cluster overview` prints
255
+ it; `/api/clusters/overview` serves it to the Clusters page, Home's Needs you and the
256
+ EKS setup flow. Neither front-end decides what exists, what it costs or what comes next.
257
+
258
+ ## Where things live
259
+
260
+ One line per directory. Where a line uses `·`, it separates ranks, bottom first.
261
+ `git ls-files src` is the authority on what exists (tests live in `test/`), and each module's
262
+ header comment says what it is for.
263
+
264
+ - **`lib/`**, below every service: `errors` `events` `jsonout` `config` `lock` `context`, the registries `audit` `journal` `teammode`, then `compose` `versions` `monitoring` `mongo-kernel` `redact` `seed-profiles` `seed-options` `targz`, and the exact-format modules `format` `float-text` `json-text` `yaml-dump` `close-matches` `mkdir-parents` `tempdir` `login-name` `platform-name` `home` `version-spec` `unicode-tables`, and `map-limit` (a bounded concurrent map the cluster ledger and the region sweep share)
265
+ - **`lib/presets/`**, the dynamic presets (static presets are YAML in `data/presets/`): `types` `guides` (what a preset tells the GUI's preset card: sign in as, try it, good to know) · `registry` · `common` `scenario` `composite` (several presets as one) · `keycloak` `public` (a preset's UIs at paths of the HTTPS name) `voice-pbx` (the voice PBX lab) · `e2ee` `email` `ldap` `livechat` `multi-instance` `oidc` `s3-minio` `saml` `voice` `webhooks` · `index`
266
+ - **`seams/`**, the only doors out: `exec` `docker-cli` `kubectl` `aws-cli` `rc-http`
267
+ - **`seams/fs/`**: `lock`
268
+ - **`core/`**, the shared brain. REST and cloud: `rcapi` `eks` `eks-docs` `cluster` `topology`. HTTPS: `tls` `tls-local`. Data: `backup` `backup-compat` `database-of` `seed-db` `upgrade` `envvars` `monitor` `data` `configimport` `scaleseed` `loadtest` `postready`. Diagnosis: `diagnose` `doctor`. Records: `journal` `recovery` `eventlog` `audit`. People: `users` `sessions` `firstrun`, and Okta sign-in, `sso` with its links `sso-identities`. The home: `skill` `migrate` `promote`
269
+ - **`core/runner/`**, Docker per workspace: `paths` `locks` · `engine` `record` · `host` `ports` `queries`
270
+ - **`core/edge/`**, the shared Traefik edge: `paths` `types` · `engine` · `acme` `networks` · `routeyml` · `spec` · `routes` · `runtime`
271
+ - **`core/kube/`**, the Kubernetes domain half, which selects by label and never by name prefix: `names` · `exec` · `ask` `tools` · `capabilities` `reachability` `replicaset` · `context` · `cluster` `endpoints` `namespace` · `manifests` `probe` `scale` `status` `transfer` · `release` · `operator` · `chart` `monitoring` · `certmanager` `forward` · `ingress` `grafana-ingress` · `workspace`
272
+ - **`core/lifecycle/`**, create, inspect, change and destroy, with no façade (import the module that defines a name): `types` `notes` `admin` · `naming` `request` `ports` `tlsplan` · `sizing` `seeding` `ownership` `inspect` · `preconditions` `payload` `ready` · `state` · `destroy` `pruning` · `create-k8s` · `create-docker`
273
+ - **`perf/`**, what `loadtest` and `capacity` measure: `timings` `slo` `baseline` · `rcmetrics` `resources` `mongoprof` `constrain` `k6` `verdict` `timeline` · `report`
274
+ - **`seed/`**, sample data planned before anything is created and read back after: `kinds` · `wording` `assets` · `plan` `client` · `receipt` · `executor` `history` `verification` · `apply` `repairs` · `check`
275
+ - **`cli/`**, the terminal front door: `spec-types` `wire` `cell-widths` · `spec-data` `error-panel` · `help` `capabilities` `perf` `serve` · `usage-error` · `app` · `render` · `handlers` · `index` `entry`
276
+ - **`cli/handlers/`**: `actor` · `prompt` · `https` `users`
277
+ - **`web/`**, the `serve` server: `jobs` `signin` `security` · `route-deps` `route-table` · `app`
278
+ - **`web/routes/`**, one module per family, `spa` registered last because it matches every path: `session` `people` `meta` `repros` `logs` `data` `backup` `clusters` `edge` `perf` `jobs` `spa` · `index`
279
+
280
+ Outside `src/`, `bin/houston` is the entry and `data/` ships beside the code: `versions.yaml`,
281
+ the static presets, dashboards, k6 scripts, the GUI, the agent skill, the IAM documents and
282
+ these documents. `test/` and `tools/` do not ship.
283
+
284
+ ## Durable sample data
285
+
286
+ `lib/seed-options.ts` supplies both front-ends with the profile/scenario catalogue.
287
+ `seed/plan.ts` assigns content and actions to named participants before mutation.
288
+ `core/lifecycle/seeding.ts` drives the executor, optional history and exact verification.
289
+ Workspace locks serialize all entry points. `seed/receipt.ts` fsyncs immutable manifests
290
+ and a hash-chained write-ahead log under `repros/<name>/seed-receipts/`; no credentials
291
+ are stored. Uncertain writes reconcile by exact identity or refuse replay. In particular,
292
+ media confirmation is not replayed: supported servers can create a second message.
293
+ `ready` resumes the recorded batch after rechecking its identity under the lock.
294
+ Verification checks the latest batch, preserves true/false/null, and reads personal
295
+ features with their actor token. Existing content and customized metadata remain intact.
296
+
297
+ ## The GUI
298
+
299
+ The GUI is vanilla ES modules with no build step, in `data/webui/` and served by
300
+ `web/routes/spa.ts`. `yarn verify:gui-hash` checks an explicit list of its files and one
301
+ digest over all of them, recorded when the GUI was frozen, so changing the GUI means
302
+ re-recording that digest on purpose.
303
+
304
+ **Colour is a signal, never decoration.** The rule is declared at the top of `app.css`: green
305
+ = running, amber = wants you, red = about to destroy something, blue = you can click it.
306
+
307
+ **The payload-shape trap.** Browser tests render from a hand-written `detail()` fixture in
308
+ `test/web/browser/frozen-gui.browser.test.ts`. A key that differs from what
309
+ `core/lifecycle/payload.ts` really returns breaks the panel in production while the suite
310
+ stays green. A browser test compares the fixture with the real payload, and
311
+ `test/core/lifecycle/inspect.test.ts` holds the real payload's keys.
312
+
313
+ ## Performance: what is allowed to be slow
314
+
315
+ Each read of a remote cluster is a round trip, a second or two against EKS, so each operation
316
+ has a budget. The GUI's cluster list (`GET /api/clusters`) probes **nothing**, so the page
317
+ draws its cards at once. The Clusters page, Home and step 1 of Create then read one
318
+ `GET /api/clusters/overview`, which reads every cluster with bounded concurrency (and a
319
+ cluster on this machine only lightly); `GET /api/clusters/status` is read only when a
320
+ local cluster's own page is opened. `up` and `cluster create` take minutes, and must **say what they are doing while
321
+ they do it**.
322
+ Independent reads run concurrently. A step that prints nothing until it returns, like
323
+ `helm install --wait`, is where somebody decides the tool has hung and kills it, leaving a
324
+ half-installed release.
325
+
326
+ ## State
327
+
328
+ Everything lives under `HOUSTON_HOME` (default `~/.houston`). The layout is in the user guide,
329
+ under [Where state lives](guide.md#where-state-lives). The compose file is generated, so
330
+ re-run `up` rather than editing it.
331
+
332
+ **The `IMPLEMENTATION` marker says which build may write a home.** This build is `typescript`.
333
+ `dual-v1` means every state format in the home was read back and agreed about, and a fresh
334
+ home is claimed as `dual-v1`. A marker this build does not know is refused before anything is
335
+ written, and so is a home holding a transition file. Only `core/promote.ts` changes a claimed
336
+ marker, under all five state locks, and the transition file exists exactly while a promotion
337
+ is in flight. A home 1.x left is adopted once. On the first command, `promote` reads every
338
+ state format in it back under the locks, swaps the marker to `dual-v1` atomically, clears the
339
+ transition file last, and says so on stderr. On any failure the home is left as it was.
340
+
341
+ **A cloud cluster's ownership is a tag on the cluster, in AWS.** A local file is one
342
+ `mktemp -d` away from a billable cluster houston can no longer prove is its own. A tag
343
+ survives a lost home, another machine and a colleague.
344
+
345
+ ## Testing
346
+
347
+ `src/` is production code only. `test/` mirrors it path for path, so a failure names the
348
+ module. Nothing in the suite needs Docker, a cluster, an AWS account or the network. The
349
+ `test/testsetup*.ts` files give every spec file a fresh `HOUSTON_HOME`, a deterministic engine,
350
+ absent cloud tools and no non-loopback network, and the engine, cloud and network setups each
351
+ have a spec of their own. Anything run outside Jest must isolate itself the same way, with
352
+ `export HOUSTON_HOME=$(mktemp -d)` first.
353
+
354
+ - **Zero skips, and a floor.** `tools/jest-zero-skips.js` fails a skipped, todo or `.only`
355
+ test and a run below the measured floor. The commit that moves the floor says why.
356
+ - **The browser suite runs in-process**, through the `playwright` library with the Fastify app
357
+ in the same process, and must pass an exact count. `@playwright/test` would run the server
358
+ out of process, where it sees none of the stubs, and the suite would stay green.
359
+ - **Invariant specs walk the source**, from each layer's `invariants/`: `ROUTE_ROLES` against
360
+ the registered routes, `doctor.CHECKS` against its call sites, the lock every mutation
361
+ takes. Registries drift; walks do not.
362
+ - **1.x's answers are pinned** under `test/fixtures/` wherever the contract is what 1.x printed
363
+ or wrote. Where 2.0.0 reworded a message into houston's own words, the fixture holds the new
364
+ wording and the rest of 1.x's answer.
365
+ - **A regression test must fail against the pre-fix code.** Reverse the fix, confirm the test
366
+ fails for the stated reason, restore it byte for byte. A test that passes both ways proves
367
+ nothing.
368
+
369
+ The gates, what each proves and what CI runs are in
370
+ [`CONTRIBUTING.md`](../../CONTRIBUTING.md#the-gates).
371
+
372
+ ## Compatibility with 1.x
373
+
374
+ houston 2.x replaces 1.x in place. Every command, flag, exit code, `--json` envelope and state
375
+ file format is unchanged. What 2.0.0 changed is the wording of some messages: they name the file
376
+ and the reason in plain words, where 1.x printed its runtime's exception names and value
377
+ spellings. A 1.x install keeps working after 2.x is installed, on the same home, because
378
+ both read the `dual-v1` marker and take the same `flock(2)` locks.
379
+
380
+ ## The rule behind most of the rules
381
+
382
+ A support tool's worst failure is not crashing. It is **answering confidently and wrongly**:
383
+ reporting zero volumes for a cluster it could not read, certifying a URL served by something
384
+ else, saying a certificate failed when it had not arrived yet, or telling somebody a cluster
385
+ costs nothing because the pointer file was lost. Most of this document applies that idea in
386
+ different places. Say what you know, say what you could not find out, and never let the
387
+ second turn into the first.