@ts-cloud/core 0.7.21 → 0.7.23

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.
package/dist/index.js CHANGED
@@ -22333,6 +22333,8 @@ function createDashboardSite(options) {
22333
22333
  };
22334
22334
  }
22335
22335
  // src/presets/management-dashboard.ts
22336
+ var DASHBOARD_STATE_DIR = ".ts-cloud";
22337
+ var DASHBOARD_ENTRY = "./node_modules/@stacksjs/ts-cloud/dist/bin/cli.js";
22336
22338
  function apexOf(domain) {
22337
22339
  const parts = domain.split(".").filter(Boolean);
22338
22340
  return parts.length <= 2 ? domain : parts.slice(-2).join(".");
@@ -22395,7 +22397,7 @@ function resolveManagementDashboardSites(config, environment, opts) {
22395
22397
  return [];
22396
22398
  const auth2 = opts.password ? { auth: { username: opts.username || "admin", password: opts.password, realm: opts.realm } } : {};
22397
22399
  const build = opts.build === false || opts.build === undefined ? {} : { build: opts.build };
22398
- if (opts.live) {
22400
+ if (opts.live !== false) {
22399
22401
  const domain = resolveDashboardDomain(config, environment, opts.domain);
22400
22402
  if (!domain)
22401
22403
  return [];
@@ -22404,11 +22406,12 @@ function resolveManagementDashboardSites(config, environment, opts) {
22404
22406
  root: opts.uiRoot,
22405
22407
  deploy: "server",
22406
22408
  domain,
22407
- start: `cloud dashboard:serve --box --host 127.0.0.1 --port ${port}`,
22409
+ preStart: ["bun install --production --no-save"],
22410
+ start: `bun ${DASHBOARD_ENTRY} dashboard:serve --box --host 127.0.0.1 --port ${port}`,
22408
22411
  port,
22409
- ssl: { provider: "letsencrypt" },
22410
- ...build,
22411
- ...auth2
22412
+ sharedPaths: [DASHBOARD_STATE_DIR],
22413
+ healthCheck: { path: "/login" },
22414
+ ssl: { provider: "letsencrypt" }
22412
22415
  };
22413
22416
  return [{ name: managementDashboardSiteName(domain), site }];
22414
22417
  }
@@ -47551,6 +47554,8 @@ export {
47551
47554
  DNS,
47552
47555
  DLQMonitoringManager,
47553
47556
  DEFAULT_SERVICE_LIMITS,
47557
+ DASHBOARD_STATE_DIR,
47558
+ DASHBOARD_ENTRY,
47554
47559
  CrossRegionReferenceManager,
47555
47560
  CredentialError,
47556
47561
  ContainerRegistryManager,
@@ -1,12 +1,26 @@
1
1
  import type { CloudConfig, EnvironmentType, SiteConfig } from '../types';
2
2
  /**
3
3
  * Auto-deployed management dashboard (the `@ts-cloud/ui` stx app — the Server +
4
- * Serverless views). When a server is provisioned, ts-cloud injects this as a
5
- * server-static site so the dashboard ships automatically with every box.
4
+ * Serverless views). When a server is provisioned, ts-cloud injects this so the
5
+ * dashboard ships automatically with every box.
6
6
  *
7
- * It is served behind HTTP Basic auth (htpasswd) whose password comes from an
8
- * environment value (`TS_CLOUD_UI_PASSWORD`). If that value is NOT set, the
9
- * dashboard is served WITHOUT auth no password is invented.
7
+ * Two models:
8
+ *
9
+ * **Live (the default).** The dashboard runs as a service on the box
10
+ * (`cloud dashboard:serve --box`) behind the proxy, and authenticates itself:
11
+ * a login page, sessions, and per-site collaborator grants. No htpasswd — the
12
+ * app is the authentication, and a shared Basic-auth password in front of it
13
+ * would defeat the point, since every collaborator would need the box's one
14
+ * password just to reach the login page.
15
+ *
16
+ * **Static (`TS_CLOUD_UI_STATIC`).** The built UI shipped as files behind
17
+ * htpasswd. One shared password, all data baked into the HTML at build time,
18
+ * and therefore **no collaborators** — whoever holds the password sees every
19
+ * site on the box. Kept for boxes that cannot run the service.
20
+ *
21
+ * Live mode is single-host by design: one control panel per box, many sites,
22
+ * per-site grants (the Forge/Coolify model). Static mode fans out one dashboard
23
+ * per apex, since it is only serving the same files on each domain.
10
24
  */
11
25
  export interface ManagementDashboardOptions {
12
26
  /** Directory shipped as the static site root (built UI, or source dir + build). */
@@ -15,25 +29,42 @@ export interface ManagementDashboardOptions {
15
29
  build?: string | false;
16
30
  /** Explicit domain (e.g. from `TS_CLOUD_UI_DOMAIN`); else derived. */
17
31
  domain?: string;
18
- /** Basic-auth username. @default 'admin' */
32
+ /** Basic-auth username, static mode only. @default 'admin' */
19
33
  username?: string;
20
34
  /**
21
- * Basic-auth password. When empty/undefined the dashboard is served WITHOUT
22
- * htpasswd (no default password is invented).
35
+ * Basic-auth password, static mode only. When empty/undefined the static
36
+ * dashboard is served WITHOUT htpasswd (no default password is invented).
37
+ * Ignored in live mode, where the app authenticates.
23
38
  */
24
39
  password?: string;
25
- /** Browser auth realm. */
40
+ /** Browser auth realm, static mode only. */
26
41
  realm?: string;
27
42
  /**
28
- * Live mode: deploy the dashboard as a server-app (a `cloud dashboard:serve
29
- * --box` service on the box) instead of static files, so it serves the
30
- * project's LIVE data + a working control API on the server. The proxy routes
31
- * the dashboard host to its loopback port (behind Basic auth).
43
+ * Live mode: run the dashboard as a service on the box, serving live data,
44
+ * the control API, and its own login + collaborator model.
45
+ * @default true
32
46
  */
33
47
  live?: boolean;
34
48
  /** Loopback port for the live (box-mode) dashboard service. @default 7676 */
35
49
  port?: number;
50
+ /**
51
+ * ts-cloud version the box installs to run the dashboard. Defaults to the
52
+ * published range so a box always gets a dashboard matching this generation.
53
+ */
54
+ version?: string;
36
55
  }
56
+ /** Where the live dashboard keeps its users, session key and cache. */
57
+ export declare const DASHBOARD_STATE_DIR = ".ts-cloud";
58
+ /**
59
+ * The dashboard service's entry point inside its release dir. The CLI is
60
+ * installed from npm by the release's `bun install`, so this path exists on the
61
+ * box without the deploy having to ship a binary.
62
+ *
63
+ * Called through the module path rather than the `cloud` bin shim because the
64
+ * systemd unit runs `/usr/local/bin/bun <args>` directly — a bare `cloud` would
65
+ * be resolved by bun as a FILE to execute, and the service would never start.
66
+ */
67
+ export declare const DASHBOARD_ENTRY = "./node_modules/@stacksjs/ts-cloud/dist/bin/cli.js";
37
68
  /**
38
69
  * Derive the PRIMARY dashboard hostname (`dashboard.<apex>`) for the project.
39
70
  * Prefers `explicit`, else the project's canonical domain (`infrastructure.dns.domain`,
package/dist/types.d.ts CHANGED
@@ -961,7 +961,12 @@ export interface SiteConfig {
961
961
  * Paths symlinked from the site's `shared/` directory into every release so
962
962
  * they persist across deploys (e.g. `storage`, uploaded files, a SQLite db).
963
963
  * `.env` is always shared and need not be listed.
964
- * @default ['storage', '.env']
964
+ *
965
+ * A release is a fresh directory, so anything the app WRITES and must keep
966
+ * has to be listed here or the next deploy silently starts it from empty.
967
+ *
968
+ * Honored by both PHP/Laravel sites and server-app sites (`start`).
969
+ * @default ['storage', '.env'] for PHP sites; `['.env']` for server-app sites
965
970
  */
966
971
  sharedPaths?: string[];
967
972
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-cloud/core",
3
- "version": "0.7.21",
3
+ "version": "0.7.23",
4
4
  "type": "module",
5
5
  "description": "Core CloudFormation generation library for ts-cloud",
6
6
  "author": "Chris Breuer <chris@stacksjs.com>",
@@ -31,7 +31,7 @@
31
31
  "typecheck": "tsc --noEmit"
32
32
  },
33
33
  "dependencies": {
34
- "@ts-cloud/aws-types": "0.7.21"
34
+ "@ts-cloud/aws-types": "0.7.23"
35
35
  },
36
36
  "devDependencies": {
37
37
  "typescript": "^7.0.2"