@ts-cloud/core 0.16.57 → 0.16.59

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 (2) hide show
  1. package/dist/types.d.ts +88 -0
  2. package/package.json +2 -2
package/dist/types.d.ts CHANGED
@@ -521,6 +521,31 @@ export interface InfrastructureConfig {
521
521
  * }
522
522
  */
523
523
  compute?: ComputeConfig;
524
+ /**
525
+ * Dedicated machines that are not app servers - a CI runner, a build box.
526
+ *
527
+ * Each is a named server ts-cloud finds or creates (an existing server with
528
+ * the same name is adopted, never recreated), with the packages it needs
529
+ * installed through pantry and its long-running processes as systemd user
530
+ * units of an unprivileged account. Re-applying a declaration converges the
531
+ * box: missing packages are installed, changed units are rewritten, and a
532
+ * running service is left running unless it asked to be restarted.
533
+ *
534
+ * @example
535
+ * boxes: {
536
+ * runner: {
537
+ * name: 'ci-runner-1',
538
+ * size: 'cx23',
539
+ * location: 'fsn1',
540
+ * packages: ['google.com/chrome@155.0.8059.84'],
541
+ * user: { name: 'runner' },
542
+ * services: {
543
+ * 'ci-runner': { exec: '%h/ci-runner', environmentFile: '%h/.config/ci-runner.env' },
544
+ * },
545
+ * },
546
+ * }
547
+ */
548
+ boxes?: Record<string, BoxConfig>;
524
549
  /**
525
550
  * Container configuration (ECS Fargate)
526
551
  * Defines containerized services for serverless deployment mode
@@ -3025,6 +3050,69 @@ export interface ContainerItemConfig {
3025
3050
  targetMemoryUtilization?: number;
3026
3051
  };
3027
3052
  }
3053
+ /** A long-running process on a {@link BoxConfig}, run as a systemd unit. */
3054
+ export interface BoxServiceConfig {
3055
+ description?: string;
3056
+ /** `ExecStart`. `%h` is the service user's home. */
3057
+ exec: string;
3058
+ /** @default '%h' */
3059
+ workingDirectory?: string;
3060
+ /** Non-secret variables, written to an env file only the service user can read. */
3061
+ environment?: Record<string, string>;
3062
+ /**
3063
+ * An env file on the box that ts-cloud references but never writes - for
3064
+ * credentials minted on the machine (a runner's registration token).
3065
+ */
3066
+ environmentFile?: string;
3067
+ /** Directories prepended to the service's PATH, ahead of the pantry packages. */
3068
+ path?: string[];
3069
+ /** @default 'always' */
3070
+ restart?: 'always' | 'on-failure' | 'no';
3071
+ /** @default 10 */
3072
+ restartSec?: number;
3073
+ /**
3074
+ * Restart a running service when its unit or environment changed.
3075
+ * Off by default: a converge must never kill the job a runner is in the
3076
+ * middle of. Restart it yourself, gracefully, when it is idle.
3077
+ * @default false
3078
+ */
3079
+ restartOnChange?: boolean;
3080
+ }
3081
+ /** A dedicated machine declared under `infrastructure.boxes`. */
3082
+ export interface BoxConfig {
3083
+ /** Server name; an existing server with this name is adopted. */
3084
+ name: string;
3085
+ /** Provider server type (Hetzner `cx23`, ...). */
3086
+ size: string;
3087
+ location?: string;
3088
+ /** @default 'ubuntu-24.04' */
3089
+ image?: string;
3090
+ /** Ingress besides SSH. */
3091
+ ports?: Array<{
3092
+ protocol: 'tcp' | 'udp' | 'icmp';
3093
+ port?: number;
3094
+ }>;
3095
+ /** Pin the pantry CLI. @default latest release */
3096
+ pantryVersion?: string;
3097
+ /** Pantry package specs (`domain` or `domain@version`), installed into /opt/pantry. */
3098
+ packages?: string[];
3099
+ /**
3100
+ * Free space the root filesystem must have before packages are installed.
3101
+ * Below it the converge installs nothing and says so: a package tree that
3102
+ * fills the disk takes down whatever else the box is doing (on a CI runner,
3103
+ * every job). Pantry's Chrome alone unpacks to about 5 GB on Linux.
3104
+ * @default 10
3105
+ */
3106
+ minFreeDiskGb?: number;
3107
+ /** The unprivileged account services run as. Without it, services are system units run as root. */
3108
+ user?: {
3109
+ name: string;
3110
+ /** Supplementary groups (e.g. `docker`), added if they exist. */
3111
+ groups?: string[];
3112
+ };
3113
+ services?: Record<string, BoxServiceConfig>;
3114
+ labels?: Record<string, string>;
3115
+ }
3028
3116
  export interface ComputeConfig {
3029
3117
  /** Explicitly reconcile an existing Hetzner server's size. Never resize by default. */
3030
3118
  resize?: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ts-cloud/core",
3
3
  "type": "module",
4
- "version": "0.16.57",
4
+ "version": "0.16.59",
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.57"
34
+ "@ts-cloud/aws-types": "0.16.59"
35
35
  },
36
36
  "devDependencies": {
37
37
  "typescript": "^7.0.2"