@ts-cloud/core 0.2.23 → 0.2.25
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 +63 -165
- package/package.json +2 -2
package/dist/types.d.ts
CHANGED
|
@@ -696,12 +696,12 @@ export interface ResourceConditions {
|
|
|
696
696
|
* Hetzner Object Storage) and served via a CDN (CloudFront on AWS). This is
|
|
697
697
|
* the classic static-site path.
|
|
698
698
|
* - `'server'` — the site lives on the environment's compute server (EC2 /
|
|
699
|
-
* Hetzner VM)
|
|
699
|
+
* Hetzner VM). Proxying/TLS for these targets is handled by the operator's
|
|
700
|
+
* own tooling (e.g. rpx + tlsx), not ts-cloud. A `'server'` site resolves to
|
|
700
701
|
* one of two kinds depending on whether it declares a `start` command:
|
|
701
|
-
* - `start` present → a **dynamic app** run as a systemd service
|
|
702
|
-
*
|
|
703
|
-
*
|
|
704
|
-
* server** by Caddy `file_server`, optionally fronted by a CDN.
|
|
702
|
+
* - `start` present → a **dynamic app** run as a systemd service.
|
|
703
|
+
* - no `start` (but a static `root`) → a **static site built and shipped to
|
|
704
|
+
* the server** (to `/var/www/<site>`), optionally fronted by a CDN.
|
|
705
705
|
*
|
|
706
706
|
* @see resolveSiteDeployTarget for the default inference rules.
|
|
707
707
|
*/
|
|
@@ -709,11 +709,11 @@ export type SiteDeployTarget = 'bucket' | 'server';
|
|
|
709
709
|
/**
|
|
710
710
|
* Per-site caching hint, applicable to either origin (bucket or server).
|
|
711
711
|
*
|
|
712
|
-
*
|
|
713
|
-
*
|
|
714
|
-
*
|
|
715
|
-
*
|
|
716
|
-
*
|
|
712
|
+
* `cdn` expresses the intent to place a CDN in front of the origin — on AWS
|
|
713
|
+
* this reuses the existing CloudFront machinery; on Hetzner (no native CDN)
|
|
714
|
+
* it's advisory only (put CloudFront / Cloudflare / bunny in front of the box
|
|
715
|
+
* yourself). For a `server`-served static site, caching/TLS at the edge is
|
|
716
|
+
* configured by the operator's own proxy (e.g. rpx + tlsx).
|
|
717
717
|
*/
|
|
718
718
|
export interface SiteCacheConfig {
|
|
719
719
|
/** Emit cache-control headers / enable CDN caching for this site. */
|
|
@@ -765,9 +765,9 @@ export interface SiteConfig {
|
|
|
765
765
|
* An explicit value always wins over the inference. Combined with `start`,
|
|
766
766
|
* this resolves to one of three kinds (see {@link SiteDeployTarget}):
|
|
767
767
|
* - `'bucket'` → upload built `root` to object storage + CDN;
|
|
768
|
-
* - `'server'` + `start` → dynamic app as a systemd service
|
|
769
|
-
* - `'server'` + no `start` (static `root`) → static site built and
|
|
770
|
-
* **
|
|
768
|
+
* - `'server'` + `start` → dynamic app as a systemd service;
|
|
769
|
+
* - `'server'` + no `start` (static `root`) → static site built and shipped
|
|
770
|
+
* **to the server** (`/var/www/<site>`), with optional CDN caching.
|
|
771
771
|
*
|
|
772
772
|
* Set `deploy: 'server'` (without `start`) to build/serve docs or a blog on an
|
|
773
773
|
* existing compute box instead of a bucket. Set `deploy: 'bucket'` on a site
|
|
@@ -776,20 +776,21 @@ export interface SiteConfig {
|
|
|
776
776
|
deploy?: SiteDeployTarget;
|
|
777
777
|
/**
|
|
778
778
|
* Per-site caching hint, used for both bucket and server origins.
|
|
779
|
-
*
|
|
780
|
-
*
|
|
779
|
+
* `cdn` expresses "front this origin with a CDN". For a server-served static
|
|
780
|
+
* site, edge caching/TLS is configured by the operator's own proxy (rpx +
|
|
781
|
+
* tlsx), not ts-cloud.
|
|
781
782
|
*/
|
|
782
783
|
cache?: SiteCacheConfig;
|
|
783
784
|
/**
|
|
784
785
|
* Whether this site serves a single-page application (client-side routing).
|
|
785
|
-
*
|
|
786
|
-
* `
|
|
787
|
-
*
|
|
786
|
+
* Mirrors {@link StorageItemConfig.spa} for the bucket path. For a
|
|
787
|
+
* `server`-served static site, SPA fallback is configured in the operator's
|
|
788
|
+
* own proxy.
|
|
788
789
|
*/
|
|
789
790
|
spa?: boolean;
|
|
790
791
|
/**
|
|
791
|
-
* URL rewrite style for a
|
|
792
|
-
*
|
|
792
|
+
* URL rewrite style for a static site's extensionless URLs, mirroring
|
|
793
|
+
* {@link StorageItemConfig.pathRewriteStyle}:
|
|
793
794
|
* - `'directory'` (default): `/guide/get-started` → `/guide/get-started/index.html`
|
|
794
795
|
* - `'flat'`: `/guide/get-started` → `/guide/get-started.html`
|
|
795
796
|
*/
|
|
@@ -1298,144 +1299,6 @@ export interface ContainerItemConfig {
|
|
|
1298
1299
|
targetMemoryUtilization?: number;
|
|
1299
1300
|
};
|
|
1300
1301
|
}
|
|
1301
|
-
/**
|
|
1302
|
-
* A single upstream application fronted by the Caddy reverse proxy.
|
|
1303
|
-
*
|
|
1304
|
-
* Each app maps one or more request domains to a local upstream port, so a
|
|
1305
|
-
* single server can host several apps (e.g. a registry, a web app and a
|
|
1306
|
-
* tunnel server) behind one Caddy instance with host-based routing.
|
|
1307
|
-
*/
|
|
1308
|
-
export interface CaddyAppConfig {
|
|
1309
|
-
/**
|
|
1310
|
-
* Optional human-readable name for the app (used only for Caddyfile
|
|
1311
|
-
* comments / readability). Defaults to the first domain.
|
|
1312
|
-
*/
|
|
1313
|
-
name?: string;
|
|
1314
|
-
/**
|
|
1315
|
-
* Domains routed to this upstream. Multiple domains share one site block.
|
|
1316
|
-
*
|
|
1317
|
-
* - Explicit hostnames (e.g. `app.example.com`) get automatic Let's Encrypt
|
|
1318
|
-
* TLS via the HTTP-01 challenge.
|
|
1319
|
-
* - Wildcards (`*.tunnel.example.com`) or a bare `*` require on-demand TLS
|
|
1320
|
-
* (see `proxy.onDemandTls`) because Caddy can't pre-provision certs for an
|
|
1321
|
-
* unbounded set of hostnames.
|
|
1322
|
-
*/
|
|
1323
|
-
domains: string[];
|
|
1324
|
-
/**
|
|
1325
|
-
* Local upstream port the app listens on (Caddy proxies to
|
|
1326
|
-
* `localhost:<port>`).
|
|
1327
|
-
*
|
|
1328
|
-
* Required for a reverse-proxy (dynamic) app. Omit for a static
|
|
1329
|
-
* (`file_server`) site, which is selected by setting {@link root} instead.
|
|
1330
|
-
*/
|
|
1331
|
-
port?: number;
|
|
1332
|
-
/**
|
|
1333
|
-
* Serve a static site from this directory via Caddy `file_server` (the box is
|
|
1334
|
-
* the origin) instead of reverse-proxying to a port. Mutually exclusive with
|
|
1335
|
-
* {@link port}; when set, this app emits a `root * <root>` + `file_server`
|
|
1336
|
-
* block rather than a `reverse_proxy`.
|
|
1337
|
-
*/
|
|
1338
|
-
root?: string;
|
|
1339
|
-
/**
|
|
1340
|
-
* Static `file_server` only. When true, unmatched paths fall back to
|
|
1341
|
-
* `index.html` (`try_files {path} /index.html`) for client-side SPA routing.
|
|
1342
|
-
*/
|
|
1343
|
-
spa?: boolean;
|
|
1344
|
-
/**
|
|
1345
|
-
* Static `file_server` only. URL rewrite style for extensionless requests,
|
|
1346
|
-
* mirroring {@link StorageItemConfig.pathRewriteStyle}:
|
|
1347
|
-
* - `'directory'` (default): `/guide/get-started` → `/guide/get-started/index.html`
|
|
1348
|
-
* - `'flat'`: `/guide/get-started` → `/guide/get-started.html`
|
|
1349
|
-
*/
|
|
1350
|
-
pathRewriteStyle?: 'directory' | 'flat';
|
|
1351
|
-
/**
|
|
1352
|
-
* Static `file_server` only. When set, emits a `Cache-Control` header for
|
|
1353
|
-
* served assets. `maxAge` (seconds) controls `max-age`; defaults to 3600 when
|
|
1354
|
-
* enabled without an explicit value.
|
|
1355
|
-
*/
|
|
1356
|
-
cache?: SiteCacheConfig;
|
|
1357
|
-
/**
|
|
1358
|
-
* Upstream host. Defaults to `localhost`. Set this to proxy to another
|
|
1359
|
-
* machine / container on the private network.
|
|
1360
|
-
* @default 'localhost'
|
|
1361
|
-
*/
|
|
1362
|
-
upstreamHost?: string;
|
|
1363
|
-
/**
|
|
1364
|
-
* Optional path prefix. When set, only requests matching this path are
|
|
1365
|
-
* routed to the upstream; several apps can then share a domain. Omit (or use
|
|
1366
|
-
* `/`) for a catch-all.
|
|
1367
|
-
*/
|
|
1368
|
-
path?: string;
|
|
1369
|
-
/**
|
|
1370
|
-
* Extra raw directives placed inside this app's `reverse_proxy` block
|
|
1371
|
-
* (e.g. `header_up Host {host}`, `lb_policy round_robin`). Advanced escape
|
|
1372
|
-
* hatch — emitted verbatim.
|
|
1373
|
-
*/
|
|
1374
|
-
reverseProxyDirectives?: string[];
|
|
1375
|
-
}
|
|
1376
|
-
/**
|
|
1377
|
-
* On-demand TLS configuration. Caddy obtains a certificate at the moment of
|
|
1378
|
-
* the first TLS handshake for a hostname, rather than ahead of time. Essential
|
|
1379
|
-
* for wildcard/tunnel domains where the full hostname set isn't known up front.
|
|
1380
|
-
*
|
|
1381
|
-
* @see https://caddyserver.com/docs/automatic-https#on-demand-tls
|
|
1382
|
-
*/
|
|
1383
|
-
export interface CaddyOnDemandTlsConfig {
|
|
1384
|
-
/**
|
|
1385
|
-
* URL Caddy queries before issuing a certificate for an unknown host. Caddy
|
|
1386
|
-
* issues a cert only on a 2xx response, which prevents unbounded issuance.
|
|
1387
|
-
* Strongly recommended (Caddy refuses to start on-demand TLS without it in
|
|
1388
|
-
* most production setups).
|
|
1389
|
-
*
|
|
1390
|
-
* Example: `http://localhost:9007/check-domain`
|
|
1391
|
-
*/
|
|
1392
|
-
ask?: string;
|
|
1393
|
-
/**
|
|
1394
|
-
* Rate limit: max certificate issuances allowed within `interval`.
|
|
1395
|
-
* @deprecated by Caddy upstream but still emitted when set.
|
|
1396
|
-
*/
|
|
1397
|
-
burst?: number;
|
|
1398
|
-
/** Interval (Caddy duration, e.g. `1m`, `2h`) for the `burst` rate limit. */
|
|
1399
|
-
interval?: string;
|
|
1400
|
-
}
|
|
1401
|
-
/**
|
|
1402
|
-
* Typed reverse-proxy front for a compute server. Generates a `/etc/caddy/Caddyfile`
|
|
1403
|
-
* that performs host-based routing to one or more upstream apps with automatic
|
|
1404
|
-
* HTTPS (Let's Encrypt HTTP-01) and optional on-demand TLS.
|
|
1405
|
-
*/
|
|
1406
|
-
export interface CaddyProxyConfig {
|
|
1407
|
-
/**
|
|
1408
|
-
* Apps fronted by the proxy. Each maps domain(s) → an upstream port.
|
|
1409
|
-
* When omitted, ts-cloud derives apps from `sites` that declare a `domain`
|
|
1410
|
-
* and `port`, so single-app deploys keep working without extra config.
|
|
1411
|
-
*/
|
|
1412
|
-
apps?: CaddyAppConfig[];
|
|
1413
|
-
/**
|
|
1414
|
-
* Email used for the Let's Encrypt ACME account (recommended — receives
|
|
1415
|
-
* expiry warnings). Emitted in the Caddyfile global options block.
|
|
1416
|
-
*/
|
|
1417
|
-
email?: string;
|
|
1418
|
-
/**
|
|
1419
|
-
* Enable on-demand TLS for wildcard/tunnel domains. Either `true` (use the
|
|
1420
|
-
* `ask` endpoint from this object) or a full config object.
|
|
1421
|
-
*/
|
|
1422
|
-
onDemandTls?: boolean | CaddyOnDemandTlsConfig;
|
|
1423
|
-
/**
|
|
1424
|
-
* Use the Let's Encrypt **staging** CA (higher rate limits, untrusted certs)
|
|
1425
|
-
* — handy while iterating on a new deploy so you don't burn prod rate limits.
|
|
1426
|
-
*/
|
|
1427
|
-
staging?: boolean;
|
|
1428
|
-
/**
|
|
1429
|
-
* Extra global directives placed in the Caddyfile global options block
|
|
1430
|
-
* (e.g. `admin off`, `servers { protocols h1 h2 h3 } `). Emitted verbatim.
|
|
1431
|
-
*/
|
|
1432
|
-
globalDirectives?: string[];
|
|
1433
|
-
/**
|
|
1434
|
-
* Provide a fully pre-rendered Caddyfile, bypassing generation entirely.
|
|
1435
|
-
* Mutually exclusive with `apps` (raw wins). Escape hatch for advanced setups.
|
|
1436
|
-
*/
|
|
1437
|
-
raw?: string;
|
|
1438
|
-
}
|
|
1439
1302
|
export interface ComputeConfig {
|
|
1440
1303
|
/**
|
|
1441
1304
|
* Compute mode: 'server' for EC2, 'serverless' for Fargate/Lambda
|
|
@@ -1676,15 +1539,50 @@ export interface ComputeConfig {
|
|
|
1676
1539
|
*/
|
|
1677
1540
|
allowSsh?: boolean;
|
|
1678
1541
|
/**
|
|
1679
|
-
* Reverse-proxy
|
|
1680
|
-
*
|
|
1542
|
+
* Reverse-proxy gateway to provision on the box. When set to an engine,
|
|
1543
|
+
* `buddy deploy` generates the gateway's route config from the `sites` model
|
|
1544
|
+
* (mapping each non-bucket site to a route by `domain`/`path`) and installs +
|
|
1545
|
+
* starts the gateway on :80/:443.
|
|
1681
1546
|
*
|
|
1682
|
-
*
|
|
1683
|
-
*
|
|
1684
|
-
*
|
|
1685
|
-
*
|
|
1547
|
+
* Opt-in and **off by default** (`undefined` → no gateway provisioned, the
|
|
1548
|
+
* operator runs their own), so existing deploys are unaffected.
|
|
1549
|
+
*
|
|
1550
|
+
* Currently the only engine is `rpx` (`@stacksjs/rpx`), which natively
|
|
1551
|
+
* supports path-based routing within a host, on-demand TLS, and serving
|
|
1552
|
+
* static dirs — so an app, docs, and a public site can share one domain.
|
|
1553
|
+
*/
|
|
1554
|
+
proxy?: ComputeProxyConfig;
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* Reverse-proxy gateway provisioning for a compute box. The gateway is
|
|
1558
|
+
* generated from the `sites` model and installed by the driver's cloud-init /
|
|
1559
|
+
* deploy flow. See {@link ComputeConfig.proxy}.
|
|
1560
|
+
*/
|
|
1561
|
+
export interface ComputeProxyConfig {
|
|
1562
|
+
/**
|
|
1563
|
+
* Gateway engine. `rpx` provisions `@stacksjs/rpx` as a systemd service
|
|
1564
|
+
* (`rpx-gateway.service`) reading a generated config. This is the only
|
|
1565
|
+
* supported engine today.
|
|
1566
|
+
*/
|
|
1567
|
+
engine: 'rpx';
|
|
1568
|
+
/**
|
|
1569
|
+
* npm version/range of `@stacksjs/rpx` to install on the box.
|
|
1570
|
+
* @default 'latest'
|
|
1571
|
+
*/
|
|
1572
|
+
version?: string;
|
|
1573
|
+
/**
|
|
1574
|
+
* Directory on the box holding real TLS certs (PEM `<domain>.crt`/`.key`),
|
|
1575
|
+
* served per-SNI by rpx. @default '/etc/rpx/certs'
|
|
1576
|
+
*/
|
|
1577
|
+
certsDir?: string;
|
|
1578
|
+
/**
|
|
1579
|
+
* Enable rpx on-demand TLS: lazily issue a real (Let's Encrypt) cert for an
|
|
1580
|
+
* approved host the first time it's needed. The site domains are used as the
|
|
1581
|
+
* allowlist. Off by default.
|
|
1686
1582
|
*/
|
|
1687
|
-
|
|
1583
|
+
onDemandTls?: boolean;
|
|
1584
|
+
/** Contact email for the ACME account when {@link onDemandTls} is enabled. */
|
|
1585
|
+
onDemandTlsEmail?: string;
|
|
1688
1586
|
}
|
|
1689
1587
|
export interface DatabaseItemConfig {
|
|
1690
1588
|
engine?: 'dynamodb' | 'postgres' | 'mysql';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-cloud/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.25",
|
|
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.2.
|
|
34
|
+
"@ts-cloud/aws-types": "0.2.25"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"typescript": "^5.9.3"
|