@stacksjs/ts-cloud 0.8.0 → 0.8.2

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 (59) hide show
  1. package/dist/bin/cli.js +305 -305
  2. package/dist/bin/dashboard-server.js +155 -155
  3. package/dist/{chunk-grp3evq3.js → chunk-wxhrr03r.js} +1 -1
  4. package/dist/{chunk-bfzhz2ed.js → chunk-x6137d59.js} +23 -2
  5. package/dist/deploy/index.js +2 -2
  6. package/dist/drivers/index.d.ts +1 -1
  7. package/dist/drivers/index.js +5 -1
  8. package/dist/drivers/shared/rpx-gateway.d.ts +26 -0
  9. package/dist/index.js +2 -2
  10. package/dist/ui/access-denied.html +2 -2
  11. package/dist/ui/account/automation.html +3 -3
  12. package/dist/ui/account/security.html +2 -2
  13. package/dist/ui/applications/compose.html +3 -3
  14. package/dist/ui/data/backups.html +3 -3
  15. package/dist/ui/data/services.html +3 -3
  16. package/dist/ui/data/volumes.html +4 -4
  17. package/dist/ui/index.html +4 -4
  18. package/dist/ui/infrastructure/topology.html +4 -4
  19. package/dist/ui/integrations.html +2 -2
  20. package/dist/ui/operations/alerts.html +3 -3
  21. package/dist/ui/operations/configuration.html +4 -4
  22. package/dist/ui/operations/jobs.html +3 -3
  23. package/dist/ui/operations/maintenance.html +4 -4
  24. package/dist/ui/operations/observability.html +4 -4
  25. package/dist/ui/operations/previews.html +3 -3
  26. package/dist/ui/operations/queue.html +3 -3
  27. package/dist/ui/operations/regions.html +4 -4
  28. package/dist/ui/operations/releases.html +4 -4
  29. package/dist/ui/operations/spend.html +4 -4
  30. package/dist/ui/operations/workloads.html +4 -4
  31. package/dist/ui/server/actions.html +3 -3
  32. package/dist/ui/server/activity.html +2 -2
  33. package/dist/ui/server/capacity.html +3 -3
  34. package/dist/ui/server/database.html +4 -4
  35. package/dist/ui/server/deployments.html +4 -4
  36. package/dist/ui/server/diagnostics.html +2 -2
  37. package/dist/ui/server/firewall.html +4 -4
  38. package/dist/ui/server/fleet.html +4 -4
  39. package/dist/ui/server/logs.html +4 -4
  40. package/dist/ui/server/metrics.html +4 -4
  41. package/dist/ui/server/security.html +2 -2
  42. package/dist/ui/server/services.html +2 -2
  43. package/dist/ui/server/sites.html +4 -4
  44. package/dist/ui/server/ssh-keys.html +4 -4
  45. package/dist/ui/server/team.html +4 -4
  46. package/dist/ui/server/terminal.html +2 -2
  47. package/dist/ui/serverless/alarms.html +4 -4
  48. package/dist/ui/serverless/assets.html +2 -2
  49. package/dist/ui/serverless/data.html +4 -4
  50. package/dist/ui/serverless/deployments.html +2 -2
  51. package/dist/ui/serverless/firewall.html +2 -2
  52. package/dist/ui/serverless/functions.html +4 -4
  53. package/dist/ui/serverless/logs.html +4 -4
  54. package/dist/ui/serverless/metrics.html +2 -2
  55. package/dist/ui/serverless/queues.html +4 -4
  56. package/dist/ui/serverless/secrets.html +4 -4
  57. package/dist/ui/serverless/traces.html +4 -4
  58. package/dist/ui/serverless.html +3 -3
  59. package/package.json +3 -3
@@ -50,7 +50,7 @@ import {
50
50
  resolveSiteKind,
51
51
  resolveUiSource,
52
52
  siteInstallBase
53
- } from "./chunk-bfzhz2ed.js";
53
+ } from "./chunk-x6137d59.js";
54
54
  import {
55
55
  SSMClient
56
56
  } from "./chunk-7m60qnc8.js";
@@ -1498,6 +1498,27 @@ function deployShipsFiles(config, onlySite) {
1498
1498
 
1499
1499
  // src/drivers/shared/rpx-gateway.ts
1500
1500
  var DEFAULT_RPX_CERTS_DIR = "/etc/rpx/certs";
1501
+ function hasAutoWwwVariant(domain) {
1502
+ return domain.split(".").length === 2;
1503
+ }
1504
+ function gatewayHostnames(sites, options = {}) {
1505
+ const hosts = new Set;
1506
+ for (const site of Object.values(sites)) {
1507
+ if (!site?.domain)
1508
+ continue;
1509
+ if (resolveSiteKind(site) === "bucket")
1510
+ continue;
1511
+ hosts.add(site.domain);
1512
+ }
1513
+ if (options.autoWww !== false) {
1514
+ for (const domain of [...hosts]) {
1515
+ if (!hasAutoWwwVariant(domain))
1516
+ continue;
1517
+ hosts.add(`www.${domain}`);
1518
+ }
1519
+ }
1520
+ return [...hosts];
1521
+ }
1501
1522
  var DEFAULT_ACME_WEBROOT = "/var/www/acme-challenge";
1502
1523
  function normalizeSiteRedirect(input) {
1503
1524
  if (typeof input === "string")
@@ -1610,7 +1631,7 @@ function buildRpxConfigInternal(sites, options, appBoxes) {
1610
1631
  }
1611
1632
  if (options.proxy.autoWww !== false) {
1612
1633
  for (const domain of [...domains]) {
1613
- if (domain.split(".").length !== 2)
1634
+ if (!hasAutoWwwVariant(domain))
1614
1635
  continue;
1615
1636
  const wwwDomain = `www.${domain}`;
1616
1637
  if (domains.has(wwwDomain))
@@ -7227,4 +7248,4 @@ function buildCloudFrontOriginConfig(options) {
7227
7248
  CustomErrorResponses: { Quantity: 0 }
7228
7249
  };
7229
7250
  }
7230
- export { collectServerDnsDomains, removeStaleServerAddressRecords, normalizePublicIpv6, IPV6_EXCLUDED_HOST_LABELS, hostAcceptsIpv6, reconcileAddressRecords, verifyAddressRecord, PANTRY_PROJECT_DIR, buildPantryBootstrapScript, buildVitessProvisionScript, pgAdminCommand, BACKUP_RUNNER_PATH, buildBackupRestoreScript, siteInstallBase, isPhpSite, resolveProxyUpstreams, hasProxyUpstream, resolveSiteDeployTarget, resolveSiteKind, hasComputeConfigured, validateDeploymentConfig, shipsARelease, shipsToBucket, deployShipsFiles, DEFAULT_RPX_CERTS_DIR, normalizeRoutePath, deriveRouteId, buildRpxConfig, buildRpxLbConfig, renderRpxLauncher, RPX_DIR, RPX_LAUNCHER_PATH, RPX_SERVICE_NAME, buildRpxProvisionScript, buildRpxFragmentRefreshScript, buildUbuntuBootstrapScript, AwsDriver, resolveHetznerLocation, HetznerClient, resolveHetznerApiToken2 as resolveHetznerApiToken, normalizeSshPublicKey, wrapCloudInitUserData, HetznerDriver, LocalBoxDriver, isBoxMode, createCloudDriver, CloudDriverFactory, cloudDrivers, planHetznerServerResize, isHetznerCapacityError, executeHetznerServerResize, buildSshArgs, sshExec, sshExecOrThrow, scpUpload, waitForSsh, waitForCloudInit, collectHetznerResizeManifest, prepareHetznerResize, verifyHetznerResize, resolveHetznerHostOptimizationPlan, buildHetznerHostOptimizationScript, applyHetznerHostOptimization, collectHetznerHostOptimizationReport, verifyHetznerHostOptimization, resizeCheckpointPath, resizeLockPath, readResizeCheckpoint, writeResizeCheckpoint, acquireResizeLock, ensureSshKey, ensureFirewall, ensureServer, serverPublicIpv4, UBUNTU_2404_AMI_PARAM, buildBoxUserData, HetznerBoxProvisioner, AwsBoxProvisioner, createBoxProvisioner, releasePaths, buildRollbackScript, resolveExecStart, buildSiteDeployScript, buildStaticSiteDeployScript, releaseTarballTmpPath, buildAwsArtifactFetch, buildLocalArtifactFetch, buildHostCleanupScript, MANAGEMENT_DASHBOARD_SITE, dashboardCredentialsFile, resolveDashboardAuth, resolveUiSource, ensureManagementDashboard, buildManagementDashboardArtifact, resolveSiteFramework, deploySiteRelease, deployAllComputeSites, reloadRpxGateway, renewRpxCertificates, MANAGED_CACHE_POLICY_OPTIMIZED, MANAGED_CACHE_POLICY_DISABLED, MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER, buildCloudFrontOriginConfig };
7251
+ export { collectServerDnsDomains, removeStaleServerAddressRecords, normalizePublicIpv6, IPV6_EXCLUDED_HOST_LABELS, hostAcceptsIpv6, reconcileAddressRecords, verifyAddressRecord, PANTRY_PROJECT_DIR, buildPantryBootstrapScript, buildVitessProvisionScript, pgAdminCommand, BACKUP_RUNNER_PATH, buildBackupRestoreScript, siteInstallBase, isPhpSite, resolveProxyUpstreams, hasProxyUpstream, resolveSiteDeployTarget, resolveSiteKind, hasComputeConfigured, validateDeploymentConfig, shipsARelease, shipsToBucket, deployShipsFiles, DEFAULT_RPX_CERTS_DIR, hasAutoWwwVariant, gatewayHostnames, normalizeRoutePath, deriveRouteId, buildRpxConfig, buildRpxLbConfig, renderRpxLauncher, RPX_DIR, RPX_LAUNCHER_PATH, RPX_SERVICE_NAME, buildRpxProvisionScript, buildRpxFragmentRefreshScript, buildUbuntuBootstrapScript, AwsDriver, resolveHetznerLocation, HetznerClient, resolveHetznerApiToken2 as resolveHetznerApiToken, normalizeSshPublicKey, wrapCloudInitUserData, HetznerDriver, LocalBoxDriver, isBoxMode, createCloudDriver, CloudDriverFactory, cloudDrivers, planHetznerServerResize, isHetznerCapacityError, executeHetznerServerResize, buildSshArgs, sshExec, sshExecOrThrow, scpUpload, waitForSsh, waitForCloudInit, collectHetznerResizeManifest, prepareHetznerResize, verifyHetznerResize, resolveHetznerHostOptimizationPlan, buildHetznerHostOptimizationScript, applyHetznerHostOptimization, collectHetznerHostOptimizationReport, verifyHetznerHostOptimization, resizeCheckpointPath, resizeLockPath, readResizeCheckpoint, writeResizeCheckpoint, acquireResizeLock, ensureSshKey, ensureFirewall, ensureServer, serverPublicIpv4, UBUNTU_2404_AMI_PARAM, buildBoxUserData, HetznerBoxProvisioner, AwsBoxProvisioner, createBoxProvisioner, releasePaths, buildRollbackScript, resolveExecStart, buildSiteDeployScript, buildStaticSiteDeployScript, releaseTarballTmpPath, buildAwsArtifactFetch, buildLocalArtifactFetch, buildHostCleanupScript, MANAGEMENT_DASHBOARD_SITE, dashboardCredentialsFile, resolveDashboardAuth, resolveUiSource, ensureManagementDashboard, buildManagementDashboardArtifact, resolveSiteFramework, deploySiteRelease, deployAllComputeSites, reloadRpxGateway, renewRpxCertificates, MANAGED_CACHE_POLICY_OPTIMIZED, MANAGED_CACHE_POLICY_DISABLED, MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER, buildCloudFrontOriginConfig };
@@ -36,7 +36,7 @@ import {
36
36
  synchronizeDashboardUsers,
37
37
  trackDashboardOperation,
38
38
  verifyStaticApiOrigin
39
- } from "../chunk-grp3evq3.js";
39
+ } from "../chunk-wxhrr03r.js";
40
40
  import {
41
41
  deleteStaticSite,
42
42
  deployStaticSite,
@@ -83,7 +83,7 @@ import {
83
83
  siteInstallBase,
84
84
  validateDeploymentConfig,
85
85
  verifyAddressRecord
86
- } from "../chunk-bfzhz2ed.js";
86
+ } from "../chunk-x6137d59.js";
87
87
  import"../chunk-7m60qnc8.js";
88
88
  import"../chunk-4cjrg98a.js";
89
89
  import"../chunk-rds0sy87.js";
@@ -20,7 +20,7 @@ export { AwsBoxProvisioner, buildBoxUserData, createBoxProvisioner, HetznerBoxPr
20
20
  export type { AwsBoxProvisionerOptions, BoxPort, BoxProviderName, BoxProvisioner, BoxSpec, CreateBoxProvisionerOptions, ProvisionedBox, } from './shared/box-provision';
21
21
  export { buildAwsArtifactFetch, buildHostCleanupScript, buildLocalArtifactFetch, buildSiteDeployScript, buildStaticSiteDeployScript, releaseTarballTmpPath, resolveExecStart, } from './shared/deploy-script';
22
22
  export { deployAllComputeSites, deploySiteRelease, reloadRpxGateway, renewRpxCertificates, } from './shared/compute-deploy';
23
- export { buildRpxConfig, buildRpxFragmentRefreshScript, buildRpxLbConfig, buildRpxProvisionScript, deriveRouteId, normalizeRoutePath, renderRpxLauncher, DEFAULT_RPX_CERTS_DIR, RPX_DIR, RPX_LAUNCHER_PATH, RPX_SERVICE_NAME, } from './shared/rpx-gateway';
23
+ export { buildRpxConfig, buildRpxFragmentRefreshScript, buildRpxLbConfig, buildRpxProvisionScript, deriveRouteId, gatewayHostnames, hasAutoWwwVariant, normalizeRoutePath, renderRpxLauncher, DEFAULT_RPX_CERTS_DIR, RPX_DIR, RPX_LAUNCHER_PATH, RPX_SERVICE_NAME, } from './shared/rpx-gateway';
24
24
  export type { BuildRpxConfigOptions, BuildRpxFragmentRefreshOptions, BuildRpxProvisionOptions, RpxGatewayConfig, RpxLbAppBox, RpxRoute, } from './shared/rpx-gateway';
25
25
  export { buildCloudFrontOriginConfig, MANAGED_CACHE_POLICY_DISABLED, MANAGED_CACHE_POLICY_OPTIMIZED, MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER, } from './shared/cloudfront-origin';
26
26
  export type { BuildCloudFrontOriginOptions, OriginFrontedBehavior } from './shared/cloudfront-origin';
@@ -42,6 +42,8 @@ import {
42
42
  ensureServer,
43
43
  ensureSshKey,
44
44
  executeHetznerServerResize,
45
+ gatewayHostnames,
46
+ hasAutoWwwVariant,
45
47
  isBoxMode,
46
48
  isHetznerCapacityError,
47
49
  normalizeRoutePath,
@@ -68,7 +70,7 @@ import {
68
70
  waitForSsh,
69
71
  wrapCloudInitUserData,
70
72
  writeResizeCheckpoint
71
- } from "../chunk-bfzhz2ed.js";
73
+ } from "../chunk-x6137d59.js";
72
74
  import"../chunk-7m60qnc8.js";
73
75
  import"../chunk-4cjrg98a.js";
74
76
  import"../chunk-rds0sy87.js";
@@ -104,7 +106,9 @@ export {
104
106
  normalizeRoutePath,
105
107
  isHetznerCapacityError,
106
108
  isBoxMode,
109
+ hasAutoWwwVariant,
107
110
  buildUbuntuBootstrapScript as generateUbuntuAppCloudInit,
111
+ gatewayHostnames,
108
112
  executeHetznerServerResize,
109
113
  ensureSshKey,
110
114
  ensureServer,
@@ -22,6 +22,32 @@
22
22
  import type { ComputeProxyConfig, RpxLoadBalancerConfig, SiteConfig, SiteRedirectConfig } from '@ts-cloud/core';
23
23
  /** Default directory on the box that holds real per-domain TLS certs. */
24
24
  export declare const DEFAULT_RPX_CERTS_DIR = "/etc/rpx/certs";
25
+ /** Whether the gateway adds a `www.` redirect for `domain` on its own. */
26
+ export declare function hasAutoWwwVariant(domain: string): boolean;
27
+ /**
28
+ * Every hostname the gateway will answer for a sites config.
29
+ *
30
+ * This is the set DNS has to publish, and it is deliberately derived from the
31
+ * same rules {@link buildRpxConfig} routes by, because the two drifting apart
32
+ * produces a specific and nasty failure: a name that resolves, has no route or
33
+ * certificate, and so is served the gateway's fallback cert — which on a shared
34
+ * box belongs to whichever *other* tenant sorts first. A visitor gets someone
35
+ * else's certificate and a browser warning, which is strictly worse than the
36
+ * name not existing.
37
+ *
38
+ * Two rules, both mirroring the route builder:
39
+ * - every site's literal `domain`, including an explicitly declared
40
+ * `www.<sub>.<apex>` (that host gets a real route here, so it needs a real
41
+ * record — collapsing it to its apex is what left `www.ps1.stacksjs.com`
42
+ * resolving onto another tenant's cert);
43
+ * - plus `www.<domain>` for two-label apexes, which the gateway synthesizes
44
+ * itself unless `autoWww` is off.
45
+ *
46
+ * `bucket` sites are excluded: they live on object storage + CDN, not this box.
47
+ */
48
+ export declare function gatewayHostnames(sites: Record<string, SiteConfig | undefined>, options?: {
49
+ autoWww?: boolean;
50
+ }): string[];
25
51
  /** Default webroot the gateway serves ACME http-01 challenges from on `:80`. */
26
52
  export declare const DEFAULT_ACME_WEBROOT = "/var/www/acme-challenge";
27
53
  /** A normalized redirect target on an {@link RpxRoute} (see rpx's `redirect`). */
package/dist/index.js CHANGED
@@ -208,7 +208,7 @@ import {
208
208
  verifyUpdateSignature,
209
209
  webhookEndpoint,
210
210
  zeroCapacity
211
- } from "./chunk-grp3evq3.js";
211
+ } from "./chunk-wxhrr03r.js";
212
212
  import {
213
213
  deleteStaticSite,
214
214
  deployStaticSite,
@@ -341,7 +341,7 @@ import {
341
341
  waitForCloudInit,
342
342
  waitForSsh,
343
343
  wrapCloudInitUserData
344
- } from "./chunk-bfzhz2ed.js";
344
+ } from "./chunk-x6137d59.js";
345
345
  import {
346
346
  EC2Client,
347
347
  SSMClient