@ts-cloud/core 0.12.10 → 0.12.11
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/drivers/types.d.ts +8 -2
- package/dist/index.js +94 -94
- package/dist/state-dir.d.ts +9 -0
- package/dist/types.d.ts +92 -1
- package/package.json +2 -2
package/dist/state-dir.d.ts
CHANGED
|
@@ -11,6 +11,15 @@ export declare const STATE_DIR_ENV_VAR = "TS_CLOUD_STATE_DIR";
|
|
|
11
11
|
* dashboard server loading configs for several projects).
|
|
12
12
|
*/
|
|
13
13
|
export declare function setStateDir(dir?: string | null): void;
|
|
14
|
+
/**
|
|
15
|
+
* Whether anything configured the state directory (config or environment).
|
|
16
|
+
*
|
|
17
|
+
* The driver state files predate the configurable directory and have their
|
|
18
|
+
* own legacy home (`storage/cloud/state`, meant to be committed). They only
|
|
19
|
+
* move under the state directory when a project actually chose one, so a
|
|
20
|
+
* standalone project keeps its committed state where it always was.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isStateDirConfigured(): boolean;
|
|
14
23
|
/**
|
|
15
24
|
* The configured state directory, as written — relative or absolute.
|
|
16
25
|
*/
|
package/dist/types.d.ts
CHANGED
|
@@ -4,9 +4,14 @@
|
|
|
4
4
|
export interface CloudProviderConfig {
|
|
5
5
|
/**
|
|
6
6
|
* Infrastructure provider for compute and related resources.
|
|
7
|
+
*
|
|
8
|
+
* `'ssh'` deploys to Linux hosts you already own and reach over SSH (a
|
|
9
|
+
* Raspberry Pi on the LAN, a colocated box, a VM from a provider ts-cloud
|
|
10
|
+
* has no API driver for). Nothing is created or destroyed on your behalf;
|
|
11
|
+
* see {@link SshConfig}.
|
|
7
12
|
* @default 'aws'
|
|
8
13
|
*/
|
|
9
|
-
provider?: 'aws' | 'hetzner';
|
|
14
|
+
provider?: 'aws' | 'hetzner' | 'ssh';
|
|
10
15
|
/**
|
|
11
16
|
* Attach this project's sites to a box owned by ANOTHER project instead of
|
|
12
17
|
* provisioning one. Set to the owner project's `project.slug` (e.g. `'stacks'`);
|
|
@@ -130,6 +135,86 @@ export interface HetznerConfig {
|
|
|
130
135
|
/** SSH user for deploy commands. Env: `HCLOUD_SSH_USER`. @default 'root' */
|
|
131
136
|
sshUser?: string;
|
|
132
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* One bring-your-own host the ssh provider deploys to.
|
|
140
|
+
*/
|
|
141
|
+
export interface SshHostConfig {
|
|
142
|
+
/** Hostname or IP address ts-cloud connects to, e.g. `pi-app.local` or `203.0.113.7`. */
|
|
143
|
+
host: string;
|
|
144
|
+
/** SSH user. Env: `TS_CLOUD_SSH_USER`. @default 'root' */
|
|
145
|
+
user?: string;
|
|
146
|
+
/** SSH port. Env: `TS_CLOUD_SSH_PORT`. @default 22 */
|
|
147
|
+
port?: number;
|
|
148
|
+
/** Path to the SSH private key used for deploy commands. Env: `TS_CLOUD_SSH_KEY`. @default '~/.ssh/id_ed25519' */
|
|
149
|
+
privateKeyPath?: string;
|
|
150
|
+
/**
|
|
151
|
+
* What the host does. Only `app` exists today: one host runs the gateway,
|
|
152
|
+
* the sites and the managed services. Declared so a future services or
|
|
153
|
+
* load-balancer role does not have to change the shape of the list.
|
|
154
|
+
* @default 'app'
|
|
155
|
+
*/
|
|
156
|
+
role?: 'app';
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Bring-your-own hosts, deployed to over SSH (when `cloud.provider` is `'ssh'`).
|
|
160
|
+
*
|
|
161
|
+
* The ssh provider ADOPTS a machine rather than provisioning one: you install
|
|
162
|
+
* the OS, ts-cloud checks the host (`cloud ssh:preflight`), bootstraps the
|
|
163
|
+
* same stack the Hetzner driver installs at first boot, and from then on
|
|
164
|
+
* deploys exactly as it would to a cloud box. Teardown clears local state
|
|
165
|
+
* only and never touches the host.
|
|
166
|
+
*
|
|
167
|
+
* Every value here can also come from the environment (`TS_CLOUD_SSH_*`),
|
|
168
|
+
* and what is written here always wins over the environment, for the same
|
|
169
|
+
* reason as {@link HetznerConfig}: a stray shell export must not silently
|
|
170
|
+
* redirect a deploy to another machine. Resolution lives in one place:
|
|
171
|
+
* `resolveSshSettings` in `@stacksjs/ts-cloud` (`drivers/ssh/config.ts`).
|
|
172
|
+
*/
|
|
173
|
+
export interface SshConfig {
|
|
174
|
+
/** The hosts to deploy to. Exactly one host is supported today. Env: `TS_CLOUD_SSH_HOST`. */
|
|
175
|
+
hosts: SshHostConfig[];
|
|
176
|
+
/**
|
|
177
|
+
* How the host's SSH key is trusted. `pin` records the key on first contact
|
|
178
|
+
* (in `<stateDir>/ssh/known_hosts`) and refuses a different one afterwards;
|
|
179
|
+
* `accept-new` lets ssh record it on first contact; `insecure` never
|
|
180
|
+
* checks, which is what the cloud drivers do because their provider API is
|
|
181
|
+
* what identifies the box. A bring-your-own host has no such API, so the
|
|
182
|
+
* default pins. Env: `TS_CLOUD_SSH_HOST_KEY`.
|
|
183
|
+
* @default 'pin'
|
|
184
|
+
*/
|
|
185
|
+
hostKey?: 'pin' | 'accept-new' | 'insecure';
|
|
186
|
+
/**
|
|
187
|
+
* Run the remote scripts through `sudo -n`. Defaults to true for any user
|
|
188
|
+
* other than root, which is the only sensible reading: a deploy user that
|
|
189
|
+
* cannot become root cannot install packages, write systemd units or bind
|
|
190
|
+
* :80 and :443. Set to false to insist on a root-capable user.
|
|
191
|
+
*/
|
|
192
|
+
sudo?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Host profile. `raspberry-pi` tunes the bootstrap for an SD-card ARM
|
|
195
|
+
* board: a smaller swapfile, a bounded journal, a wait for time sync before
|
|
196
|
+
* apt runs (a Pi 5 has no battery-backed clock), and an early refusal of
|
|
197
|
+
* services that only ship x86_64 builds. Env: `TS_CLOUD_SSH_PROFILE`.
|
|
198
|
+
* @default 'generic'
|
|
199
|
+
*/
|
|
200
|
+
profile?: 'raspberry-pi' | 'generic';
|
|
201
|
+
/**
|
|
202
|
+
* The public IP DNS should point at. `auto` asks the host for its own
|
|
203
|
+
* address; a literal address is used as-is (a home connection behind NAT
|
|
204
|
+
* whose router forwards :80/:443 to the host, for instance).
|
|
205
|
+
* @default 'auto'
|
|
206
|
+
*/
|
|
207
|
+
publicIp?: 'auto' | string;
|
|
208
|
+
/**
|
|
209
|
+
* LAN access, for a host that is not reachable from the internet at all.
|
|
210
|
+
* `hostname` is the mDNS name the gateway also answers on (`pi-app.local`);
|
|
211
|
+
* `tls` chooses between a locally issued CA for that name and plain HTTP.
|
|
212
|
+
*/
|
|
213
|
+
lan?: {
|
|
214
|
+
hostname?: string;
|
|
215
|
+
tls?: 'local-ca' | 'off';
|
|
216
|
+
};
|
|
217
|
+
}
|
|
133
218
|
/**
|
|
134
219
|
* AWS-specific configuration
|
|
135
220
|
*/
|
|
@@ -171,6 +256,12 @@ export interface CloudConfig {
|
|
|
171
256
|
* Hetzner Cloud configuration (when cloud.provider is 'hetzner')
|
|
172
257
|
*/
|
|
173
258
|
hetzner?: HetznerConfig;
|
|
259
|
+
/**
|
|
260
|
+
* Bring-your-own hosts reached over SSH (when cloud.provider is 'ssh').
|
|
261
|
+
* Listing hosts here without setting `cloud.provider` selects the ssh
|
|
262
|
+
* provider.
|
|
263
|
+
*/
|
|
264
|
+
ssh?: SshConfig;
|
|
174
265
|
/**
|
|
175
266
|
* Object storage provider selection (AWS S3, Backblaze B2, Hetzner Object Storage).
|
|
176
267
|
* Independent of `cloud.provider` — you can run compute on AWS while keeping
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-cloud/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.11",
|
|
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.12.
|
|
34
|
+
"@ts-cloud/aws-types": "0.12.11"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"typescript": "^7.0.2"
|