@supatype/cli 0.9.1 → 0.10.0

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 (749) hide show
  1. package/CHANGELOG.md +499 -91
  2. package/bin/node-version.js +28 -0
  3. package/bin/supatype.js +8 -4
  4. package/dist/api-config-cache.d.ts +22 -8
  5. package/dist/api-config-cache.d.ts.map +1 -1
  6. package/dist/api-config-cache.js +82 -19
  7. package/dist/api-config-cache.js.map +1 -1
  8. package/dist/api-config-stack.d.ts +23 -0
  9. package/dist/api-config-stack.d.ts.map +1 -0
  10. package/dist/api-config-stack.js +63 -0
  11. package/dist/api-config-stack.js.map +1 -0
  12. package/dist/api-url.d.ts +12 -0
  13. package/dist/api-url.d.ts.map +1 -0
  14. package/dist/api-url.js +17 -0
  15. package/dist/api-url.js.map +1 -0
  16. package/dist/app/framework.d.ts +18 -2
  17. package/dist/app/framework.d.ts.map +1 -1
  18. package/dist/app/framework.js +26 -3
  19. package/dist/app/framework.js.map +1 -1
  20. package/dist/app/port-holder.d.ts +33 -0
  21. package/dist/app/port-holder.d.ts.map +1 -0
  22. package/dist/app/port-holder.js +66 -0
  23. package/dist/app/port-holder.js.map +1 -0
  24. package/dist/app/proxy-dev-app.d.ts +27 -3
  25. package/dist/app/proxy-dev-app.d.ts.map +1 -1
  26. package/dist/app/proxy-dev-app.js +100 -46
  27. package/dist/app/proxy-dev-app.js.map +1 -1
  28. package/dist/app/vite-dev-args.d.ts +33 -0
  29. package/dist/app/vite-dev-args.d.ts.map +1 -0
  30. package/dist/app/vite-dev-args.js +90 -0
  31. package/dist/app/vite-dev-args.js.map +1 -0
  32. package/dist/app-config.d.ts +2 -0
  33. package/dist/app-config.d.ts.map +1 -1
  34. package/dist/app-config.js +27 -8
  35. package/dist/app-config.js.map +1 -1
  36. package/dist/applied-ast-artifacts.d.ts +7 -2
  37. package/dist/applied-ast-artifacts.d.ts.map +1 -1
  38. package/dist/applied-ast-artifacts.js +8 -3
  39. package/dist/applied-ast-artifacts.js.map +1 -1
  40. package/dist/archive-extract.d.ts +21 -2
  41. package/dist/archive-extract.d.ts.map +1 -1
  42. package/dist/archive-extract.js +30 -11
  43. package/dist/archive-extract.js.map +1 -1
  44. package/dist/augmentation-generator.d.ts +9 -0
  45. package/dist/augmentation-generator.d.ts.map +1 -1
  46. package/dist/augmentation-generator.js +75 -8
  47. package/dist/augmentation-generator.js.map +1 -1
  48. package/dist/auth-answer.d.ts +1 -1
  49. package/dist/auth-answer.js +1 -1
  50. package/dist/auth-config-validate.d.ts +3 -0
  51. package/dist/auth-config-validate.d.ts.map +1 -0
  52. package/dist/auth-config-validate.js +85 -0
  53. package/dist/auth-config-validate.js.map +1 -0
  54. package/dist/auth-groups-env.d.ts +14 -0
  55. package/dist/auth-groups-env.d.ts.map +1 -0
  56. package/dist/auth-groups-env.js +53 -0
  57. package/dist/auth-groups-env.js.map +1 -0
  58. package/dist/auth-providers.d.ts +6 -14
  59. package/dist/auth-providers.d.ts.map +1 -1
  60. package/dist/auth-providers.js +6 -36
  61. package/dist/auth-providers.js.map +1 -1
  62. package/dist/auth-settings-push.d.ts +29 -0
  63. package/dist/auth-settings-push.d.ts.map +1 -0
  64. package/dist/auth-settings-push.js +176 -0
  65. package/dist/auth-settings-push.js.map +1 -0
  66. package/dist/binary-cache.d.ts +4 -1
  67. package/dist/binary-cache.d.ts.map +1 -1
  68. package/dist/binary-cache.js +33 -63
  69. package/dist/binary-cache.js.map +1 -1
  70. package/dist/binary-download-lock.d.ts.map +1 -1
  71. package/dist/binary-download-lock.js +2 -10
  72. package/dist/binary-download-lock.js.map +1 -1
  73. package/dist/browser-login.d.ts +42 -0
  74. package/dist/browser-login.d.ts.map +1 -0
  75. package/dist/browser-login.js +111 -0
  76. package/dist/browser-login.js.map +1 -0
  77. package/dist/build-public-env.d.ts +29 -0
  78. package/dist/build-public-env.d.ts.map +1 -0
  79. package/dist/build-public-env.js +97 -0
  80. package/dist/build-public-env.js.map +1 -0
  81. package/dist/build-refused.d.ts +9 -0
  82. package/dist/build-refused.d.ts.map +1 -0
  83. package/dist/build-refused.js +9 -0
  84. package/dist/build-refused.js.map +1 -0
  85. package/dist/cache-provider.d.ts +17 -2
  86. package/dist/cache-provider.d.ts.map +1 -1
  87. package/dist/cache-provider.js +28 -3
  88. package/dist/cache-provider.js.map +1 -1
  89. package/dist/cdn-fetch.d.ts +36 -0
  90. package/dist/cdn-fetch.d.ts.map +1 -0
  91. package/dist/cdn-fetch.js +175 -0
  92. package/dist/cdn-fetch.js.map +1 -0
  93. package/dist/channel-extractor.d.ts +51 -0
  94. package/dist/channel-extractor.d.ts.map +1 -0
  95. package/dist/channel-extractor.js +485 -0
  96. package/dist/channel-extractor.js.map +1 -0
  97. package/dist/cli-launcher.d.ts.map +1 -1
  98. package/dist/cli-launcher.js +3 -2
  99. package/dist/cli-launcher.js.map +1 -1
  100. package/dist/cli-release-check.d.ts +34 -0
  101. package/dist/cli-release-check.d.ts.map +1 -0
  102. package/dist/cli-release-check.js +79 -0
  103. package/dist/cli-release-check.js.map +1 -0
  104. package/dist/cli-standalone.d.ts +16 -0
  105. package/dist/cli-standalone.d.ts.map +1 -1
  106. package/dist/cli-standalone.js +92 -47
  107. package/dist/cli-standalone.js.map +1 -1
  108. package/dist/cli-version-embedded.d.ts.map +1 -1
  109. package/dist/cli-version-embedded.js +1 -1
  110. package/dist/cli-version-embedded.js.map +1 -1
  111. package/dist/cli.d.ts +7 -0
  112. package/dist/cli.d.ts.map +1 -1
  113. package/dist/cli.js +12 -1
  114. package/dist/cli.js.map +1 -1
  115. package/dist/client-generator.d.ts.map +1 -1
  116. package/dist/client-generator.js +9 -3
  117. package/dist/client-generator.js.map +1 -1
  118. package/dist/cloud-admin.d.ts +55 -0
  119. package/dist/cloud-admin.d.ts.map +1 -0
  120. package/dist/cloud-admin.js +99 -0
  121. package/dist/cloud-admin.js.map +1 -0
  122. package/dist/cloud-credentials.d.ts +24 -9
  123. package/dist/cloud-credentials.d.ts.map +1 -1
  124. package/dist/cloud-credentials.js +57 -47
  125. package/dist/cloud-credentials.js.map +1 -1
  126. package/dist/cloud-saml-key.d.ts +9 -0
  127. package/dist/cloud-saml-key.d.ts.map +1 -0
  128. package/dist/cloud-saml-key.js +44 -0
  129. package/dist/cloud-saml-key.js.map +1 -0
  130. package/dist/commands/admin.d.ts.map +1 -1
  131. package/dist/commands/admin.js +79 -24
  132. package/dist/commands/admin.js.map +1 -1
  133. package/dist/commands/app.d.ts.map +1 -1
  134. package/dist/commands/app.js +22 -2
  135. package/dist/commands/app.js.map +1 -1
  136. package/dist/commands/build.d.ts +3 -2
  137. package/dist/commands/build.d.ts.map +1 -1
  138. package/dist/commands/build.js +10 -13
  139. package/dist/commands/build.js.map +1 -1
  140. package/dist/commands/cache.d.ts.map +1 -1
  141. package/dist/commands/cache.js +16 -5
  142. package/dist/commands/cache.js.map +1 -1
  143. package/dist/commands/cloud.d.ts +2 -0
  144. package/dist/commands/cloud.d.ts.map +1 -1
  145. package/dist/commands/cloud.js +96 -23
  146. package/dist/commands/cloud.js.map +1 -1
  147. package/dist/commands/db.d.ts.map +1 -1
  148. package/dist/commands/db.js +2 -1
  149. package/dist/commands/db.js.map +1 -1
  150. package/dist/commands/deploy.d.ts +21 -2
  151. package/dist/commands/deploy.d.ts.map +1 -1
  152. package/dist/commands/deploy.js +97 -97
  153. package/dist/commands/deploy.js.map +1 -1
  154. package/dist/commands/dev.d.ts +31 -4
  155. package/dist/commands/dev.d.ts.map +1 -1
  156. package/dist/commands/dev.js +261 -77
  157. package/dist/commands/dev.js.map +1 -1
  158. package/dist/commands/diff.d.ts.map +1 -1
  159. package/dist/commands/diff.js +16 -4
  160. package/dist/commands/diff.js.map +1 -1
  161. package/dist/commands/doctor.js +1 -1
  162. package/dist/commands/doctor.js.map +1 -1
  163. package/dist/commands/functions.d.ts.map +1 -1
  164. package/dist/commands/functions.js +163 -54
  165. package/dist/commands/functions.js.map +1 -1
  166. package/dist/commands/generate.d.ts.map +1 -1
  167. package/dist/commands/generate.js +3 -0
  168. package/dist/commands/generate.js.map +1 -1
  169. package/dist/commands/hooks.d.ts.map +1 -1
  170. package/dist/commands/hooks.js +40 -9
  171. package/dist/commands/hooks.js.map +1 -1
  172. package/dist/commands/init.d.ts +20 -8
  173. package/dist/commands/init.d.ts.map +1 -1
  174. package/dist/commands/init.js +358 -137
  175. package/dist/commands/init.js.map +1 -1
  176. package/dist/commands/keys.d.ts +6 -0
  177. package/dist/commands/keys.d.ts.map +1 -1
  178. package/dist/commands/keys.js +17 -10
  179. package/dist/commands/keys.js.map +1 -1
  180. package/dist/commands/link-helpers.d.ts +4 -1
  181. package/dist/commands/link-helpers.d.ts.map +1 -1
  182. package/dist/commands/link-helpers.js +64 -12
  183. package/dist/commands/link-helpers.js.map +1 -1
  184. package/dist/commands/login.d.ts +3 -2
  185. package/dist/commands/login.d.ts.map +1 -1
  186. package/dist/commands/login.js +99 -57
  187. package/dist/commands/login.js.map +1 -1
  188. package/dist/commands/migrate.d.ts +17 -0
  189. package/dist/commands/migrate.d.ts.map +1 -1
  190. package/dist/commands/migrate.js +22 -4
  191. package/dist/commands/migrate.js.map +1 -1
  192. package/dist/commands/push.d.ts +35 -1
  193. package/dist/commands/push.d.ts.map +1 -1
  194. package/dist/commands/push.js +117 -21
  195. package/dist/commands/push.js.map +1 -1
  196. package/dist/commands/seed.d.ts +31 -45
  197. package/dist/commands/seed.d.ts.map +1 -1
  198. package/dist/commands/seed.js +93 -215
  199. package/dist/commands/seed.js.map +1 -1
  200. package/dist/commands/self-host.d.ts +3 -3
  201. package/dist/commands/self-host.d.ts.map +1 -1
  202. package/dist/commands/self-host.js +88 -270
  203. package/dist/commands/self-host.js.map +1 -1
  204. package/dist/commands/site.d.ts +42 -0
  205. package/dist/commands/site.d.ts.map +1 -0
  206. package/dist/commands/site.js +100 -0
  207. package/dist/commands/site.js.map +1 -0
  208. package/dist/commands/sso.d.ts +13 -3
  209. package/dist/commands/sso.d.ts.map +1 -1
  210. package/dist/commands/sso.js +58 -16
  211. package/dist/commands/sso.js.map +1 -1
  212. package/dist/commands/update.d.ts.map +1 -1
  213. package/dist/commands/update.js +161 -68
  214. package/dist/commands/update.js.map +1 -1
  215. package/dist/compose-auth-settings.d.ts +12 -0
  216. package/dist/compose-auth-settings.d.ts.map +1 -0
  217. package/dist/compose-auth-settings.js +39 -0
  218. package/dist/compose-auth-settings.js.map +1 -0
  219. package/dist/compose-db-roles.d.ts.map +1 -1
  220. package/dist/compose-db-roles.js +6 -0
  221. package/dist/compose-db-roles.js.map +1 -1
  222. package/dist/compose-kong.d.ts +5 -1
  223. package/dist/compose-kong.d.ts.map +1 -1
  224. package/dist/compose-kong.js +8 -4
  225. package/dist/compose-kong.js.map +1 -1
  226. package/dist/compose-rename.d.ts.map +1 -1
  227. package/dist/compose-rename.js +5 -0
  228. package/dist/compose-rename.js.map +1 -1
  229. package/dist/compose-render-mode.d.ts +8 -3
  230. package/dist/compose-render-mode.d.ts.map +1 -1
  231. package/dist/compose-render-mode.js +22 -13
  232. package/dist/compose-render-mode.js.map +1 -1
  233. package/dist/compose-services.d.ts.map +1 -1
  234. package/dist/compose-services.js +3 -2
  235. package/dist/compose-services.js.map +1 -1
  236. package/dist/config-mailer-env.d.ts +6 -2
  237. package/dist/config-mailer-env.d.ts.map +1 -1
  238. package/dist/config-mailer-env.js +11 -13
  239. package/dist/config-mailer-env.js.map +1 -1
  240. package/dist/config-version-pin.d.ts +42 -0
  241. package/dist/config-version-pin.d.ts.map +1 -0
  242. package/dist/config-version-pin.js +64 -0
  243. package/dist/config-version-pin.js.map +1 -0
  244. package/dist/config.d.ts +5 -1
  245. package/dist/config.d.ts.map +1 -1
  246. package/dist/config.js +6 -2
  247. package/dist/config.js.map +1 -1
  248. package/dist/cors-origins-push.d.ts +16 -0
  249. package/dist/cors-origins-push.d.ts.map +1 -0
  250. package/dist/cors-origins-push.js +37 -0
  251. package/dist/cors-origins-push.js.map +1 -0
  252. package/dist/database-url-owner.d.ts.map +1 -1
  253. package/dist/database-url-owner.js +2 -1
  254. package/dist/database-url-owner.js.map +1 -1
  255. package/dist/db-port.d.ts +3 -1
  256. package/dist/db-port.d.ts.map +1 -1
  257. package/dist/db-port.js +1 -1
  258. package/dist/db-port.js.map +1 -1
  259. package/dist/destructive-consent.d.ts.map +1 -1
  260. package/dist/destructive-consent.js +23 -1
  261. package/dist/destructive-consent.js.map +1 -1
  262. package/dist/dev-compose.d.ts +9 -4
  263. package/dist/dev-compose.d.ts.map +1 -1
  264. package/dist/dev-compose.js +112 -71
  265. package/dist/dev-compose.js.map +1 -1
  266. package/dist/dev-functions-watch.d.ts +25 -4
  267. package/dist/dev-functions-watch.d.ts.map +1 -1
  268. package/dist/dev-functions-watch.js +78 -13
  269. package/dist/dev-functions-watch.js.map +1 -1
  270. package/dist/dev-initial-push.d.ts.map +1 -1
  271. package/dist/dev-initial-push.js +6 -0
  272. package/dist/dev-initial-push.js.map +1 -1
  273. package/dist/dev-ports.d.ts +7 -2
  274. package/dist/dev-ports.d.ts.map +1 -1
  275. package/dist/dev-ports.js +44 -22
  276. package/dist/dev-ports.js.map +1 -1
  277. package/dist/dev-ready-panel.d.ts +26 -3
  278. package/dist/dev-ready-panel.d.ts.map +1 -1
  279. package/dist/dev-ready-panel.js +37 -5
  280. package/dist/dev-ready-panel.js.map +1 -1
  281. package/dist/dev-schema-watch.d.ts +6 -0
  282. package/dist/dev-schema-watch.d.ts.map +1 -1
  283. package/dist/dev-schema-watch.js +9 -0
  284. package/dist/dev-schema-watch.js.map +1 -1
  285. package/dist/dev-self-start.d.ts +16 -0
  286. package/dist/dev-self-start.d.ts.map +1 -0
  287. package/dist/dev-self-start.js +31 -0
  288. package/dist/dev-self-start.js.map +1 -0
  289. package/dist/dev-session-lock.d.ts +71 -2
  290. package/dist/dev-session-lock.d.ts.map +1 -1
  291. package/dist/dev-session-lock.js +105 -5
  292. package/dist/dev-session-lock.js.map +1 -1
  293. package/dist/dev-session.d.ts +6 -1
  294. package/dist/dev-session.d.ts.map +1 -1
  295. package/dist/dev-session.js +9 -3
  296. package/dist/dev-session.js.map +1 -1
  297. package/dist/dev-shutdown.d.ts +11 -2
  298. package/dist/dev-shutdown.d.ts.map +1 -1
  299. package/dist/dev-shutdown.js +23 -9
  300. package/dist/dev-shutdown.js.map +1 -1
  301. package/dist/diff-access.d.ts.map +1 -1
  302. package/dist/diff-access.js +17 -1
  303. package/dist/diff-access.js.map +1 -1
  304. package/dist/diff-channels.d.ts +14 -0
  305. package/dist/diff-channels.d.ts.map +1 -0
  306. package/dist/diff-channels.js +38 -0
  307. package/dist/diff-channels.js.map +1 -0
  308. package/dist/docker-exec.d.ts +25 -4
  309. package/dist/docker-exec.d.ts.map +1 -1
  310. package/dist/docker-exec.js +88 -8
  311. package/dist/docker-exec.js.map +1 -1
  312. package/dist/docker-postgres.d.ts +11 -0
  313. package/dist/docker-postgres.d.ts.map +1 -1
  314. package/dist/docker-postgres.js +9 -1
  315. package/dist/docker-postgres.js.map +1 -1
  316. package/dist/docker-runtime.d.ts +31 -7
  317. package/dist/docker-runtime.d.ts.map +1 -1
  318. package/dist/docker-runtime.js +104 -36
  319. package/dist/docker-runtime.js.map +1 -1
  320. package/dist/engine-answers.d.ts.map +1 -1
  321. package/dist/engine-answers.js +2 -1
  322. package/dist/engine-answers.js.map +1 -1
  323. package/dist/engine-client.d.ts +28 -0
  324. package/dist/engine-client.d.ts.map +1 -1
  325. package/dist/engine-client.js +4 -4
  326. package/dist/engine-client.js.map +1 -1
  327. package/dist/engine-columns.d.ts +26 -0
  328. package/dist/engine-columns.d.ts.map +1 -0
  329. package/dist/engine-columns.js +67 -0
  330. package/dist/engine-columns.js.map +1 -0
  331. package/dist/engine-floor.d.ts +35 -0
  332. package/dist/engine-floor.d.ts.map +1 -1
  333. package/dist/engine-floor.js +67 -0
  334. package/dist/engine-floor.js.map +1 -1
  335. package/dist/engine-ownership-gate.d.ts +11 -1
  336. package/dist/engine-ownership-gate.d.ts.map +1 -1
  337. package/dist/engine-ownership-gate.js +32 -0
  338. package/dist/engine-ownership-gate.js.map +1 -1
  339. package/dist/engine-push-output.d.ts +12 -4
  340. package/dist/engine-push-output.d.ts.map +1 -1
  341. package/dist/engine-push-output.js.map +1 -1
  342. package/dist/env-file.d.ts +36 -3
  343. package/dist/env-file.d.ts.map +1 -1
  344. package/dist/env-file.js +82 -11
  345. package/dist/env-file.js.map +1 -1
  346. package/dist/env-lines.d.ts +5 -2
  347. package/dist/env-lines.d.ts.map +1 -1
  348. package/dist/env-lines.js +18 -3
  349. package/dist/env-lines.js.map +1 -1
  350. package/dist/env-managed-record.d.ts +20 -0
  351. package/dist/env-managed-record.d.ts.map +1 -0
  352. package/dist/env-managed-record.js +56 -0
  353. package/dist/env-managed-record.js.map +1 -0
  354. package/dist/error-message.d.ts.map +1 -1
  355. package/dist/error-message.js +7 -3
  356. package/dist/error-message.js.map +1 -1
  357. package/dist/frontend-env.d.ts +3 -2
  358. package/dist/frontend-env.d.ts.map +1 -1
  359. package/dist/frontend-env.js +4 -5
  360. package/dist/frontend-env.js.map +1 -1
  361. package/dist/frontend-values-linked.d.ts +3 -0
  362. package/dist/frontend-values-linked.d.ts.map +1 -1
  363. package/dist/frontend-values-linked.js +3 -2
  364. package/dist/frontend-values-linked.js.map +1 -1
  365. package/dist/frontend-values.d.ts +2 -1
  366. package/dist/frontend-values.d.ts.map +1 -1
  367. package/dist/frontend-values.js +2 -1
  368. package/dist/frontend-values.js.map +1 -1
  369. package/dist/functions-context-refresh.d.ts.map +1 -1
  370. package/dist/functions-context-refresh.js +5 -2
  371. package/dist/functions-context-refresh.js.map +1 -1
  372. package/dist/functions-deno-types.d.ts +6 -0
  373. package/dist/functions-deno-types.d.ts.map +1 -1
  374. package/dist/functions-deno-types.js +43 -35
  375. package/dist/functions-deno-types.js.map +1 -1
  376. package/dist/functions-env-local.d.ts +7 -2
  377. package/dist/functions-env-local.d.ts.map +1 -1
  378. package/dist/functions-env-local.js +8 -3
  379. package/dist/functions-env-local.js.map +1 -1
  380. package/dist/functions-worker-files.d.ts.map +1 -1
  381. package/dist/functions-worker-files.js +2 -13
  382. package/dist/functions-worker-files.js.map +1 -1
  383. package/dist/generated/functions-worker-source.d.ts.map +1 -1
  384. package/dist/generated/functions-worker-source.js +6 -3
  385. package/dist/generated/functions-worker-source.js.map +1 -1
  386. package/dist/generated/release-images.d.ts +6 -6
  387. package/dist/generated/release-images.js +3 -3
  388. package/dist/generated-files-engine.d.ts +9 -0
  389. package/dist/generated-files-engine.d.ts.map +1 -1
  390. package/dist/generated-files-engine.js +23 -0
  391. package/dist/generated-files-engine.js.map +1 -1
  392. package/dist/gitignore.d.ts +29 -2
  393. package/dist/gitignore.d.ts.map +1 -1
  394. package/dist/gitignore.js +86 -21
  395. package/dist/gitignore.js.map +1 -1
  396. package/dist/hooks-generator.d.ts.map +1 -1
  397. package/dist/hooks-generator.js +32 -10
  398. package/dist/hooks-generator.js.map +1 -1
  399. package/dist/hooks-worker-reload.d.ts +18 -0
  400. package/dist/hooks-worker-reload.d.ts.map +1 -0
  401. package/dist/hooks-worker-reload.js +19 -0
  402. package/dist/hooks-worker-reload.js.map +1 -0
  403. package/dist/host-database.d.ts +6 -2
  404. package/dist/host-database.d.ts.map +1 -1
  405. package/dist/host-database.js +10 -2
  406. package/dist/host-database.js.map +1 -1
  407. package/dist/index.d.ts +1 -0
  408. package/dist/index.d.ts.map +1 -1
  409. package/dist/index.js.map +1 -1
  410. package/dist/init-dependency-versions.d.ts +2 -3
  411. package/dist/init-dependency-versions.d.ts.map +1 -1
  412. package/dist/init-dependency-versions.js +12 -9
  413. package/dist/init-dependency-versions.js.map +1 -1
  414. package/dist/init-example.d.ts.map +1 -1
  415. package/dist/init-example.js +13 -1
  416. package/dist/init-example.js.map +1 -1
  417. package/dist/init-expo-runtime-env.d.ts +25 -0
  418. package/dist/init-expo-runtime-env.d.ts.map +1 -0
  419. package/dist/init-expo-runtime-env.js +112 -0
  420. package/dist/init-expo-runtime-env.js.map +1 -0
  421. package/dist/init-next-runtime-env.d.ts +14 -1
  422. package/dist/init-next-runtime-env.d.ts.map +1 -1
  423. package/dist/init-next-runtime-env.js +116 -35
  424. package/dist/init-next-runtime-env.js.map +1 -1
  425. package/dist/init-package-json.d.ts +12 -3
  426. package/dist/init-package-json.d.ts.map +1 -1
  427. package/dist/init-package-json.js +35 -15
  428. package/dist/init-package-json.js.map +1 -1
  429. package/dist/init-port-registry.d.ts +19 -0
  430. package/dist/init-port-registry.d.ts.map +1 -0
  431. package/dist/init-port-registry.js +57 -0
  432. package/dist/init-port-registry.js.map +1 -0
  433. package/dist/init-project-detect.d.ts +20 -0
  434. package/dist/init-project-detect.d.ts.map +1 -1
  435. package/dist/init-project-detect.js +41 -8
  436. package/dist/init-project-detect.js.map +1 -1
  437. package/dist/init-setup-steps.d.ts +32 -4
  438. package/dist/init-setup-steps.d.ts.map +1 -1
  439. package/dist/init-setup-steps.js +114 -18
  440. package/dist/init-setup-steps.js.map +1 -1
  441. package/dist/init-vite-node.d.ts +21 -0
  442. package/dist/init-vite-node.d.ts.map +1 -0
  443. package/dist/init-vite-node.js +75 -0
  444. package/dist/init-vite-node.js.map +1 -0
  445. package/dist/jsx-first-child.d.ts +18 -0
  446. package/dist/jsx-first-child.d.ts.map +1 -0
  447. package/dist/jsx-first-child.js +53 -0
  448. package/dist/jsx-first-child.js.map +1 -0
  449. package/dist/keyspace-password-file.d.ts +46 -0
  450. package/dist/keyspace-password-file.d.ts.map +1 -0
  451. package/dist/keyspace-password-file.js +128 -0
  452. package/dist/keyspace-password-file.js.map +1 -0
  453. package/dist/keyspace-port.d.ts +14 -0
  454. package/dist/keyspace-port.d.ts.map +1 -0
  455. package/dist/keyspace-port.js +35 -0
  456. package/dist/keyspace-port.js.map +1 -0
  457. package/dist/kong-config.d.ts +6 -0
  458. package/dist/kong-config.d.ts.map +1 -1
  459. package/dist/kong-config.js +119 -20
  460. package/dist/kong-config.js.map +1 -1
  461. package/dist/link.d.ts +30 -0
  462. package/dist/link.d.ts.map +1 -1
  463. package/dist/link.js +70 -16
  464. package/dist/link.js.map +1 -1
  465. package/dist/local-gateway.d.ts +11 -3
  466. package/dist/local-gateway.d.ts.map +1 -1
  467. package/dist/local-gateway.js +16 -7
  468. package/dist/local-gateway.js.map +1 -1
  469. package/dist/local-secrets.d.ts +22 -0
  470. package/dist/local-secrets.d.ts.map +1 -1
  471. package/dist/local-secrets.js +29 -0
  472. package/dist/local-secrets.js.map +1 -1
  473. package/dist/local-stack-guard.d.ts +8 -0
  474. package/dist/local-stack-guard.d.ts.map +1 -1
  475. package/dist/local-stack-guard.js +44 -3
  476. package/dist/local-stack-guard.js.map +1 -1
  477. package/dist/local-stack.d.ts +2 -0
  478. package/dist/local-stack.d.ts.map +1 -1
  479. package/dist/local-stack.js +14 -8
  480. package/dist/local-stack.js.map +1 -1
  481. package/dist/local-storage.d.ts +3 -5
  482. package/dist/local-storage.d.ts.map +1 -1
  483. package/dist/local-storage.js +10 -10
  484. package/dist/local-storage.js.map +1 -1
  485. package/dist/mailer-autoconfirm.d.ts +29 -24
  486. package/dist/mailer-autoconfirm.d.ts.map +1 -1
  487. package/dist/mailer-autoconfirm.js +47 -43
  488. package/dist/mailer-autoconfirm.js.map +1 -1
  489. package/dist/mailer-env.d.ts +8 -1
  490. package/dist/mailer-env.d.ts.map +1 -1
  491. package/dist/mailer-env.js +52 -8
  492. package/dist/mailer-env.js.map +1 -1
  493. package/dist/model-hooks.d.ts +6 -4
  494. package/dist/model-hooks.d.ts.map +1 -1
  495. package/dist/model-hooks.js +14 -8
  496. package/dist/model-hooks.js.map +1 -1
  497. package/dist/model-versioning.d.ts +6 -0
  498. package/dist/model-versioning.d.ts.map +1 -1
  499. package/dist/model-versioning.js +12 -0
  500. package/dist/model-versioning.js.map +1 -1
  501. package/dist/native-dev-env.d.ts +38 -3
  502. package/dist/native-dev-env.d.ts.map +1 -1
  503. package/dist/native-dev-env.js +98 -7
  504. package/dist/native-dev-env.js.map +1 -1
  505. package/dist/native-keyspace.d.ts +31 -6
  506. package/dist/native-keyspace.d.ts.map +1 -1
  507. package/dist/native-keyspace.js +70 -20
  508. package/dist/native-keyspace.js.map +1 -1
  509. package/dist/native-leftover-postgres.d.ts +23 -0
  510. package/dist/native-leftover-postgres.d.ts.map +1 -0
  511. package/dist/native-leftover-postgres.js +55 -0
  512. package/dist/native-leftover-postgres.js.map +1 -0
  513. package/dist/native-leftover-services.d.ts +17 -0
  514. package/dist/native-leftover-services.d.ts.map +1 -0
  515. package/dist/native-leftover-services.js +93 -0
  516. package/dist/native-leftover-services.js.map +1 -0
  517. package/dist/native-pg-auth.d.ts.map +1 -1
  518. package/dist/native-pg-auth.js +2 -1
  519. package/dist/native-pg-auth.js.map +1 -1
  520. package/dist/native-port-lock.d.ts +37 -0
  521. package/dist/native-port-lock.d.ts.map +1 -0
  522. package/dist/native-port-lock.js +78 -0
  523. package/dist/native-port-lock.js.map +1 -0
  524. package/dist/native-realtime.d.ts +6 -3
  525. package/dist/native-realtime.d.ts.map +1 -1
  526. package/dist/native-realtime.js +65 -24
  527. package/dist/native-realtime.js.map +1 -1
  528. package/dist/native-roles-sql.d.ts.map +1 -1
  529. package/dist/native-roles-sql.js +2 -1
  530. package/dist/native-roles-sql.js.map +1 -1
  531. package/dist/native-stale-session.d.ts +17 -0
  532. package/dist/native-stale-session.d.ts.map +1 -0
  533. package/dist/native-stale-session.js +42 -0
  534. package/dist/native-stale-session.js.map +1 -0
  535. package/dist/native-storage-import.d.ts.map +1 -1
  536. package/dist/native-storage-import.js +6 -5
  537. package/dist/native-storage-import.js.map +1 -1
  538. package/dist/native-storage.d.ts +42 -7
  539. package/dist/native-storage.d.ts.map +1 -1
  540. package/dist/native-storage.js +196 -50
  541. package/dist/native-storage.js.map +1 -1
  542. package/dist/native-worker.d.ts +15 -0
  543. package/dist/native-worker.d.ts.map +1 -1
  544. package/dist/native-worker.js +26 -0
  545. package/dist/native-worker.js.map +1 -1
  546. package/dist/open-browser.d.ts +7 -0
  547. package/dist/open-browser.d.ts.map +1 -0
  548. package/dist/open-browser.js +26 -0
  549. package/dist/open-browser.js.map +1 -0
  550. package/dist/parent-watch.d.ts.map +1 -1
  551. package/dist/parent-watch.js +4 -8
  552. package/dist/parent-watch.js.map +1 -1
  553. package/dist/personal-access-token.d.ts +7 -0
  554. package/dist/personal-access-token.d.ts.map +1 -0
  555. package/dist/personal-access-token.js +11 -0
  556. package/dist/personal-access-token.js.map +1 -0
  557. package/dist/plan-sql.d.ts +30 -0
  558. package/dist/plan-sql.d.ts.map +1 -0
  559. package/dist/plan-sql.js +65 -0
  560. package/dist/plan-sql.js.map +1 -0
  561. package/dist/platform-settings-push.d.ts +15 -0
  562. package/dist/platform-settings-push.d.ts.map +1 -0
  563. package/dist/platform-settings-push.js +100 -0
  564. package/dist/platform-settings-push.js.map +1 -0
  565. package/dist/platform-settings.d.ts +81 -0
  566. package/dist/platform-settings.d.ts.map +1 -0
  567. package/dist/platform-settings.js +164 -0
  568. package/dist/platform-settings.js.map +1 -0
  569. package/dist/postgres-ctl.d.ts +45 -5
  570. package/dist/postgres-ctl.d.ts.map +1 -1
  571. package/dist/postgres-ctl.js +59 -21
  572. package/dist/postgres-ctl.js.map +1 -1
  573. package/dist/postgres-image.d.ts +27 -2
  574. package/dist/postgres-image.d.ts.map +1 -1
  575. package/dist/postgres-image.js +58 -13
  576. package/dist/postgres-image.js.map +1 -1
  577. package/dist/postgrest-release.d.ts +1 -1
  578. package/dist/postgrest-release.d.ts.map +1 -1
  579. package/dist/postgrest-release.js +3 -1
  580. package/dist/postgrest-release.js.map +1 -1
  581. package/dist/process-info.d.ts +14 -0
  582. package/dist/process-info.d.ts.map +1 -0
  583. package/dist/process-info.js +41 -0
  584. package/dist/process-info.js.map +1 -0
  585. package/dist/process-manager.d.ts +78 -4
  586. package/dist/process-manager.d.ts.map +1 -1
  587. package/dist/process-manager.js +128 -46
  588. package/dist/process-manager.js.map +1 -1
  589. package/dist/process-tree.d.ts +48 -0
  590. package/dist/process-tree.d.ts.map +1 -0
  591. package/dist/process-tree.js +141 -0
  592. package/dist/process-tree.js.map +1 -0
  593. package/dist/project-config.d.ts +121 -10
  594. package/dist/project-config.d.ts.map +1 -1
  595. package/dist/project-config.js +62 -1
  596. package/dist/project-config.js.map +1 -1
  597. package/dist/release-images.d.ts +21 -0
  598. package/dist/release-images.d.ts.map +1 -1
  599. package/dist/release-images.js +24 -0
  600. package/dist/release-images.js.map +1 -1
  601. package/dist/required-host-components.d.ts.map +1 -1
  602. package/dist/required-host-components.js +3 -5
  603. package/dist/required-host-components.js.map +1 -1
  604. package/dist/resolve-target.d.ts +42 -2
  605. package/dist/resolve-target.d.ts.map +1 -1
  606. package/dist/resolve-target.js +115 -21
  607. package/dist/resolve-target.js.map +1 -1
  608. package/dist/rest-cache-admin.d.ts +13 -0
  609. package/dist/rest-cache-admin.d.ts.map +1 -1
  610. package/dist/rest-cache-admin.js +36 -1
  611. package/dist/rest-cache-admin.js.map +1 -1
  612. package/dist/rest-ready.d.ts +6 -0
  613. package/dist/rest-ready.d.ts.map +1 -1
  614. package/dist/rest-ready.js +18 -2
  615. package/dist/rest-ready.js.map +1 -1
  616. package/dist/route-manifest.d.ts +24 -0
  617. package/dist/route-manifest.d.ts.map +1 -1
  618. package/dist/route-manifest.js +60 -2
  619. package/dist/route-manifest.js.map +1 -1
  620. package/dist/run-captured.d.ts +3 -1
  621. package/dist/run-captured.d.ts.map +1 -1
  622. package/dist/run-captured.js.map +1 -1
  623. package/dist/run-until-stopped.d.ts +3 -0
  624. package/dist/run-until-stopped.d.ts.map +1 -1
  625. package/dist/run-until-stopped.js +25 -11
  626. package/dist/run-until-stopped.js.map +1 -1
  627. package/dist/runtime-routes.d.ts +5 -0
  628. package/dist/runtime-routes.d.ts.map +1 -1
  629. package/dist/runtime-routes.js +10 -5
  630. package/dist/runtime-routes.js.map +1 -1
  631. package/dist/schema-ast-v2.d.ts +38 -0
  632. package/dist/schema-ast-v2.d.ts.map +1 -1
  633. package/dist/schema-ast-v2.js +2 -0
  634. package/dist/schema-ast-v2.js.map +1 -1
  635. package/dist/schema-reset.d.ts.map +1 -1
  636. package/dist/schema-reset.js +2 -0
  637. package/dist/schema-reset.js.map +1 -1
  638. package/dist/secret-sql.d.ts +13 -0
  639. package/dist/secret-sql.d.ts.map +1 -0
  640. package/dist/secret-sql.js +13 -0
  641. package/dist/secret-sql.js.map +1 -0
  642. package/dist/seed-default-export.d.ts +12 -0
  643. package/dist/seed-default-export.d.ts.map +1 -0
  644. package/dist/seed-default-export.js +44 -0
  645. package/dist/seed-default-export.js.map +1 -0
  646. package/dist/seed-ir.d.ts +8 -1
  647. package/dist/seed-ir.d.ts.map +1 -1
  648. package/dist/seed-ir.js +92 -6
  649. package/dist/seed-ir.js.map +1 -1
  650. package/dist/seed-prepare.d.ts +60 -0
  651. package/dist/seed-prepare.d.ts.map +1 -0
  652. package/dist/seed-prepare.js +115 -0
  653. package/dist/seed-prepare.js.map +1 -0
  654. package/dist/seed-remote.d.ts +22 -0
  655. package/dist/seed-remote.d.ts.map +1 -0
  656. package/dist/seed-remote.js +203 -0
  657. package/dist/seed-remote.js.map +1 -0
  658. package/dist/seed-report.d.ts +65 -0
  659. package/dist/seed-report.d.ts.map +1 -0
  660. package/dist/seed-report.js +98 -0
  661. package/dist/seed-report.js.map +1 -0
  662. package/dist/seed.d.ts +15 -2
  663. package/dist/seed.d.ts.map +1 -1
  664. package/dist/self-host-compose.d.ts +21 -1
  665. package/dist/self-host-compose.d.ts.map +1 -1
  666. package/dist/self-host-compose.js +349 -78
  667. package/dist/self-host-compose.js.map +1 -1
  668. package/dist/site-build-env.d.ts +31 -0
  669. package/dist/site-build-env.d.ts.map +1 -0
  670. package/dist/site-build-env.js +29 -0
  671. package/dist/site-build-env.js.map +1 -0
  672. package/dist/site-deploy.d.ts +52 -0
  673. package/dist/site-deploy.d.ts.map +1 -0
  674. package/dist/site-deploy.js +230 -0
  675. package/dist/site-deploy.js.map +1 -0
  676. package/dist/site-public-env.d.ts +67 -0
  677. package/dist/site-public-env.d.ts.map +1 -0
  678. package/dist/site-public-env.js +124 -0
  679. package/dist/site-public-env.js.map +1 -0
  680. package/dist/sso-admin.d.ts +15 -0
  681. package/dist/sso-admin.d.ts.map +1 -1
  682. package/dist/sso-admin.js +32 -9
  683. package/dist/sso-admin.js.map +1 -1
  684. package/dist/stack-exit-watch.d.ts +15 -0
  685. package/dist/stack-exit-watch.d.ts.map +1 -1
  686. package/dist/stack-exit-watch.js +41 -13
  687. package/dist/stack-exit-watch.js.map +1 -1
  688. package/dist/stack-folder.d.ts +28 -0
  689. package/dist/stack-folder.d.ts.map +1 -0
  690. package/dist/stack-folder.js +123 -0
  691. package/dist/stack-folder.js.map +1 -0
  692. package/dist/stack-running.d.ts +13 -0
  693. package/dist/stack-running.d.ts.map +1 -0
  694. package/dist/stack-running.js +44 -0
  695. package/dist/stack-running.js.map +1 -0
  696. package/dist/stack-setting-warnings.d.ts +8 -1
  697. package/dist/stack-setting-warnings.d.ts.map +1 -1
  698. package/dist/stack-setting-warnings.js +21 -1
  699. package/dist/stack-setting-warnings.js.map +1 -1
  700. package/dist/storage-provision.d.ts +12 -2
  701. package/dist/storage-provision.d.ts.map +1 -1
  702. package/dist/storage-provision.js +36 -11
  703. package/dist/storage-provision.js.map +1 -1
  704. package/dist/studio-admin-roles.d.ts +4 -4
  705. package/dist/studio-admin-roles.d.ts.map +1 -1
  706. package/dist/studio-admin-roles.js +6 -4
  707. package/dist/studio-admin-roles.js.map +1 -1
  708. package/dist/target-client.d.ts +13 -1
  709. package/dist/target-client.d.ts.map +1 -1
  710. package/dist/target-client.js +83 -17
  711. package/dist/target-client.js.map +1 -1
  712. package/dist/target-request.d.ts +5 -0
  713. package/dist/target-request.d.ts.map +1 -1
  714. package/dist/target-request.js +11 -2
  715. package/dist/target-request.js.map +1 -1
  716. package/dist/type-extractor.d.ts.map +1 -1
  717. package/dist/type-extractor.js +102 -10
  718. package/dist/type-extractor.js.map +1 -1
  719. package/dist/ui/clack-api.d.ts +2 -1
  720. package/dist/ui/clack-api.d.ts.map +1 -1
  721. package/dist/ui/clack-api.js +4 -4
  722. package/dist/ui/clack-api.js.map +1 -1
  723. package/dist/ui/clack.d.ts.map +1 -1
  724. package/dist/ui/clack.js +5 -2
  725. package/dist/ui/clack.js.map +1 -1
  726. package/dist/ui/dev/DevReadyPanelView.js +1 -1
  727. package/dist/ui/dev/DevReadyPanelView.js.map +1 -1
  728. package/dist/valkey-sidecar.d.ts +34 -13
  729. package/dist/valkey-sidecar.d.ts.map +1 -1
  730. package/dist/valkey-sidecar.js +65 -39
  731. package/dist/valkey-sidecar.js.map +1 -1
  732. package/dist/windows-processes.d.ts +7 -0
  733. package/dist/windows-processes.d.ts.map +1 -0
  734. package/dist/windows-processes.js +31 -0
  735. package/dist/windows-processes.js.map +1 -0
  736. package/dist/write-if-changed.d.ts +12 -0
  737. package/dist/write-if-changed.d.ts.map +1 -0
  738. package/dist/write-if-changed.js +32 -0
  739. package/dist/write-if-changed.js.map +1 -0
  740. package/package.json +7 -5
  741. package/releases/deno/VERSION +1 -1
  742. package/dist/commands/deploy-types.d.ts +0 -14
  743. package/dist/commands/deploy-types.d.ts.map +0 -1
  744. package/dist/commands/deploy-types.js +0 -38
  745. package/dist/commands/deploy-types.js.map +0 -1
  746. package/dist/systemd.d.ts +0 -26
  747. package/dist/systemd.d.ts.map +0 -1
  748. package/dist/systemd.js +0 -117
  749. package/dist/systemd.js.map +0 -1
@@ -6,34 +6,40 @@ import { composeHostPath } from "./compose-host-path.js";
6
6
  export { composeHostPath } from "./compose-host-path.js";
7
7
  import { ENGINE_SERVICE } from "./compose-engine-service.js";
8
8
  import { requireDockerDaemon, requireDockerDaemonAsync } from "./docker-runtime.js";
9
- import { askDocker, askDockerSync, NO_DOCKER_LIMIT, spawnDocker } from "./docker-exec.js";
9
+ import { askDocker, askDockerSync, DOCKER_QUERY_TIMEOUT_MS, NO_DOCKER_LIMIT, spawnDocker, } from "./docker-exec.js";
10
10
  import { fatalError } from "./ui/fatal.js";
11
11
  import { plain } from "./ui/messages.js";
12
12
  import { getActiveFlowApi } from "./ui/runtime/flow-session.js";
13
13
  import { COMPOSE_DEV_KONG_PORT, defaultAppStaticDir, postgrestSchemaEnv, externalDatabaseUrl, hooksPathFromProject, preferredFunctionsPathFromProject, realtimeEnabled, publicEnvServerEnv, serviceRoleRoutes, selfHostTlsEnabled, usesExternalDatabase, } from "./project-config.js";
14
14
  import { hasStudioOverride, pinnedVersion, VERSION_PIN_LOCAL } from "./binary-cache.js";
15
15
  import { assertEngineVersionSupported, engineImageVersion } from "./engine-floor.js";
16
- import { buildKongDeclarative } from "./kong-config.js";
17
- import { keyspaceInPostgres } from "./cache-provider.js";
18
- import { postgresImageFor, runningPostgresImage } from "./postgres-image.js";
16
+ import { buildKongDeclarative, WORKER_LISTEN_PORT } from "./kong-config.js";
17
+ import { keyspaceInPostgres, keyspacePasswordRequired } from "./cache-provider.js";
18
+ import { checkedKeyspacePasswordFile, KEYSPACE_PASSWORD_CONTAINER_PATH, KEYSPACE_PASSWORD_FILE_ENV, } from "./keyspace-password-file.js";
19
+ import { configuredPostgresImage } from "./postgres-image.js";
19
20
  import { STUDIO_DEV_PORT } from "./studio-dev-server.js";
20
21
  import { readEnvFile, readEnvValue } from "./env-file.js";
22
+ import { OWN_BUCKET_S3_SETTINGS } from "./local-storage.js";
21
23
  import { composeDbPublish, DB_PUBLIC_HOST_ENV, SELF_HOST_BIND } from "./db-port.js";
22
24
  import { upKeepingKongCurrent, upKeepingKongCurrentAsync } from "./compose-kong.js";
23
25
  import { addressPoolExhaustionHint } from "./docker-address-pool.js";
24
26
  import { composeAuthProviderEnv } from "./auth-providers.js";
27
+ import { composeAuthGroupsEnv } from "./auth-groups-env.js";
25
28
  import { composeSamlEnv, ensureSamlPrivateKey } from "./saml-config.js";
26
- import { BUNDLED_DB_USER, CONTROL_PLANE_SECRET_ENV, ENV_FILE_OVER_SHELL, SQL_EDITOR_PASSWORD_ENV, ensureControlPlaneSecret, ensureObjectStoreCredentials, envFileOverridesShell, OBJECT_STORE_ACCESS_KEY_ENV, OBJECT_STORE_SECRET_KEY_ENV, } from "./local-secrets.js";
29
+ import { BUNDLED_DB_USER, CONTROL_PLANE_SECRET_ENV, FORWARDING_SECRET_ENV, ensureForwardingSecret, ENV_FILE_OVER_SHELL, SQL_EDITOR_PASSWORD_ENV, ensureControlPlaneSecret, ensureKeyspacePassword, ensureObjectStoreCredentials, KEYSPACE_PASSWORD_ENV, envFileOverridesShell, OBJECT_STORE_ACCESS_KEY_ENV, OBJECT_STORE_SECRET_KEY_ENV, } from "./local-secrets.js";
27
30
  import { fieldMaskingTierFromProject } from "./field-masking-tier.js";
28
31
  import { readRecordedTier } from "./recorded-field-masking-tier.js";
29
32
  import { projectHasVersionedModels } from "./model-versioning.js";
30
33
  import { POSTGREST_IMAGE } from "./postgrest-release.js";
31
34
  import { postgrestHookActorEnv } from "./hook-actor.js";
32
- import { IN_REPO_IMAGE_ENV, RELEASE_IMAGES, unpinnedImagesNote } from "./release-images.js";
33
- import { configMailerAutoconfirm } from "./mailer-autoconfirm.js";
34
- import { MAILER_PASSTHROUGH_ENV, mailerUrlPathsEnv } from "./mailer-env.js";
35
+ import { IN_REPO_IMAGE_ENV, KONG_IMAGE, RELEASE_IMAGES, unpinnedImagesNote, VALKEY_IMAGE, } from "./release-images.js";
36
+ import { configEmailEnabled, configMailerAutoconfirm, EMAIL_ENABLED_ENV } from "./mailer-autoconfirm.js";
37
+ import { mailerUrlPathsEnv } from "./mailer-env.js";
38
+ import { resolveSpaFallback } from "./app/framework.js";
39
+ import { composeAllowListLine, composeDisableSignupFallback, composeMailerPassthrough, composeSiteUrlFallback, composeSmtpPass, } from "./compose-auth-settings.js";
35
40
  import { studioRuntimeJson } from "./studio-auth-config.js";
36
- import { patchRouteManifest } from "./route-manifest.js";
41
+ import { realtimeServiceDefaults, serviceSwitchServerEnv } from "./platform-settings.js";
42
+ import { switchServices } from "./route-manifest.js";
37
43
  /**
38
44
  * The control plane secret as the server and the control plane receive it, and nobody else.
39
45
  *
@@ -41,6 +47,56 @@ import { patchRouteManifest } from "./route-manifest.js";
41
47
  * refuse to start the stack and say which variable is missing.
42
48
  */
43
49
  const CONTROL_PLANE_SECRET_REQUIRED = `${CONTROL_PLANE_SECRET_ENV}: \${${CONTROL_PLANE_SECRET_ENV}:?${CONTROL_PLANE_SECRET_ENV} is missing from .env}`;
50
+ /**
51
+ * The forwarding secret (D14 option 2b), required like the control plane secret: writeSelfHostCompose
52
+ * generates it first. The server believes a forwarded end-user address only on a request carrying it,
53
+ * Kong adds it to requests to the server, and the functions worker adds it to its calls to the stack.
54
+ * `name` is what the receiving service calls it: the server reads it under its own setting name.
55
+ */
56
+ function forwardingSecretRequired(name = FORWARDING_SECRET_ENV) {
57
+ return `${name}: \${${FORWARDING_SECRET_ENV}:?${FORWARDING_SECRET_ENV} is missing from .env}`;
58
+ }
59
+ /**
60
+ * The keyspace password as the db, the server and Kong receive it, when the keyspace requires one
61
+ * (`keyspacePasswordRequired`). Required rather than defaulted, like the control plane secret:
62
+ * writeSelfHostCompose generates it first, and a stack started without it would refuse the server.
63
+ */
64
+ const KEYSPACE_PASSWORD_REQUIRED = `${KEYSPACE_PASSWORD_ENV}: \${${KEYSPACE_PASSWORD_ENV}:?${KEYSPACE_PASSWORD_ENV} is missing from .env}`;
65
+ /**
66
+ * The keyspace password line for a service that talks RESP to the keyspace, or nothing when it
67
+ * requires none. Kong is one with TLS on: its ACME plugin keeps certificates there, and kong.yml
68
+ * names this variable through Kong's env vault rather than holding the value. With the password in
69
+ * a file (`passwordFile`, R2-S16), the line names the file where {@link keyspacePasswordMount}
70
+ * puts it; writeSelfHostCompose refuses that beside TLS, since Kong's env vault cannot read a file.
71
+ */
72
+ function keyspacePasswordEnv(config, passwordFile) {
73
+ if (!keyspacePasswordRequired(config))
74
+ return "";
75
+ if (passwordFile === undefined)
76
+ return ` ${KEYSPACE_PASSWORD_REQUIRED}\n`;
77
+ return ` ${KEYSPACE_PASSWORD_FILE_ENV}: ${KEYSPACE_PASSWORD_CONTAINER_PATH}\n`;
78
+ }
79
+ /** The read-only mount of the project's keyspace password file, for a service the line above names it to. */
80
+ function keyspacePasswordMount(config, passwordFile) {
81
+ if (!keyspacePasswordRequired(config) || passwordFile === undefined)
82
+ return "";
83
+ return `${bindMount(passwordFile, KEYSPACE_PASSWORD_CONTAINER_PATH, true)}\n`;
84
+ }
85
+ /**
86
+ * The server's keyspace lines. Besides the environment compose gives it, the server reads the
87
+ * project's .env and .env.local, and refuses to start when it finds the password beside the file,
88
+ * so with a file the password is set blank here, which no dotenv file overrides.
89
+ *
90
+ * Beside a Valkey sidecar both are set blank for the same reason: `init` still writes the password
91
+ * to `.env`, the server loads it, and it would send AUTH as `supatype` to a Valkey that has no
92
+ * password (WRONGPASS on every cache call).
93
+ */
94
+ function keyspaceServerEnv(config, passwordFile) {
95
+ if (!keyspaceInPostgres(config))
96
+ return ` ${KEYSPACE_PASSWORD_ENV}: ""\n ${KEYSPACE_PASSWORD_FILE_ENV}: ""\n`;
97
+ const lines = keyspacePasswordEnv(config, passwordFile);
98
+ return lines !== "" && passwordFile !== undefined ? `${lines} ${KEYSPACE_PASSWORD_ENV}: ""\n` : lines;
99
+ }
44
100
  /** Env keys written when `versions` pins exist in supatype.config.ts. */
45
101
  export const COMPOSE_PINNED_IMAGE_ENV_KEYS = [
46
102
  "SUPATYPE_ENGINE_IMAGE",
@@ -61,6 +117,13 @@ const SEAWEEDFS_IMAGE = "chrislusf/seaweedfs:4.46@sha256:08d516132314207d10c8e37
61
117
  * durable, and a response-cache key beside them did not.
62
118
  */
63
119
  const ACME_KEY_PREFIX = "kong_acme:";
120
+ /**
121
+ * Anonymous sign-in from `.env`, off unless it turns it on (docs/auth/anonymous.mdx). Written only
122
+ * when the config does not set `auth.anonymous.enabled`: then the auth settings carry the key, with
123
+ * the config's value as its default, and a second line would be a duplicate key in the service.
124
+ */
125
+ const ANONYMOUS_SIGN_IN_FROM_ENV = " # Anonymous sign-in, off unless .env turns it on (docs/auth/anonymous.mdx).\n" +
126
+ " SUPATYPE_EXTERNAL_ANONYMOUS_USERS_ENABLED: ${SUPATYPE_EXTERNAL_ANONYMOUS_USERS_ENABLED:-false}\n";
64
127
  /**
65
128
  * The project's object store login as compose reads it from `.env` (issue 71: every stack used to
66
129
  * share one pair, written into this file). Required, not defaulted: writeSelfHostCompose generates
@@ -68,12 +131,47 @@ const ACME_KEY_PREFIX = "kong_acme:";
68
131
  */
69
132
  const OBJECT_STORE_ACCESS_KEY = `\${${OBJECT_STORE_ACCESS_KEY_ENV}:?${OBJECT_STORE_ACCESS_KEY_ENV} is missing from .env}`;
70
133
  const OBJECT_STORE_SECRET_KEY = `\${${OBJECT_STORE_SECRET_KEY_ENV}:?${OBJECT_STORE_SECRET_KEY_ENV} is missing from .env}`;
134
+ /**
135
+ * Whether the stack keeps files in the project's own S3 bucket rather than a SeaweedFS of its own:
136
+ * production storage is "s3" (`storage.production`, init's "Production storage?" answer). Never the
137
+ * Docker dev stack, which this generator also writes and which follows the dev setting (0.9.2).
138
+ */
139
+ function keepsFilesInOwnBucket(config, devLocal) {
140
+ return !devLocal && config.storage?.production === "s3";
141
+ }
142
+ /** The project's S3 settings compose hands the storage service from `.env`, blank when unset. */
143
+ const OPTIONAL_OWN_BUCKET_SETTINGS = OWN_BUCKET_S3_SETTINGS.filter((name) => name !== "S3_BUCKET");
144
+ /**
145
+ * The storage service's S3 settings: the stack's SeaweedFS, every one passed so the service needs
146
+ * no defaults, or the project's own bucket in single-bucket mode, which only S3_BUCKET is required for.
147
+ */
148
+ function storageS3Env(ownBucket) {
149
+ if (!ownBucket) {
150
+ return ` S3_ENDPOINT: http://seaweedfs:8333
151
+ S3_REGION: us-east-1
152
+ S3_ACCESS_KEY: ${OBJECT_STORE_ACCESS_KEY}
153
+ S3_SECRET_KEY: ${OBJECT_STORE_SECRET_KEY}
154
+ S3_FORCE_PATH_STYLE: "true"
155
+ `;
156
+ }
157
+ return ` # storage.production is "s3": every bucket is a key prefix in the project's own S3 bucket, and
158
+ # the stack runs no SeaweedFS. A blank setting is read as unset (see the storage docs).
159
+ S3_BUCKET: "\${S3_BUCKET:?S3_BUCKET is missing from .env, and storage.production is s3 in supatype.config.ts}"
160
+ ${OPTIONAL_OWN_BUCKET_SETTINGS.map((name) => ` ${name}: "\${${name}:-}"`).join("\n")}
161
+ `;
162
+ }
71
163
  /**
72
164
  * The compose volume key Postgres keeps its data in. Docker names the volume
73
165
  * `<compose project>_<key>`, and `supatype dev --reset-db` removes it by that name, so the key is
74
166
  * declared once rather than spelled out in the file and again in the code that deletes it.
75
167
  */
76
168
  export const DB_VOLUME_KEY = "db-data";
169
+ /**
170
+ * Bring the whole stack up, detached. `--remove-orphans` takes away the container of a service the
171
+ * compose file no longer has, as the valkey one is after `cache.provider` moves to pg_keyspace: it
172
+ * was left running beside the stack that replaced it (S-36). Its volume is data and is kept.
173
+ */
174
+ export const COMPOSE_UP_DETACHED = ["up", "-d", "--remove-orphans"];
77
175
  /**
78
176
  * Map a config version pin to a Docker Hub image reference. Postgres is not here: its image and
79
177
  * its keyspace capability are one decision, made by `postgresImageFor`.
@@ -94,7 +192,7 @@ export function dockerImageRef(component, version) {
94
192
  */
95
193
  export function composeDockerImageEnv(config) {
96
194
  const env = {};
97
- const postgres = postgresImageFor(config).ref;
195
+ const postgres = configuredPostgresImage(config).ref;
98
196
  if (postgres)
99
197
  env.SUPATYPE_POSTGRES_IMAGE = postgres;
100
198
  const versions = config.versions;
@@ -212,6 +310,10 @@ export function selfHostComposePaths(cwd) {
212
310
  s3ConfigPath: join(dir, "s3.json"),
213
311
  };
214
312
  }
313
+ /** The project folder a compose file {@link selfHostComposePaths} names lives in. */
314
+ export function projectRootOfComposePath(composePath) {
315
+ return dirname(dirname(dirname(composePath)));
316
+ }
215
317
  export function appUpstreamForCompose(config) {
216
318
  if (config.app.mode !== "proxy")
217
319
  return undefined;
@@ -236,8 +338,18 @@ function bindMount(source, target, readOnly) {
236
338
  ...(readOnly ? [" read_only: true"] : []),
237
339
  ].join("\n");
238
340
  }
341
+ /**
342
+ * The server's writable bind for the functions directory, or undefined when that directory is the
343
+ * project root. The auth server's admin env routes write `.env.local` and `.env.<name>.local` there.
344
+ */
345
+ function functionsMount(root, functionsHostDir) {
346
+ const rel = relative(root, functionsHostDir);
347
+ if (rel === "")
348
+ return undefined;
349
+ return bindMount(functionsHostDir, `/project/${rel.split(sep).join("/")}`, false);
350
+ }
239
351
  /** The bind mounts the generated stack uses, each naming its host path absolutely. */
240
- function projectMounts(cwd) {
352
+ function projectMounts(cwd, functionsHostDir) {
241
353
  const root = resolve(cwd);
242
354
  const paths = selfHostComposePaths(cwd);
243
355
  return {
@@ -245,6 +357,9 @@ function projectMounts(cwd) {
245
357
  projectWritable: bindMount(root, "/project", false),
246
358
  engineProject: bindMount(root, ENGINE_SERVICE.projectDir, false),
247
359
  projectState: bindMount(join(root, ".supatype"), "/project/.supatype", false),
360
+ // Undefined when the functions are the project root itself: a writable bind there would make the
361
+ // whole project writable, which the read-only mount exists to prevent.
362
+ functionsDir: functionsMount(root, functionsHostDir),
248
363
  kong: bindMount(paths.kongPath, "/etc/kong/kong.yml", true),
249
364
  seaweed: bindMount(paths.s3ConfigPath, "/etc/seaweedfs/s3.json", true),
250
365
  };
@@ -426,12 +541,26 @@ function publicEnvForCompose(config) {
426
541
  return "";
427
542
  return ` # server.public_env: no /supatype-env.json or /supatype-env.js.\n SUPATYPE_PUBLIC_ENV: "${value}"\n`;
428
543
  }
429
- function serverAppEnvForCompose(config, devLocal) {
544
+ /**
545
+ * The server's `SUPATYPE_STORAGE_DISABLED` and `SUPATYPE_GRAPHQL_DISABLED` lines, each ending in a
546
+ * newline, for a service `services` switches off; empty otherwise, leaving the server's default.
547
+ */
548
+ function serviceSwitchesForCompose(config) {
549
+ return Object.entries(serviceSwitchServerEnv(config))
550
+ .map(([name, value]) => ` # services in supatype.config.ts switches this service off.\n ${name}: "${value}"\n`)
551
+ .join("");
552
+ }
553
+ function serverAppEnvForCompose(config, devLocal, cwd) {
430
554
  const mode = config.app.mode ?? "none";
431
555
  const lines = [` SUPATYPE_APP_MODE: ${mode}`];
432
556
  if (mode === "static") {
433
557
  const dir = appStaticDir(config);
434
558
  lines.push(` SUPATYPE_APP_STATIC_DIR: /project/${dir.replace(/^\.\//, "")}`);
559
+ // Always the resolved value (`build.spa`, else the framework's default), the one `supatype deploy` sends to
560
+ // Cloud, so the gateway and Cloud agree. The second line lets Studio say the config set it.
561
+ lines.push(` SUPATYPE_APP_SPA_FALLBACK: "${resolveSpaFallback(config.build, cwd)}"`);
562
+ if (config.build?.spa !== undefined)
563
+ lines.push(' SUPATYPE_APP_SPA_FALLBACK_FROM_CONFIG: "true"');
435
564
  }
436
565
  else if (mode === "proxy" && config.app.upstream?.trim()) {
437
566
  lines.push(` SUPATYPE_APP_UPSTREAM: ${proxyUpstreamForCompose(config.app.upstream, devLocal)}`);
@@ -461,6 +590,40 @@ function networksClause(networks) {
461
590
  function networksBlock(functionsDb) {
462
591
  return `networks:\n ${FUNCTIONS_NETWORK}: {}\n${functionsDb ? ` ${FUNCTIONS_DB_NETWORK}: {}\n` : ""}`;
463
592
  }
593
+ /**
594
+ * Every container's log, rotated: 0.9.1 release test RB8.
595
+ *
596
+ * With no `logging:` a container writes to the daemon's default driver, and on a Linux server that
597
+ * is `json-file` with no size limit at all. An idle stack's Postgres wrote about 0.8 GB a day there,
598
+ * so the disk of the server the deploy guide describes filled in weeks and the database stopped.
599
+ * Docker Desktop's `local` default rotates, which is why nobody saw it on a laptop.
600
+ *
601
+ * `json-file` rather than `local` because it is what `docker logs` and every log shipper read
602
+ * without configuration. The sizes come from `.env`, as every other knob in this file does: the file
603
+ * is regenerated on every write, so an edit to it would not last.
604
+ */
605
+ const LOGGING_ANCHOR = `x-logging: &default-logging
606
+ driver: json-file
607
+ options:
608
+ max-size: "\${SUPATYPE_LOG_MAX_SIZE:-10m}"
609
+ max-file: "\${SUPATYPE_LOG_MAX_FILE:-5}"
610
+ `;
611
+ /** A service's `logging:` line, pointing at {@link LOGGING_ANCHOR}. */
612
+ const LOGGING = " logging: *default-logging";
613
+ /**
614
+ * A long-running service's restart policy: restarted when it fails, five times at most. Never a
615
+ * one-shot tool (`schema-engine`), which is meant to exit.
616
+ *
617
+ * 0.9.2 release test (N-FF11): only the server had one. A storage service that refused its S3
618
+ * settings exited 1 under policy `no` and stayed down, and so did any service that failed on
619
+ * something transient, a store or database still starting. Bounded, as the server's always was,
620
+ * rather than `unless-stopped`: a real misconfiguration ends exited with its reason in its log, which
621
+ * is what the CLI's watch on a starting stack looks for (stack-exit-watch.ts), instead of
622
+ * restarting for ever.
623
+ */
624
+ const RESTART = " restart: on-failure:5";
625
+ /** A long-running service's {@link LOGGING} and {@link RESTART} lines, which nearly every service has together. */
626
+ const SERVICE_DEFAULTS = `${LOGGING}\n${RESTART}`;
464
627
  /** Whether `url` (functions' direct database URL) names the stack's own `db` service. */
465
628
  export function namesComposeDatabase(url) {
466
629
  try {
@@ -471,7 +634,16 @@ export function namesComposeDatabase(url) {
471
634
  }
472
635
  }
473
636
  export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
474
- const mounts = projectMounts(cwd);
637
+ const mounts = projectMounts(cwd, preferredFunctionsPathFromProject(config, cwd));
638
+ // The server alone gets the functions directory writable (see functionsMount); the worker keeps
639
+ // the read-only project.
640
+ const functionsBind = mounts.functionsDir === undefined
641
+ ? ""
642
+ : ` # The functions directory is writable too: setting a function secret makes the auth server write
643
+ # .env.local and .env.<name>.local into it, which failed with "read-only file system" under the
644
+ # project mount above.
645
+ ${mounts.functionsDir}
646
+ `;
475
647
  const external = usesExternalDatabase(config);
476
648
  // Both halves come from the caller because both need the schema loaded, which this renderer does
477
649
  // not do. See `SelfHostComposeOptions`. One call, so the exposed schemas and the search path
@@ -489,6 +661,7 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
489
661
  const postgrestUrl = postgrestDatabaseUrl(config);
490
662
  const sqlEditorUrl = sqlEditorDatabaseUrl(config);
491
663
  const devLocal = options?.devLocal === true;
664
+ const ownBucket = keepsFilesInOwnBucket(config, devLocal);
492
665
  // An external database is not on any network of this stack.
493
666
  const functionsDb = options?.functionsDatabase === true && !external;
494
667
  const gatewayNetworks = networksClause(["default", FUNCTIONS_NETWORK]);
@@ -506,8 +679,10 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
506
679
  const authProviderEnv = composeAuthProviderEnv(config, publicApiUrl);
507
680
  // SAML's service provider sits under the same public URL, at /auth/v1 like the OAuth callback.
508
681
  const samlEnv = composeSamlEnv(config, publicApiUrl);
682
+ // Hooks, captcha, password, session, MFA, phone and rate limit settings: only what the config states.
683
+ const authGroupsEnv = composeAuthGroupsEnv(config);
509
684
  const studioHostDev = devLocal && hasStudioOverride(config);
510
- const appEnv = serverAppEnvForCompose(config, devLocal);
685
+ const appEnv = serverAppEnvForCompose(config, devLocal, cwd);
511
686
  const staticDir = appStaticDir(config);
512
687
  // functions.path and the project root, as the containers see them. These were hardcoded to
513
688
  // /project/functions and /project/hooks, so a project keeping its functions anywhere else had every
@@ -521,6 +696,7 @@ export function renderSelfHostCompose(config, cwd = process.cwd(), options) {
521
696
  : `
522
697
  studio:
523
698
  ${studioService}
699
+ ${SERVICE_DEFAULTS}
524
700
  environment:
525
701
  SUPATYPE_CLOUD_JSON: '${studioRuntimeJson(config, publicApiUrl)}'
526
702
  expose:
@@ -568,11 +744,12 @@ ${studioService}
568
744
  `;
569
745
  // One source for the credentials: the server is configured with them and the storage service is
570
746
  // handed them, and a mismatch does not fail at start, it fails at the first upload.
571
- const objectStoreBlock = ` seaweedfs:
747
+ const objectStoreBlock = ownBucket ? "" : ` seaweedfs:
572
748
  # Identities come from a config file rather than env vars, and the anonymous identity is
573
749
  # deliberately absent: a bucket is public because of its policy, never because the server is
574
750
  # open. Written beside this file by the same generator, so the two cannot drift.
575
751
  image: \${SUPATYPE_SEAWEEDFS_IMAGE:-${SEAWEEDFS_IMAGE}}
752
+ ${SERVICE_DEFAULTS}
576
753
  command: server -dir=/data -s3 -s3.port=8333 -s3.config=/etc/seaweedfs/s3.json
577
754
  environment:
578
755
  # Read by nothing inside. The object store loads s3.json only when it starts, so the login is
@@ -591,11 +768,19 @@ ${mounts.seaweed}
591
768
  retries: 20
592
769
  start_period: 5s
593
770
  ${seaweedPorts}`;
771
+ // 0.9.2 release test (N-RB2): the keyspace requires the project's password where the image takes
772
+ // one, and everything that talks RESP to it is handed the same value from .env, or the same file
773
+ // (R2-S16).
774
+ const keyspacePasswordFile = options?.keyspacePasswordFile;
775
+ const keyspaceAuthEnv = keyspacePasswordEnv(config, keyspacePasswordFile);
776
+ const keyspaceMount = keyspacePasswordMount(config, keyspacePasswordFile);
777
+ // The second listener is the functions worker's (kong-config.ts, WORKER_LISTEN_PORT). It is in
778
+ // KONG_PROXY_LISTEN so the worker's forwarding headers survive, and in no `ports:` mapping below.
779
+ const kongListen = ["0.0.0.0:8000", `0.0.0.0:${WORKER_LISTEN_PORT}`, ...(tlsEnabled ? ["0.0.0.0:8443 ssl"] : [])].join(", ");
594
780
  const kongTlsEnv = tlsEnabled
595
- ? ` KONG_PROXY_LISTEN: "0.0.0.0:8000, 0.0.0.0:8443 ssl"
596
- KONG_LUA_SSL_TRUSTED_CERTIFICATE: system
781
+ ? ` KONG_LUA_SSL_TRUSTED_CERTIFICATE: system
597
782
  KONG_LUA_SSL_VERIFY_DEPTH: "2"
598
- `
783
+ ${keyspaceAuthEnv}`
599
784
  : "";
600
785
  const kongPorts = tlsEnabled
601
786
  ? ` - "80:8000"
@@ -612,7 +797,8 @@ ${seaweedPorts}`;
612
797
  `
613
798
  : `
614
799
  valkey:
615
- image: \${SUPATYPE_VALKEY_IMAGE:-valkey/valkey:8-alpine}
800
+ image: \${SUPATYPE_VALKEY_IMAGE:-${VALKEY_IMAGE}}
801
+ ${SERVICE_DEFAULTS}
616
802
  command: ["valkey-server", "--appendonly", "yes"]
617
803
  expose:
618
804
  - "6379"
@@ -629,9 +815,8 @@ ${seaweedPorts}`;
629
815
  # then re-run \`supatype self-host compose up -d\`. Kong publishes :80/:443 and provisions certs automatically.
630
816
  `;
631
817
  // An external database is not ours to declare a volume for.
632
- const volumesBlock = `volumes:
633
- ${external ? "" : ` ${DB_VOLUME_KEY}:\n`} storage-data:
634
- ${keyspaceInPg ? "" : " valkey-data:\n"}`;
818
+ const volumes = `${external ? "" : ` ${DB_VOLUME_KEY}:\n`}${ownBucket ? "" : " storage-data:\n"}${keyspaceInPg ? "" : " valkey-data:\n"}`;
819
+ const volumesBlock = volumes === "" ? "" : `volumes:\n${volumes}`;
635
820
  // `depends_on` for the services that talk to Postgres. With an external database there is no
636
821
  // container to wait on, so the clause disappears entirely and each service retries on connect
637
822
  // instead: which is also what covers a database that restarts *after* boot, something no
@@ -652,7 +837,7 @@ ${keyspaceInPg ? "" : " valkey-data:\n"}`;
652
837
  //
653
838
  // A later push succeeds, which is exactly what made it read as an intermittent mystery. It
654
839
  // lands on the first push after a stack comes up, which is the first push a new user ever runs.
655
- const storageDependency = ` depends_on:
840
+ const storageDependency = ownBucket ? dbDependency : ` depends_on:
656
841
  ${dbDependencyClause} seaweedfs:
657
842
  condition: service_healthy
658
843
  `;
@@ -664,9 +849,12 @@ ${dbDependencyClause} seaweedfs:
664
849
  // container that can only report that. The server then has no realtime URL, which is what makes
665
850
  // subscription requests fail with a clear route error instead of hanging against a dead upstream.
666
851
  const realtime = realtimeEnabled(config);
852
+ // realtime.channels and realtime.recheckSeconds in the config, as the defaults a .env value overrides.
853
+ const realtimeDefaults = realtimeServiceDefaults(config);
667
854
  const realtimeBlock = realtime
668
855
  ? ` realtime:
669
856
  image: ${inRepoImage("realtime")}
857
+ ${SERVICE_DEFAULTS}
670
858
  expose:
671
859
  - "4000"
672
860
  - "4001"
@@ -685,6 +873,10 @@ ${dbDependencyClause} seaweedfs:
685
873
  # debug also logs each change a subscriber's access rules withheld; info logs only the
686
874
  # changes realtime could not judge. Set REALTIME_LOG_LEVEL in .env to change it.
687
875
  REALTIME_LOG_LEVEL: \${REALTIME_LOG_LEVEL:-info}
876
+ # docs/realtime.md: declared can only tighten realtime.channels; the re-check interval in
877
+ # seconds. Empty, the service's own defaults apply.
878
+ REALTIME_CHANNELS: \${REALTIME_CHANNELS:-${realtimeDefaults.REALTIME_CHANNELS ?? ""}}
879
+ REALTIME_CHANNEL_RECHECK_S: \${REALTIME_CHANNEL_RECHECK_S:-${realtimeDefaults.REALTIME_CHANNEL_RECHECK_S ?? ""}}
688
880
  ${dbDependency}`
689
881
  : ` # No \`realtime\` service: database.external.realtime is false. Subscriptions are
690
882
  # unavailable; REST, storage, auth and functions are unaffected.
@@ -767,7 +959,7 @@ ${dbDependency}`
767
959
  # Named here rather than left to the image because only this file knows both features are in
768
960
  # the same stack.
769
961
  SUPATYPE_KEYSPACE_OUTPUT_PLUGIN_LIBRARIES: "supacache_keys, wal2json"
770
- `
962
+ ${keyspaceAuthEnv}`
771
963
  : "";
772
964
  // Not published to the host: the keyspace is reachable to the compose network
773
965
  // (server, Kong) and nothing else. A RESP port on a public interface is an
@@ -783,7 +975,12 @@ ${dbDependency}`
783
975
  # database still needs (roles, extensions, wal_level for realtime).
784
976
  `
785
977
  : ` db:
786
- image: \${SUPATYPE_POSTGRES_IMAGE:-${runningPostgresImage(config)}}
978
+ image: \${SUPATYPE_POSTGRES_IMAGE:-${configuredPostgresImage(config).ref ?? RELEASE_IMAGES.postgres}}
979
+ # Docker's tini as PID 1, so postgres is not. PID 1 adopts every orphan in the container, and
980
+ # Postgres 17 restarts the whole server when an adopted child it never forked exits non-0/1,
981
+ # which is what a health check killed on timeout leaves behind (an orphaned pg_isready, exit 2).
982
+ init: true
983
+ ${SERVICE_DEFAULTS}
787
984
  ${functionsDb ? networksClause(["default", FUNCTIONS_DB_NETWORK]) : ""} environment:
788
985
  POSTGRES_USER: \${POSTGRES_USER:-supatype_admin}
789
986
  POSTGRES_PASSWORD: \${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is missing from .env}
@@ -794,14 +991,16 @@ ${functionsDb ? networksClause(["default", FUNCTIONS_DB_NETWORK]) : ""} envir
794
991
  SUPATYPE_SQL_EDITOR_PASSWORD: \${SUPATYPE_SQL_EDITOR_PASSWORD:?SUPATYPE_SQL_EDITOR_PASSWORD is missing from .env}
795
992
  ${keyspaceDbEnv}${dbPorts}${keyspaceExpose} volumes:
796
993
  - ${DB_VOLUME_KEY}:/var/lib/postgresql/data
797
- healthcheck:
994
+ ${keyspaceMount} healthcheck:
798
995
  # -h 127.0.0.1 forces TCP. Without it \`pg_isready\` uses the Unix socket, which the
799
996
  # entrypoint's temporary init server is already listening on while TCP is still refused,
800
997
  # so the container reported healthy, \`depends_on: service_healthy\` released, and every
801
998
  # service that connects over the network died with ECONNREFUSED on first boot. PostgREST
802
999
  # survived only because it retries. Observed on a clean stack: server, storage and
803
1000
  # realtime all exited 1 while db said "healthy".
804
- test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U \${POSTGRES_USER:-supatype_admin} -d \${POSTGRES_DB:-supatype}"]
1001
+ # Exec form, with pg_isready's own -t 2 under the 5s timeout below: shell form forks it under
1002
+ # sh, and when compose times a check out it kills the sh and orphans pg_isready.
1003
+ test: ["CMD", "pg_isready", "-h", "127.0.0.1", "-U", "\${POSTGRES_USER:-supatype_admin}", "-d", "\${POSTGRES_DB:-supatype}", "-t", "2"]
805
1004
  interval: 5s
806
1005
  timeout: 5s
807
1006
  # First boot runs initdb plus every bootstrap migration. Failures inside the start period
@@ -815,9 +1014,10 @@ ${keyspaceDbEnv}${dbPorts}${keyspaceExpose} volumes:
815
1014
  # Named, so a compose command run by hand reaches this stack instead of starting a second one
816
1015
  # under the folder's name. \`supatype self-host compose restart <service>\` saves running one.
817
1016
  name: ${composeProject}
818
- services:
1017
+ ${LOGGING_ANCHOR}services:
819
1018
  ${dbServiceBlock} postgrest:
820
1019
  image: ${POSTGREST_IMAGE}
1020
+ ${SERVICE_DEFAULTS}
821
1021
  expose:
822
1022
  - "3000"
823
1023
  environment:
@@ -842,18 +1042,14 @@ ${dbServiceBlock} postgrest:
842
1042
  ${hookActorLines(config)}${dbDependency}
843
1043
  storage:
844
1044
  image: ${inRepoImage("storage")}
1045
+ ${SERVICE_DEFAULTS}
845
1046
  expose:
846
1047
  - "5000"
847
1048
  environment:
848
1049
  PORT: 5000
849
1050
  DATABASE_URL: "${ownerUrl}"
850
1051
  JWT_SECRET: \${JWT_SECRET:?JWT_SECRET is missing from .env}
851
- S3_ENDPOINT: http://seaweedfs:8333
852
- S3_REGION: us-east-1
853
- S3_ACCESS_KEY: ${OBJECT_STORE_ACCESS_KEY}
854
- S3_SECRET_KEY: ${OBJECT_STORE_SECRET_KEY}
855
- S3_FORCE_PATH_STYLE: "true"
856
- # Bytes, -1 for unlimited. A self-hosted project has no plan, so it has no limits until .env
1052
+ ${storageS3Env(ownBucket)} # Bytes, -1 for unlimited. A self-hosted project has no plan, so it has no limits until .env
857
1053
  # sets one; the service on its own defaults to the free tier's 1 GiB quota and 50 MB files.
858
1054
  PROJECT_TIER: \${PROJECT_TIER:-enterprise}
859
1055
  STORAGE_QUOTA: \${STORAGE_QUOTA:--1}
@@ -862,6 +1058,7 @@ ${hookActorLines(config)}${dbDependency}
862
1058
  ${storageDependency}
863
1059
  functions-worker:
864
1060
  image: ${inRepoImage("functions-worker")}
1061
+ ${SERVICE_DEFAULTS}
865
1062
  # An init as PID 1 passes the stop signal on: without one the worker ignored SIGTERM, and every
866
1063
  # restart a deploy made waited out the whole stop timeout.
867
1064
  init: true
@@ -894,8 +1091,10 @@ ${mounts.projectReadOnly}
894
1091
  SUPATYPE_PROJECT_REF: ${JSON.stringify(config.project.name)}
895
1092
  PORT: "8001"
896
1093
  # In-compose loopback to Kong (not API_EXTERNAL_URL / localhost, unreachable from this container).
897
- SUPATYPE_URL: http://kong:8000
898
- SUPATYPE_INTERNAL_URL: http://kong:8000
1094
+ # Kong's worker listener, never published: it keeps the St-Forwarded-For and St-Forwarding-Secret
1095
+ # this worker adds, where port 8000 removes them (kong-config.ts, D14).
1096
+ SUPATYPE_URL: http://kong:${WORKER_LISTEN_PORT}
1097
+ SUPATYPE_INTERNAL_URL: http://kong:${WORKER_LISTEN_PORT}
899
1098
  # ctx.publicUrl: the address a browser or an app uses, for links a function gives to people.
900
1099
  # The same value the server is told is its own, never a name only this stack resolves.
901
1100
  SUPATYPE_PUBLIC_URL: ${publicApiUrl}
@@ -927,10 +1126,14 @@ ${mounts.projectReadOnly}
927
1126
  STRIPE_SECRET_KEY: \${STRIPE_SECRET_KEY:-}
928
1127
  STRIPE_WEBHOOK_SECRET: \${STRIPE_WEBHOOK_SECRET:-}
929
1128
  SITE_URL: \${SITE_URL:-${publicApiUrl}}
1129
+ # Added to this worker's calls to the stack's own address, so the auth server believes the end
1130
+ # user's address they pass on. Withheld from function code by the worker.
1131
+ ${forwardingSecretRequired()}
930
1132
  ${dbDependency}
931
1133
  ${realtimeBlock}
932
1134
  control-plane:
933
1135
  image: ${inRepoImage("control-plane")}
1136
+ ${SERVICE_DEFAULTS}
934
1137
  expose:
935
1138
  - "8080"
936
1139
  volumes:
@@ -956,6 +1159,7 @@ ${mounts.projectWritable}
956
1159
  ${realtimeControlPlaneEnv}${dbDependency}
957
1160
  server:
958
1161
  image: \${SUPATYPE_SERVER_IMAGE:-\${SUPATYPE_AUTH_IMAGE:-${RELEASE_IMAGES.server}}}
1162
+ ${LOGGING}
959
1163
  # host.docker.internal is a Docker Desktop name. On Linux it does not resolve unless it is
960
1164
  # mapped, so a project proxying the site or Studio to something on the host worked on macOS
961
1165
  # and Windows and failed on Linux with nothing reaching the app. host-gateway is Docker's own
@@ -969,7 +1173,7 @@ ${realtimeControlPlaneEnv}${dbDependency}
969
1173
  # on a slow host the gap is wide enough to lose it for good. Bounded
970
1174
  # rather than unlimited, so a real misconfiguration still stops and
971
1175
  # stays visible instead of hiding in a crash loop.
972
- restart: on-failure:5
1176
+ ${RESTART}
973
1177
  ${gatewayNetworks}${serverPorts} volumes:
974
1178
  # The project is read-only: the server reads the schema, the manifest and the functions, and
975
1179
  # has no business editing any of them.
@@ -982,7 +1186,7 @@ ${mounts.projectReadOnly}
982
1186
  # declared and never actually switched on. A narrower bind than making the whole project
983
1187
  # writable, because the rest of the tree keeps the guarantee.
984
1188
  ${mounts.projectState}
985
- working_dir: /project
1189
+ ${functionsBind}${keyspaceMount} working_dir: /project
986
1190
  environment:
987
1191
  SUPATYPE_MODE: ${devLocal ? "dev" : "standalone"}
988
1192
  SUPATYPE_MANIFEST_PATH: .supatype/manifest.json
@@ -993,7 +1197,7 @@ ${mounts.projectState}
993
1197
  SUPATYPE_STORAGE_URL: http://storage:5000
994
1198
  SUPATYPE_URL: ${publicApiUrl}
995
1199
  SUPATYPE_ANON_KEY: \${ANON_KEY:-}
996
- ${publicEnvForCompose(config)} SUPATYPE_SERVICE_ROLE_KEY: \${SERVICE_ROLE_KEY:-}
1200
+ ${publicEnvForCompose(config)}${serviceSwitchesForCompose(config)} SUPATYPE_SERVICE_ROLE_KEY: \${SERVICE_ROLE_KEY:-}
997
1201
  SUPATYPE_SQL_DATABASE_URL: "${ownerUrl}"
998
1202
  # The SQL editor's own login, not a superuser. The owner URL above stays: the server falls
999
1203
  # back to it and uses it for role membership.
@@ -1005,23 +1209,32 @@ ${realtimeServerEnv}
1005
1209
  SUPATYPE_CONTROL_PLANE_URL: http://control-plane:8080
1006
1210
  ${CONTROL_PLANE_SECRET_REQUIRED}
1007
1211
  SUPATYPE_VALKEY_ADDR: ${respHost}:6379
1008
- ${appEnv}
1212
+ ${keyspaceServerEnv(config, keyspacePasswordFile)}${appEnv}
1009
1213
  SUPATYPE_API_HOST: 0.0.0.0
1010
1214
  SUPATYPE_API_PORT: 9999
1011
1215
  SUPATYPE_API_EXTERNAL_URL: ${publicApiUrl}
1216
+ # The client address the per-client limits (verify, OTP, sign-up, recover, token refresh)
1217
+ # count against. Kong writes X-Real-IP from the connection and replaces any the client sent;
1218
+ # X-Forwarded-For would keep the client's own text at the front. Unset, no request through
1219
+ # Kong was ever counted. Behind another proxy, set the header that proxy writes in .env.
1220
+ SUPATYPE_RATE_LIMIT_HEADER: "\${SUPATYPE_RATE_LIMIT_HEADER:-X-Real-IP}"
1221
+ # Believed only on a request carrying it: Kong adds it, a client cannot (D14).
1222
+ ${forwardingSecretRequired("SUPATYPE_SECURITY_FORWARDING_SECRET")}
1012
1223
  # Browser origins allowed besides the site URL: api.corsOrigins, then whatever .env adds.
1013
1224
  # A list saved in Studio replaces both until it is reset. Dev mode allows every origin.
1014
1225
  SUPATYPE_CORS_ALLOW_ORIGINS: "${corsOriginsEnv(config)}"
1015
1226
  SUPATYPE_DB_DRIVER: postgres
1016
1227
  SUPATYPE_DB_DATABASE_URL: "${authUrl}${authSearchPathSeparator}search_path=auth"
1017
- SUPATYPE_SITE_URL: \${SITE_URL:-${siteUrlFallback}}
1228
+ SUPATYPE_SITE_URL: \${SITE_URL:-${composeSiteUrlFallback(config, siteUrlFallback)}}
1018
1229
  SUPATYPE_JWT_SECRET: \${JWT_SECRET:?JWT_SECRET is missing from .env}
1019
1230
  SUPATYPE_JWT_EXP: 3600
1020
1231
  SUPATYPE_JWT_AUD: authenticated
1021
1232
  SUPATYPE_JWT_DEFAULT_GROUP_NAME: authenticated
1022
1233
  SUPATYPE_JWT_ADMIN_ROLES: service_role,supatype_admin
1023
- # auth.email.enableConfirmations decides the fallback; a value in .env wins.
1024
- SUPATYPE_MAILER_AUTOCONFIRM: \${SUPATYPE_MAILER_AUTOCONFIRM:-${configMailerAutoconfirm(config)}}
1234
+ # auth.email.enabled and auth.email.enableConfirmations decide the fallbacks; a value in .env
1235
+ # wins. Unset, a standalone stack sends confirmation links and a dev one confirms at once.
1236
+ ${EMAIL_ENABLED_ENV}: \${${EMAIL_ENABLED_ENV}:-${configEmailEnabled(config)}}
1237
+ SUPATYPE_MAILER_AUTOCONFIRM: \${SUPATYPE_MAILER_AUTOCONFIRM:-${configMailerAutoconfirm(config, devLocal ? "dev" : "standalone")}}
1025
1238
  # Emailed links are SUPATYPE_API_EXTERNAL_URL plus these paths. The external URL is the
1026
1239
  # gateway's root, where / belongs to the app, so the server's default of /verify sent every
1027
1240
  # confirmation, magic-link and recovery link to a 404. The auth routes are under /auth/v1/.
@@ -1039,14 +1252,14 @@ ${composeEnvLines(mailerUrlPathsEnv())}
1039
1252
  # leaving it unset now behaves exactly as it would with no value at all.
1040
1253
  SUPATYPE_SMTP_PORT: \${SUPATYPE_SMTP_PORT:-587}
1041
1254
  SUPATYPE_SMTP_USER: \${SUPATYPE_SMTP_USER:-}
1042
- SUPATYPE_SMTP_PASS: \${SUPATYPE_SMTP_PASS:-}
1255
+ SUPATYPE_SMTP_PASS: ${composeSmtpPass(config)}
1043
1256
  SUPATYPE_SMTP_ADMIN_EMAIL: \${SUPATYPE_SMTP_ADMIN_EMAIL:-}
1044
1257
  SUPATYPE_SMTP_SENDER_NAME: \${SUPATYPE_SMTP_SENDER_NAME:-}
1045
1258
  # Resend's key and sender, and SES's sender, from .env. Without these the server had no way
1046
1259
  # to get them and a resend or ses provider fell back to the noop mailer.
1047
- ${composeEnvLines(Object.fromEntries(MAILER_PASSTHROUGH_ENV.map((name) => [name, `\${${name}:-}`])))}
1048
- SUPATYPE_DISABLE_SIGNUP: \${DISABLE_SIGNUP:-false}
1049
- ${authProviderEnv}${samlEnv}
1260
+ ${composeEnvLines(composeMailerPassthrough(config))}
1261
+ SUPATYPE_DISABLE_SIGNUP: \${DISABLE_SIGNUP:-${composeDisableSignupFallback(config)}}
1262
+ ${config.auth?.anonymous?.enabled === undefined ? ANONYMOUS_SIGN_IN_FROM_ENV : ""}${composeAllowListLine(config)}${authProviderEnv}${authGroupsEnv}${samlEnv}
1050
1263
  depends_on:
1051
1264
  ${dbDependencyClause}${keyspaceInPg ? "" : " valkey:\n condition: service_started\n"} postgrest:
1052
1265
  condition: service_started
@@ -1060,13 +1273,15 @@ ${realtimeDependency} control-plane:
1060
1273
  ${objectStoreBlock}
1061
1274
  schema-engine:
1062
1275
  image: \${${ENGINE_SERVICE.imageVariable}:-${ENGINE_SERVICE.defaultImage}}
1276
+ ${LOGGING}
1063
1277
  profiles: ["tools"]
1064
1278
  entrypoint: ["${ENGINE_SERVICE.entrypoint}"]
1065
1279
  volumes:
1066
1280
  ${mounts.engineProject}
1067
1281
  working_dir: ${ENGINE_SERVICE.projectDir}
1068
1282
  ${dbDependency}${studioBlock}${valkeyBlock}${tlsHintComment} kong:
1069
- image: kong:3.6
1283
+ image: \${SUPATYPE_KONG_IMAGE:-${KONG_IMAGE}}
1284
+ ${SERVICE_DEFAULTS}
1070
1285
  ${gatewayNetworks} # host.docker.internal is a Docker Desktop name. On Linux it does not resolve unless it is
1071
1286
  # mapped, so a project proxying the site or Studio to something on the host worked on macOS
1072
1287
  # and Windows and failed on Linux with nothing reaching the app. host-gateway is Docker's own
@@ -1100,6 +1315,9 @@ ${gatewayNetworks} # host.docker.internal is a Docker Desktop name. On Linux
1100
1315
  # realtime subscribe often took that long. A records still come from the hosts file first, so
1101
1316
  # host.docker.internal above resolves as before.
1102
1317
  KONG_DNS_ORDER: "LAST,A,CNAME"
1318
+ # Read through Kong's env vault by the pre-function on every route to the server (kong-config.ts).
1319
+ ${forwardingSecretRequired()}
1320
+ KONG_PROXY_LISTEN: "${kongListen}"
1103
1321
  ${kongTlsEnv} volumes:
1104
1322
  ${mounts.kong}
1105
1323
  ports:
@@ -1118,38 +1336,41 @@ function ensureComposeManifest(cwd, config) {
1118
1336
  // The manifest is generated, not operator-authored, but `push` writes real values into it (the
1119
1337
  // schema, for one), so an existing file keeps every key but the routes below. Malformed, it is
1120
1338
  // left for the server to complain about rather than overwritten here.
1121
- if (existsSync(manifestPath)) {
1122
- patchRouteManifest(manifestPath, composeServiceRoutes(config), { keepMalformed: true });
1123
- return;
1124
- }
1125
- patchRouteManifest(manifestPath, {
1126
- schema: "public",
1127
- postgrest_url: "http://postgrest:3000",
1128
- ...composeServiceRoutes(config),
1129
- });
1339
+ const fresh = existsSync(manifestPath) ? {} : { schema: "public", postgrest_url: "http://postgrest:3000" };
1340
+ switchServices(manifestPath, composeServiceSwitches(config), { ...fresh, ...composeServiceRoutes(config) }, { keepMalformed: true });
1130
1341
  }
1131
1342
  /**
1132
1343
  * Where the server finds each service of this stack, set on every render rather than only into a
1133
1344
  * new file. Native dev shares the manifest and records its own host ports for realtime, functions
1134
1345
  * and storage, so a project moved from native to Docker kept native's URLs and the server proxied
1135
1346
  * every subscription and every /storage/v1 call to a port nothing in the stack listened on (502).
1136
- * An older CLI's `functions_enabled: false` is put right by the same write.
1137
1347
  */
1138
1348
  function composeServiceRoutes(config) {
1139
1349
  return {
1140
1350
  // This file always generates a `storage` service, and native dev records its own storage
1141
1351
  // service on a host port.
1142
1352
  storage_url: "http://storage:5000",
1143
- // Matches the compose file: a manifest advertising a service that was not generated is how
1144
- // the server ends up proxying subscriptions to a host that does not resolve. Undefined drops
1145
- // the key.
1146
- realtime_enabled: realtimeEnabled(config),
1353
+ // Undefined drops the key: no realtime service is generated (composeServiceSwitches).
1147
1354
  realtime_url: realtimeEnabled(config) ? "http://realtime:4000" : undefined,
1355
+ functions_worker_url: COMPOSE_FUNCTIONS_WORKER_URL,
1356
+ };
1357
+ }
1358
+ /**
1359
+ * Which services of this stack are switched on, set on every render with its routes. An older
1360
+ * CLI's `functions_enabled: false` is put right by the same write.
1361
+ */
1362
+ function composeServiceSwitches(config) {
1363
+ return {
1364
+ // The stack's storage is always on, its start value: native dev switches its own storage service
1365
+ // off and on, and a switch it left would switch off the stack's.
1366
+ storage: undefined,
1367
+ // Matches the compose file: a manifest advertising a service that was not generated is how
1368
+ // the server ends up proxying subscriptions to a host that does not resolve.
1369
+ realtime: realtimeEnabled(config),
1148
1370
  // True because this file *always* generates a `functions-worker` service and hands the server
1149
1371
  // `SUPATYPE_FUNCTIONS_WORKER_URL`. It said false, so the server answered 404 for every function
1150
1372
  // in a stack that was running a worker for them, provisioned, then switched off.
1151
- functions_enabled: true,
1152
- functions_worker_url: COMPOSE_FUNCTIONS_WORKER_URL,
1373
+ functions: true,
1153
1374
  };
1154
1375
  }
1155
1376
  /**
@@ -1298,16 +1519,27 @@ function resolveDrafts(cwd, config, options) {
1298
1519
  return options.drafts;
1299
1520
  return projectHasVersionedModels(cwd, config);
1300
1521
  }
1522
+ /**
1523
+ * The host file holding the keyspace password when the project names one (R2-S16), checked before
1524
+ * anything is written: both forms set, a file that is missing or empty, or a file beside HTTPS
1525
+ * (whose Kong cannot read one) stop here with what to change, rather than in a container later.
1526
+ */
1527
+ function composeKeyspacePasswordFile(cwd, config, options) {
1528
+ const use = { required: keyspacePasswordRequired(config), tls: selfHostTlsEnabled(config, options?.devLocal === true) };
1529
+ return checkedKeyspacePasswordFile(cwd, use, { brand: { intro: "Self-host compose" } })?.path;
1530
+ }
1301
1531
  export function writeSelfHostCompose(cwd, config, options) {
1302
1532
  // No URL-unsafe password check here: `supatype update` and the dev watcher write this file too,
1303
1533
  // and start nothing. up, render, restart and dev refuse before they start. push, diff and dev's
1304
1534
  // recovery only start the database, so they warn (startComposeDatabase in dev-compose.ts).
1305
1535
  assertExternalUrlMatchesEnv(cwd, config);
1306
1536
  assertBundledDbUser(cwd, config);
1537
+ const keyspacePasswordFile = composeKeyspacePasswordFile(cwd, config, options);
1307
1538
  const tier = resolveFieldMaskingTier(cwd, config, options);
1308
1539
  const resolved = {
1309
1540
  ...options,
1310
1541
  ...(tier !== undefined && { fieldMaskingTier: tier }),
1542
+ ...(keyspacePasswordFile !== undefined && { keyspacePasswordFile }),
1311
1543
  drafts: resolveDrafts(cwd, config, options),
1312
1544
  functionsDatabase: options?.functionsDatabase ?? namesComposeDatabase(readEnvValue(cwd, "SUPATYPE_FUNCTIONS_DB_URL", "")),
1313
1545
  };
@@ -1316,16 +1548,31 @@ export function writeSelfHostCompose(cwd, config, options) {
1316
1548
  mkdirSync(paths.dir, { recursive: true });
1317
1549
  // Before the file that requires it is written, so no stack is ever rendered without one.
1318
1550
  ensureControlPlaneSecret(cwd);
1551
+ ensureForwardingSecret(cwd);
1552
+ // The keyspace password the same way, where the keyspace requires one (N-RB2) and the project
1553
+ // keeps it in .env. An existing project gets one on its next dev or up, and compose recreates db
1554
+ // and server with it.
1555
+ if (keyspacePasswordRequired(config) && keyspacePasswordFile === undefined)
1556
+ ensureKeyspacePassword(cwd);
1319
1557
  // The SAML signing key too, once SAML is on: the file requires it, and it must never change.
1320
1558
  ensureSamlPrivateKey(cwd, config);
1321
- // No functions/ or hooks/ here: the worker mounts the whole project and treats a missing root as
1322
- // nothing to serve, while an empty functions/ made `dev` scaffold function types into projects
1323
- // that have no functions. `functions new` and `init` create it when there is one.
1559
+ // No hooks/ here: the worker mounts the whole project and treats a missing root as nothing to
1560
+ // serve. The functions directory is made below, for the server's bind; it stays empty, and an
1561
+ // empty one is not scaffolded into (refreshFunctionsContext), so a project with no functions
1562
+ // still gets no function types.
1324
1563
  ensureComposeManifest(cwd, config);
1325
- writeFileSync(paths.composePath, renderSelfHostCompose(config, cwd, resolved), "utf8");
1564
+ const rendered = renderSelfHostCompose(config, cwd, resolved);
1565
+ // The server binds the functions directory writable, and a bind whose host path is missing is
1566
+ // refused when the stack starts. Created only after the render, which refuses a path outside the
1567
+ // project; and not when the directory is the project root, which is there already.
1568
+ mkdirSync(preferredFunctionsPathFromProject(config, cwd), { recursive: true });
1569
+ writeFileSync(paths.composePath, rendered, "utf8");
1326
1570
  // The object store's login, from the same `.env` values the compose file reads, generated first
1327
1571
  // when the project has none.
1328
- writeFileSync(paths.s3ConfigPath, renderSeaweedIdentities(ensureObjectStoreCredentials(cwd)), "utf8");
1572
+ // Not for a stack on the project's own bucket, which runs no object store.
1573
+ if (!keepsFilesInOwnBucket(config, options?.devLocal === true)) {
1574
+ writeFileSync(paths.s3ConfigPath, renderSeaweedIdentities(ensureObjectStoreCredentials(cwd)), "utf8");
1575
+ }
1329
1576
  const studioHostDev = options?.devLocal === true && hasStudioOverride(config);
1330
1577
  const tlsEnabled = selfHostTlsEnabled(config, options?.devLocal === true);
1331
1578
  const domain = config.server.domain?.trim();
@@ -1346,15 +1593,23 @@ export function writeSelfHostCompose(cwd, config, options) {
1346
1593
  email: acmeEmail,
1347
1594
  domain,
1348
1595
  redisHost: keyspaceInPostgres(config) ? "db" : "valkey",
1596
+ redisAuth: keyspacePasswordRequired(config),
1349
1597
  },
1350
1598
  }
1351
1599
  : {}),
1352
1600
  }), "utf8");
1353
1601
  return paths;
1354
1602
  }
1355
- /** Exit with a friendly compose failure message. */
1603
+ /**
1604
+ * What the last compose run that captured its output said when it failed, and the cause recognised,
1605
+ * or nothing. Each run starts it afresh. Said again in the fatal message: under dev's dashboard it
1606
+ * was printed only into the pane, which froze cut at the window's width, and the screen left after
1607
+ * the dashboard said only "docker compose failed" (0.9.2 round 2, R2-S10).
1608
+ */
1609
+ let lastComposeFailure = [];
1610
+ /** Exit with a friendly compose failure message, carrying the reason the failed run gave. */
1356
1611
  export function exitComposeFailed(status, context, brand) {
1357
- fatalError(`docker compose failed (exit ${status}).`, [context, "Check logs: supatype self-host compose logs"], { ...(brand !== undefined && { brand }), exitCode: status === 0 ? 1 : status });
1612
+ fatalError(`docker compose failed (exit ${status}).`, [...lastComposeFailure, context, "Check logs: supatype self-host compose logs"], { ...(brand !== undefined && { brand }), exitCode: status === 0 ? 1 : status });
1358
1613
  }
1359
1614
  /** The `docker` arguments for `docker compose <args>` on one project's file. */
1360
1615
  function composeInvocation(composePath, args, projectRoot, composeProject, quiet) {
@@ -1379,6 +1634,7 @@ function composeInvocation(composePath, args, projectRoot, composeProject, quiet
1379
1634
  export function runDockerCompose(composePath, args, projectRoot = process.cwd(), composeProject, options) {
1380
1635
  if (options?.skipDaemonProbe !== true)
1381
1636
  requireDockerDaemon(options?.brand !== undefined ? { brand: options.brand } : undefined);
1637
+ lastComposeFailure = [];
1382
1638
  // Inside a command's flow, docker's output is captured and its stdout logged there. Written
1383
1639
  // straight to the terminal, it landed in the frame the flow redraws, and every line above it
1384
1640
  // came out twice.
@@ -1429,6 +1685,7 @@ export async function settleComposeRuns() {
1429
1685
  }
1430
1686
  async function quietComposeRun(composePath, args, projectRoot, composeProject, brand) {
1431
1687
  await requireDockerDaemonAsync(brand !== undefined ? { brand } : undefined);
1688
+ lastComposeFailure = [];
1432
1689
  const runCompose = () => askDockerCompose(composePath, args, projectRoot, composeProject, NO_DOCKER_LIMIT);
1433
1690
  // As in runDockerCompose: a Kong already running is reloaded when `up` moved what it routes to.
1434
1691
  const result = args[0] === "up"
@@ -1499,20 +1756,34 @@ function capturedComposeOutput(result) {
1499
1756
  .trim();
1500
1757
  }
1501
1758
  /**
1502
- * Say what a failed compose run printed, when the CLI captured it, and any cause it recognises.
1503
- * `captured` is null when the output already went to the terminal.
1759
+ * Say what a failed compose run printed, when the CLI captured it, and any cause it recognises,
1760
+ * and keep it for {@link exitComposeFailed}. `captured` is null when the output already went to the
1761
+ * terminal, which then keeps it too.
1504
1762
  */
1505
1763
  function reportComposeFailure(args, captured) {
1506
- if (captured)
1507
- console.error(`[supatype] docker compose: ${captured}`);
1508
- if (args[0] !== "up")
1509
- return;
1510
- for (const line of addressPoolExhaustionHint(captured))
1764
+ const hints = args[0] === "up" ? addressPoolExhaustionHint(captured) : [];
1765
+ const lines = [...(captured ? [`docker compose: ${captured}`] : []), ...hints];
1766
+ for (const line of lines)
1511
1767
  console.error(`[supatype] ${line}`);
1768
+ if (captured !== null)
1769
+ lastComposeFailure = lines;
1512
1770
  }
1513
1771
  /** Compose project name for a Supatype project, isolates docker state per project. */
1514
1772
  export function composeProjectName(projectName) {
1515
1773
  const slug = projectName.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
1516
1774
  return `supatype-${slug || "project"}`;
1517
1775
  }
1776
+ /**
1777
+ * The volumes Docker still holds for the compose project `composeProject`, by compose's own label;
1778
+ * none when Docker cannot say. `down --volumes` removes only those the compose file declares now,
1779
+ * so one a service left the file with (SeaweedFS's, after a switch to S3) is still here.
1780
+ */
1781
+ export function composeProjectVolumes(composeProject) {
1782
+ const listed = askDockerSync(["volume", "ls", "-q", "--filter", `label=com.docker.compose.project=${composeProject}`], {
1783
+ timeoutMs: DOCKER_QUERY_TIMEOUT_MS,
1784
+ });
1785
+ if (listed.status !== 0)
1786
+ return [];
1787
+ return listed.stdout.split(/\r?\n/).map((line) => line.trim()).filter((line) => line !== "");
1788
+ }
1518
1789
  //# sourceMappingURL=self-host-compose.js.map