@ts-cloud/core 0.16.16 → 0.16.17
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/types.d.ts +101 -0
- package/package.json +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -3145,6 +3145,107 @@ export interface ComputeConfig {
|
|
|
3145
3145
|
* simple as adding an entry here and redeploying.
|
|
3146
3146
|
*/
|
|
3147
3147
|
sshKeys?: SshKeyConfig[];
|
|
3148
|
+
/**
|
|
3149
|
+
* Bounded disk retention on box hosts (Hetzner and ssh providers, and AWS
|
|
3150
|
+
* EC2 boxes deployed over SSM).
|
|
3151
|
+
*
|
|
3152
|
+
* ts-cloud prunes what it leaves behind on a box: abandoned upload staging,
|
|
3153
|
+
* the release artifact cache, the Bun download cache, journald, unused
|
|
3154
|
+
* container images and the apt cache. Current and rollback releases are never
|
|
3155
|
+
* touched; `keepReleases` governs those. The cleanup runs after every deploy,
|
|
3156
|
+
* after a failed one, and on a systemd timer, so a box that stops deploying
|
|
3157
|
+
* still cleans. It reads root-filesystem usage first: below
|
|
3158
|
+
* `pressure.lowWaterPercent` it skips the expensive rules, and at or above
|
|
3159
|
+
* `pressure.highWaterPercent` it prunes on shorter windows and warns.
|
|
3160
|
+
*
|
|
3161
|
+
* Omit for the defaults. `false` turns the whole mechanism off, including a
|
|
3162
|
+
* timer an earlier deploy installed.
|
|
3163
|
+
*/
|
|
3164
|
+
hostCleanup?: boolean | ComputeHostCleanupConfig;
|
|
3165
|
+
}
|
|
3166
|
+
/**
|
|
3167
|
+
* Retention windows for {@link ComputeConfig.hostCleanup}. Each field is an age
|
|
3168
|
+
* past which the matching files are deleted; omit one to keep its default.
|
|
3169
|
+
*/
|
|
3170
|
+
export interface HostCleanupRetention {
|
|
3171
|
+
/**
|
|
3172
|
+
* Abandoned upload staging (`/var/ts-cloud/staging`, `/tmp/*-release.tar.gz`).
|
|
3173
|
+
* Doubles as the in-flight bound for a concurrent deploy, so it cannot go
|
|
3174
|
+
* below 15. @default 60
|
|
3175
|
+
*/
|
|
3176
|
+
stagingMaxAgeMinutes?: number;
|
|
3177
|
+
/** Completed `*.tar.gz` in the release artifact cache, `-mtime` days. @default 2 */
|
|
3178
|
+
artifactMaxAgeDays?: number;
|
|
3179
|
+
/**
|
|
3180
|
+
* `.tmp` uploads to the artifact cache stranded by a dropped transfer. An
|
|
3181
|
+
* upload in flight is younger than this, so it cannot go below 15. @default 60
|
|
3182
|
+
*/
|
|
3183
|
+
artifactUploadMaxAgeMinutes?: number;
|
|
3184
|
+
/** Bun's install (download) cache, `-mtime` days. @default 7 */
|
|
3185
|
+
bunCacheMaxAgeDays?: number;
|
|
3186
|
+
/** journald retention by age. @default 14 */
|
|
3187
|
+
journalMaxAgeDays?: number;
|
|
3188
|
+
/** journald retention by size. @default 512 */
|
|
3189
|
+
journalMaxSizeMb?: number;
|
|
3190
|
+
/** Unused docker/podman images, by age. @default 168 */
|
|
3191
|
+
containerImageMaxAgeHours?: number;
|
|
3192
|
+
}
|
|
3193
|
+
/** How host cleanup reacts to a filling disk. See {@link ComputeHostCleanupConfig.pressure}. */
|
|
3194
|
+
export interface HostCleanupPressureConfig {
|
|
3195
|
+
/**
|
|
3196
|
+
* Below this root-filesystem usage the cleanup runs only the cheap rules
|
|
3197
|
+
* (staging, artifacts, journald, registered paths) and skips the Bun cache
|
|
3198
|
+
* walk, image prunes and `apt-get clean`. `0` always runs everything.
|
|
3199
|
+
* @default 50
|
|
3200
|
+
*/
|
|
3201
|
+
lowWaterPercent?: number;
|
|
3202
|
+
/**
|
|
3203
|
+
* At or above this usage the cleanup prunes with {@link escalated} windows,
|
|
3204
|
+
* prints a warning, and notifies the on-box notifier if it is still above
|
|
3205
|
+
* after cleaning. @default 85
|
|
3206
|
+
*/
|
|
3207
|
+
highWaterPercent?: number;
|
|
3208
|
+
/**
|
|
3209
|
+
* Windows used at or above the high-water mark. Never looser than the normal
|
|
3210
|
+
* ones: each field is the smaller of the two.
|
|
3211
|
+
* @default { artifactMaxAgeDays: 0, bunCacheMaxAgeDays: 1, journalMaxAgeDays: 3, journalMaxSizeMb: 256, containerImageMaxAgeHours: 24 }
|
|
3212
|
+
*/
|
|
3213
|
+
escalated?: HostCleanupRetention;
|
|
3214
|
+
}
|
|
3215
|
+
/**
|
|
3216
|
+
* A directory another component writes timestamped files into, pruned by the
|
|
3217
|
+
* same cleanup on the same schedule. Only direct children of `path` whose name
|
|
3218
|
+
* matches `pattern` are candidates, and only on the same filesystem.
|
|
3219
|
+
*/
|
|
3220
|
+
export interface HostCleanupPathRule {
|
|
3221
|
+
/** Absolute directory, e.g. `/root/rpx-backups`. Not `/`, and not under `/var/www`. */
|
|
3222
|
+
path: string;
|
|
3223
|
+
/** `find -name` glob for the entries to prune, e.g. `cert-backup-*`. */
|
|
3224
|
+
pattern: string;
|
|
3225
|
+
/** Delete entries older than this many days (`-mtime`). */
|
|
3226
|
+
maxAgeDays: number;
|
|
3227
|
+
/** Prune matching files, or matching directories with their contents. @default 'file' */
|
|
3228
|
+
type?: 'file' | 'directory';
|
|
3229
|
+
}
|
|
3230
|
+
/** Host cleanup settings. See {@link ComputeConfig.hostCleanup}. */
|
|
3231
|
+
export interface ComputeHostCleanupConfig {
|
|
3232
|
+
/**
|
|
3233
|
+
* Install the `ts-cloud-host-cleanup.timer` systemd timer, so cleanup runs on
|
|
3234
|
+
* a schedule rather than only when something deploys. `false` removes a timer
|
|
3235
|
+
* an earlier deploy installed and keeps the deploy-time run. @default true
|
|
3236
|
+
*/
|
|
3237
|
+
timer?: boolean;
|
|
3238
|
+
/** systemd `OnCalendar=` expression for the timer. @default 'daily' */
|
|
3239
|
+
schedule?: string;
|
|
3240
|
+
/** Retention windows; omit a field to keep its default. */
|
|
3241
|
+
retention?: HostCleanupRetention;
|
|
3242
|
+
/**
|
|
3243
|
+
* Disk-pressure thresholds. `false` runs every rule with the normal windows
|
|
3244
|
+
* regardless of usage, as ts-cloud did before the thresholds existed.
|
|
3245
|
+
*/
|
|
3246
|
+
pressure?: boolean | HostCleanupPressureConfig;
|
|
3247
|
+
/** Extra directories to prune, e.g. a proxy's own backups. */
|
|
3248
|
+
paths?: HostCleanupPathRule[];
|
|
3148
3249
|
}
|
|
3149
3250
|
/** An operator SSH key authorized on the box. See {@link ComputeConfig.sshKeys}. */
|
|
3150
3251
|
export interface SshKeyConfig {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-cloud/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.16.
|
|
4
|
+
"version": "0.16.17",
|
|
5
5
|
"description": "Core CloudFormation generation library for ts-cloud",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typecheck": "tsc --noEmit"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@ts-cloud/aws-types": "0.16.
|
|
34
|
+
"@ts-cloud/aws-types": "0.16.17"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"typescript": "^7.0.2"
|