@stacksjs/ts-cloud 0.7.36 → 0.7.37

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.
@@ -3949,7 +3949,21 @@ function buildAwsArtifactFetch(bucket, key, region, destPath) {
3949
3949
  }
3950
3950
  function buildLocalArtifactFetch(localPath, destPath) {
3951
3951
  return [
3952
- `cp "${localPath}" ${destPath}`
3952
+ `mv "${localPath}" ${destPath}`
3953
+ ];
3954
+ }
3955
+ function buildHostCleanupScript() {
3956
+ return [
3957
+ 'echo "[ts-cloud] host cleanup (disk before): $(df -h / | tail -1)"',
3958
+ "find /var/ts-cloud/staging -xdev -maxdepth 1 -type f -mmin +60 -delete 2>/dev/null || true",
3959
+ 'find /tmp -xdev -maxdepth 1 -type f -name "*-release.tar.gz" -mmin +60 -delete 2>/dev/null || true',
3960
+ "find /root/.bun/install/cache -xdev -type f -mtime +7 -delete 2>/dev/null || true",
3961
+ "find /root/.bun/install/cache -xdev -depth -type d -empty -delete 2>/dev/null || true",
3962
+ "journalctl --vacuum-time=14d --vacuum-size=512M >/dev/null 2>&1 || true",
3963
+ 'if command -v docker >/dev/null 2>&1; then docker image prune --all --force --filter "until=168h" >/dev/null 2>&1 || true; fi',
3964
+ 'if command -v podman >/dev/null 2>&1; then podman image prune --all --force --filter "until=168h" >/dev/null 2>&1 || true; fi',
3965
+ "if command -v apt-get >/dev/null 2>&1; then apt-get clean >/dev/null 2>&1 || true; fi",
3966
+ 'echo "[ts-cloud] host cleanup (disk after): $(df -h / | tail -1)"'
3953
3967
  ];
3954
3968
  }
3955
3969
  // src/drivers/shared/compute-deploy.ts
@@ -4843,7 +4857,8 @@ async function deploySiteRelease(driver, options, logger = noopLogger2) {
4843
4857
  ...baseScript,
4844
4858
  ...staticVhost,
4845
4859
  ...staticSsl,
4846
- ...servicesScript
4860
+ ...servicesScript,
4861
+ ...buildHostCleanupScript()
4847
4862
  ];
4848
4863
  logger.step(`Deploying to ${targets.length} target(s)...`);
4849
4864
  const result = await driver.runRemoteDeploy({
@@ -5155,4 +5170,4 @@ function buildCloudFrontOriginConfig(options) {
5155
5170
  CustomErrorResponses: { Quantity: 0 }
5156
5171
  };
5157
5172
  }
5158
- export { siteInstallBase, isPhpSite, resolveSiteDeployTarget, resolveSiteKind, validateDeploymentConfig, PANTRY_PROJECT_DIR, pgAdminCommand, DEFAULT_RPX_CERTS_DIR, normalizeRoutePath, deriveRouteId, buildRpxConfig, buildRpxLbConfig, renderRpxLauncher, RPX_DIR, RPX_LAUNCHER_PATH, RPX_SERVICE_NAME, buildRpxProvisionScript, buildRpxFragmentRefreshScript, BACKUP_RUNNER_PATH, buildBackupRestoreScript, buildUbuntuBootstrapScript, AwsDriver, resolveHetznerLocation, HetznerClient, resolveHetznerApiToken2 as resolveHetznerApiToken, normalizeSshPublicKey, wrapCloudInitUserData, HetznerDriver, LocalBoxDriver, isBoxMode, createCloudDriver, CloudDriverFactory, cloudDrivers, ensureSshKey, ensureFirewall, ensureServer, serverPublicIpv4, buildSshArgs, sshExec, sshExecOrThrow, scpUpload, waitForSsh, waitForCloudInit, UBUNTU_2404_AMI_PARAM, buildBoxUserData, HetznerBoxProvisioner, AwsBoxProvisioner, createBoxProvisioner, releasePaths, buildRollbackScript, resolveExecStart, buildSiteDeployScript, buildStaticSiteDeployScript, releaseTarballTmpPath, buildAwsArtifactFetch, buildLocalArtifactFetch, MANAGEMENT_DASHBOARD_SITE, DASHBOARD_CREDENTIALS_FILE, resolveDashboardAuth, resolveUiSource, ensureManagementDashboard, buildManagementDashboardArtifact, resolveSiteFramework, deploySiteRelease, deployAllComputeSites, reloadRpxGateway, MANAGED_CACHE_POLICY_OPTIMIZED, MANAGED_CACHE_POLICY_DISABLED, MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER, buildCloudFrontOriginConfig };
5173
+ export { siteInstallBase, isPhpSite, resolveSiteDeployTarget, resolveSiteKind, validateDeploymentConfig, PANTRY_PROJECT_DIR, pgAdminCommand, DEFAULT_RPX_CERTS_DIR, normalizeRoutePath, deriveRouteId, buildRpxConfig, buildRpxLbConfig, renderRpxLauncher, RPX_DIR, RPX_LAUNCHER_PATH, RPX_SERVICE_NAME, buildRpxProvisionScript, buildRpxFragmentRefreshScript, BACKUP_RUNNER_PATH, buildBackupRestoreScript, buildUbuntuBootstrapScript, AwsDriver, resolveHetznerLocation, HetznerClient, resolveHetznerApiToken2 as resolveHetznerApiToken, normalizeSshPublicKey, wrapCloudInitUserData, HetznerDriver, LocalBoxDriver, isBoxMode, createCloudDriver, CloudDriverFactory, cloudDrivers, ensureSshKey, ensureFirewall, ensureServer, serverPublicIpv4, buildSshArgs, sshExec, sshExecOrThrow, scpUpload, waitForSsh, waitForCloudInit, UBUNTU_2404_AMI_PARAM, buildBoxUserData, HetznerBoxProvisioner, AwsBoxProvisioner, createBoxProvisioner, releasePaths, buildRollbackScript, resolveExecStart, buildSiteDeployScript, buildStaticSiteDeployScript, releaseTarballTmpPath, buildAwsArtifactFetch, buildLocalArtifactFetch, buildHostCleanupScript, MANAGEMENT_DASHBOARD_SITE, DASHBOARD_CREDENTIALS_FILE, resolveDashboardAuth, resolveUiSource, ensureManagementDashboard, buildManagementDashboardArtifact, resolveSiteFramework, deploySiteRelease, deployAllComputeSites, reloadRpxGateway, MANAGED_CACHE_POLICY_OPTIMIZED, MANAGED_CACHE_POLICY_DISABLED, MANAGED_ORIGIN_REQUEST_POLICY_ALL_VIEWER, buildCloudFrontOriginConfig };
@@ -29,7 +29,7 @@ import {
29
29
  resolveSiteKind,
30
30
  resolveUiSource,
31
31
  siteInstallBase
32
- } from "./chunk-s7gem783.js";
32
+ } from "./chunk-3c46eypc.js";
33
33
  import {
34
34
  artifactKey,
35
35
  composeServerlessAppTemplate,
@@ -12,7 +12,7 @@ import {
12
12
  sanitizeCloudConfig,
13
13
  setMaintenance,
14
14
  startLocalDashboardServer
15
- } from "../chunk-6r7wz48w.js";
15
+ } from "../chunk-ndwv4y6c.js";
16
16
  import {
17
17
  buildAndPushServerlessImage
18
18
  } from "../chunk-tskj9fay.js";
@@ -30,7 +30,7 @@ import {
30
30
  resolveUiSource,
31
31
  siteInstallBase,
32
32
  validateDeploymentConfig
33
- } from "../chunk-s7gem783.js";
33
+ } from "../chunk-3c46eypc.js";
34
34
  import"../chunk-stt1z5cx.js";
35
35
  import"../chunk-93hjhs78.js";
36
36
  import {
@@ -10,7 +10,7 @@ export { buildSshArgs, scpUpload, sshExec, sshExecOrThrow, waitForCloudInit, wai
10
10
  export type { RemoteExecOptions, RemoteExecResult, WaitOptions } from './shared/remote-exec';
11
11
  export { AwsBoxProvisioner, buildBoxUserData, createBoxProvisioner, HetznerBoxProvisioner, UBUNTU_2404_AMI_PARAM, } from './shared/box-provision';
12
12
  export type { AwsBoxProvisionerOptions, BoxPort, BoxProviderName, BoxProvisioner, BoxSpec, CreateBoxProvisionerOptions, ProvisionedBox, } from './shared/box-provision';
13
- export { buildAwsArtifactFetch, buildLocalArtifactFetch, buildSiteDeployScript, buildStaticSiteDeployScript, releaseTarballTmpPath, resolveExecStart, } from './shared/deploy-script';
13
+ export { buildAwsArtifactFetch, buildHostCleanupScript, buildLocalArtifactFetch, buildSiteDeployScript, buildStaticSiteDeployScript, releaseTarballTmpPath, resolveExecStart, } from './shared/deploy-script';
14
14
  export { deployAllComputeSites, deploySiteRelease, reloadRpxGateway } from './shared/compute-deploy';
15
15
  export { buildRpxConfig, buildRpxFragmentRefreshScript, buildRpxLbConfig, buildRpxProvisionScript, deriveRouteId, normalizeRoutePath, renderRpxLauncher, DEFAULT_RPX_CERTS_DIR, RPX_DIR, RPX_LAUNCHER_PATH, RPX_SERVICE_NAME, } from './shared/rpx-gateway';
16
16
  export type { BuildRpxConfigOptions, BuildRpxFragmentRefreshOptions, BuildRpxProvisionOptions, RpxGatewayConfig, RpxLbAppBox, RpxRoute, } from './shared/rpx-gateway';
@@ -17,6 +17,7 @@ import {
17
17
  buildAwsArtifactFetch,
18
18
  buildBoxUserData,
19
19
  buildCloudFrontOriginConfig,
20
+ buildHostCleanupScript,
20
21
  buildLocalArtifactFetch,
21
22
  buildRpxConfig,
22
23
  buildRpxFragmentRefreshScript,
@@ -50,7 +51,7 @@ import {
50
51
  waitForCloudInit,
51
52
  waitForSsh,
52
53
  wrapCloudInitUserData
53
- } from "../chunk-s7gem783.js";
54
+ } from "../chunk-3c46eypc.js";
54
55
  import"../chunk-stt1z5cx.js";
55
56
  import"../chunk-93hjhs78.js";
56
57
  import"../chunk-qpj3edwz.js";
@@ -91,6 +92,7 @@ export {
91
92
  buildRpxFragmentRefreshScript,
92
93
  buildRpxConfig,
93
94
  buildLocalArtifactFetch,
95
+ buildHostCleanupScript,
94
96
  buildCloudFrontOriginConfig,
95
97
  buildBoxUserData,
96
98
  buildAwsArtifactFetch,
@@ -113,3 +113,10 @@ export declare function buildStaticSiteDeployScript(options: BuildStaticSiteDepl
113
113
  export declare function releaseTarballTmpPath(slug: string | undefined, siteName: string, releaseId: string): string;
114
114
  export declare function buildAwsArtifactFetch(bucket: string, key: string, region: string, destPath: string): string[];
115
115
  export declare function buildLocalArtifactFetch(localPath: string, destPath: string): string[];
116
+ /**
117
+ * Bounded, multi-tenant-safe host maintenance run after a successful deploy.
118
+ * Current and rollback releases are deliberately out of scope: their retention
119
+ * is managed by buildPruneReleases. This only removes abandoned staging/temp
120
+ * archives, aged package caches, unused container images, and old journals.
121
+ */
122
+ export declare function buildHostCleanupScript(): string[];
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export type { MigrateEndpoint, MigrateError, MigrateOptions, MigratePlanItem, Mi
11
11
  export * from './ssl';
12
12
  export { deployStaticSite, deployStaticSiteFull, uploadStaticFiles, invalidateCache, deleteStaticSite, generateStaticSiteTemplate, deployStaticSiteWithExternalDns, deployStaticSiteWithExternalDnsFull, generateExternalDnsStaticSiteTemplate, deploySite, resolveSiteDeployTarget, resolveSiteKind, validateDeploymentConfig, buildAndPushServerlessImage, buildFunctionEnv, deployServerlessApp, infraEnvFromOutputs, redeployServerlessApp, rollbackServerlessApp, runRemoteCommand, setMaintenance, buildManagementDashboardArtifact, DASHBOARD_CREDENTIALS_FILE, ensureManagementDashboard, MANAGEMENT_DASHBOARD_SITE, resolveDashboardAuth, resolveUiSource, } from './deploy';
13
13
  export type { EnsureDashboardLogger, ResolvedDashboardAuth, StaticSiteConfig, DeployResult, UploadOptions, ExternalDnsStaticSiteConfig, ExternalDnsDeployResult, DeploySiteConfig, DeploySiteResult, StaticSiteDnsProvider, SiteDeployKind, DeploymentValidationResult, BuildImageOptions, BuiltImage, CodeSource, DeployServerlessOptions, ResolvedContext, } from './deploy';
14
- export { createCloudDriver, CloudDriverFactory, cloudDrivers, AwsDriver, HetznerDriver, HetznerClient, resolveHetznerApiToken, normalizeSshPublicKey, ensureFirewall, ensureServer, ensureSshKey, serverPublicIpv4, sshExec, sshExecOrThrow, scpUpload, waitForSsh, waitForCloudInit, buildSshArgs, generateUbuntuAppCloudInit, wrapCloudInitUserData, buildSiteDeployScript, buildStaticSiteDeployScript, resolveExecStart, deployAllComputeSites, deploySiteRelease, } from './drivers';
14
+ export { createCloudDriver, CloudDriverFactory, cloudDrivers, AwsDriver, HetznerDriver, HetznerClient, resolveHetznerApiToken, normalizeSshPublicKey, ensureFirewall, ensureServer, ensureSshKey, serverPublicIpv4, sshExec, sshExecOrThrow, scpUpload, waitForSsh, waitForCloudInit, buildSshArgs, generateUbuntuAppCloudInit, wrapCloudInitUserData, buildHostCleanupScript, buildSiteDeployScript, buildStaticSiteDeployScript, resolveExecStart, deployAllComputeSites, deploySiteRelease, } from './drivers';
15
15
  export type { CreateCloudDriverOptions } from './drivers/factory';
16
16
  export { dashboardActions, resolveDashboardAction, sanitizeCloudConfig, startLocalDashboardServer, } from './deploy/local-dashboard-server';
17
17
  export type { DashboardAction, LocalDashboardServer, LocalDashboardServerOptions, } from './deploy/local-dashboard-server';
package/dist/index.js CHANGED
@@ -55,7 +55,7 @@ import {
55
55
  sanitizeCloudConfig,
56
56
  setMaintenance,
57
57
  startLocalDashboardServer
58
- } from "./chunk-6r7wz48w.js";
58
+ } from "./chunk-ndwv4y6c.js";
59
59
  import {
60
60
  buildAndPushServerlessImage
61
61
  } from "./chunk-tskj9fay.js";
@@ -77,6 +77,7 @@ import {
77
77
  HetznerClient,
78
78
  HetznerDriver,
79
79
  MANAGEMENT_DASHBOARD_SITE,
80
+ buildHostCleanupScript,
80
81
  buildManagementDashboardArtifact,
81
82
  buildSiteDeployScript,
82
83
  buildSshArgs,
@@ -105,7 +106,7 @@ import {
105
106
  waitForCloudInit,
106
107
  waitForSsh,
107
108
  wrapCloudInitUserData
108
- } from "./chunk-s7gem783.js";
109
+ } from "./chunk-3c46eypc.js";
109
110
  import {
110
111
  ABTestManager,
111
112
  AI,
@@ -4964,6 +4965,7 @@ export {
4964
4965
  buildOptimizationManager,
4965
4966
  buildNodeRuntimeLayerZip,
4966
4967
  buildManagementDashboardArtifact,
4968
+ buildHostCleanupScript,
4967
4969
  buildFunctionEnv,
4968
4970
  buildCloudFormationTemplate,
4969
4971
  buildBunRuntimeLayerZip,