@kvbox/cli 0.5.50 → 0.5.51
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/kvbox.js +63 -9
- package/dist/kvbox.js.map +1 -1
- package/package.json +1 -1
package/dist/kvbox.js
CHANGED
|
@@ -164,7 +164,7 @@ function versionOf(srcFileUrl, injected) {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
// src/version.ts
|
|
167
|
-
var VERSION = versionOf(import.meta.url, true ? "0.5.
|
|
167
|
+
var VERSION = versionOf(import.meta.url, true ? "0.5.51" : void 0);
|
|
168
168
|
|
|
169
169
|
// src/commands/vm/index.ts
|
|
170
170
|
import { Command as Command37 } from "commander";
|
|
@@ -220,6 +220,15 @@ function paths(home = kvboxHome()) {
|
|
|
220
220
|
firecracker: join(home, "bin", "firecracker"),
|
|
221
221
|
/** Firecracker's snapshot-editor, from the same release: merges a diff snapshot onto a full memory image. */
|
|
222
222
|
snapshotEditor: join(home, "bin", "snapshot-editor"),
|
|
223
|
+
/** Garage, on a host that is a backup store (`kvbox-server backup setup` downloads it). */
|
|
224
|
+
garage: join(home, "bin", "garage"),
|
|
225
|
+
/** The store's Garage as this host runs it: its configuration, pid and log. The data is on the disk the operator named. */
|
|
226
|
+
backupStore: {
|
|
227
|
+
dir: join(home, "backup-store"),
|
|
228
|
+
conf: join(home, "backup-store", "garage.toml"),
|
|
229
|
+
pid: join(home, "backup-store", "garage.pid"),
|
|
230
|
+
log: join(home, "backup-store", "garage.log")
|
|
231
|
+
},
|
|
223
232
|
assets: join(home, "assets"),
|
|
224
233
|
kernel: join(home, "assets", "vmlinux"),
|
|
225
234
|
/** Symlink to the current base image, assets/rootfs-<version>.ext4; boxes keep using the version they were made from. */
|
|
@@ -547,7 +556,7 @@ var HostBackupManifestSchema = z2.object({
|
|
|
547
556
|
vcpu: z2.number().int(),
|
|
548
557
|
memMib: z2.number().int()
|
|
549
558
|
});
|
|
550
|
-
var HostUploadRequest = z2.object({ key: z2.string(), urls: z2.record(z2.string(), z2.string()) });
|
|
559
|
+
var HostUploadRequest = z2.object({ key: z2.string(), urls: z2.record(z2.string(), z2.string()), pin: z2.string().optional() });
|
|
551
560
|
var HostUploadResultSchema = z2.object({ chunks: z2.number().int(), bytes: z2.number().int(), sizes: z2.record(z2.string(), z2.number().int()) });
|
|
552
561
|
var HostRestoreRequest = z2.object({
|
|
553
562
|
/** The backup's id: its variables were sealed under it. */
|
|
@@ -557,7 +566,43 @@ var HostRestoreRequest = z2.object({
|
|
|
557
566
|
base: z2.string(),
|
|
558
567
|
image: z2.string().optional(),
|
|
559
568
|
env: z2.string().nullable(),
|
|
560
|
-
chunks: z2.array(z2.object({ index: z2.number().int().nonnegative(), hash: z2.string(), url: z2.string() }))
|
|
569
|
+
chunks: z2.array(z2.object({ index: z2.number().int().nonnegative(), hash: z2.string(), url: z2.string() })),
|
|
570
|
+
/** The certificate fingerprint of the store the URLs point at (see HostUploadRequest). */
|
|
571
|
+
pin: z2.string().optional()
|
|
572
|
+
});
|
|
573
|
+
var BackupStoreSetupRequest = z2.object({ path: z2.string().min(1), force: z2.boolean().optional(), newStore: z2.boolean().optional() });
|
|
574
|
+
var BackupStoreStatusSchema = z2.object({
|
|
575
|
+
path: z2.string(),
|
|
576
|
+
bucket: z2.string(),
|
|
577
|
+
accessKey: z2.string(),
|
|
578
|
+
/** Whether Garage is running and can store. */
|
|
579
|
+
running: z2.boolean(),
|
|
580
|
+
/** The filesystem the path is on. */
|
|
581
|
+
totalBytes: z2.number().int(),
|
|
582
|
+
freeBytes: z2.number().int(),
|
|
583
|
+
/** What the bucket holds, when Garage answers. */
|
|
584
|
+
objects: z2.number().int().optional(),
|
|
585
|
+
storedBytes: z2.number().int().optional(),
|
|
586
|
+
/** Whether the control plane took the store's registration at setup. */
|
|
587
|
+
registered: z2.boolean().optional()
|
|
588
|
+
});
|
|
589
|
+
var BackupStoreRegistration = z2.object({ bucket: z2.string().min(1), region: z2.string().min(1), accessKey: z2.string().min(1), secretKey: z2.string().min(1) });
|
|
590
|
+
var CloudBackupStoreSchema = z2.object({
|
|
591
|
+
id: z2.string(),
|
|
592
|
+
/** Null while no host serves it (its host left; it comes back when a host registers its key and secret again). */
|
|
593
|
+
host: z2.string().nullable(),
|
|
594
|
+
endpoint: z2.string().nullable(),
|
|
595
|
+
bucket: z2.string(),
|
|
596
|
+
accessKey: z2.string(),
|
|
597
|
+
createdAt: z2.string(),
|
|
598
|
+
/** The host answered a poll in the last minute and its Garage runs. */
|
|
599
|
+
live: z2.boolean(),
|
|
600
|
+
/** From the host's last poll; null when it never reported a store. */
|
|
601
|
+
totalBytes: z2.number().int().nullable(),
|
|
602
|
+
freeBytes: z2.number().int().nullable(),
|
|
603
|
+
/** Ready backups kept here, and what their chunks take (encrypted, compressed). */
|
|
604
|
+
backups: z2.number().int(),
|
|
605
|
+
storedBytes: z2.number().int()
|
|
561
606
|
});
|
|
562
607
|
var MachineSchema = z2.object({
|
|
563
608
|
/** Host-unique short id (the tap is `kv-<id>`). Missing only on a box made before ids that has not restarted since. */
|
|
@@ -799,7 +844,11 @@ var CapacitySchema = z2.object({
|
|
|
799
844
|
*/
|
|
800
845
|
images: z2.array(z2.object({ name: z2.string(), version: z2.string() })).optional(),
|
|
801
846
|
/** kvbox-server's version, so the control plane's host list shows it without a call per host. Older servers omit it. */
|
|
802
|
-
version: z2.string().optional()
|
|
847
|
+
version: z2.string().optional(),
|
|
848
|
+
/** Present on a host set up as a backup store: the disk its Garage keeps chunks on, and whether Garage runs. */
|
|
849
|
+
backupStore: z2.object({ totalBytes: z2.number().int(), freeBytes: z2.number().int(), running: z2.boolean() }).optional(),
|
|
850
|
+
/** True on a kvbox-server that reaches a backup store by its certificate's `pin`; older ones omit it and cannot back up to a store. */
|
|
851
|
+
storeClient: z2.boolean().optional()
|
|
803
852
|
});
|
|
804
853
|
var ImageSchema = z2.object({ name: z2.string(), version: z2.string().nullable() });
|
|
805
854
|
var ImageIndexSchema = z2.object({
|
|
@@ -1215,6 +1264,8 @@ var CloudHostSchema = z2.object({
|
|
|
1215
1264
|
capacity: CapacitySchema.nullable(),
|
|
1216
1265
|
/** ISO 3166-1 alpha-2 code (`RO`), null when nobody said where the host is. */
|
|
1217
1266
|
country: z2.string().nullable(),
|
|
1267
|
+
/** The S3 region a storage made on this host answers to (`ro-west-1`); null: it takes no storage. */
|
|
1268
|
+
region: z2.string().nullable(),
|
|
1218
1269
|
/** kvbox-server's version as of the poller's last look (`capacity.version`); null before one, or for a server older than 0.5.45. */
|
|
1219
1270
|
version: z2.string().nullable()
|
|
1220
1271
|
});
|
|
@@ -1223,7 +1274,7 @@ var HostInfoSchema = z2.object({
|
|
|
1223
1274
|
health: HealthSchema.nullable(),
|
|
1224
1275
|
error: z2.string().nullable()
|
|
1225
1276
|
});
|
|
1226
|
-
var HostPatchRequest = z2.object({ country: z2.string().nullable() });
|
|
1277
|
+
var HostPatchRequest = z2.object({ country: z2.string().nullable().optional(), region: z2.string().nullable().optional() }).refine((b) => b.country !== void 0 || b.region !== void 0, { message: "give country, region or both" });
|
|
1227
1278
|
var CountrySchema = z2.object({ code: z2.string(), name: z2.string() });
|
|
1228
1279
|
|
|
1229
1280
|
// ../shared/src/managed.ts
|
|
@@ -1364,11 +1415,13 @@ var GrowManagedRequest = z4.object({ storageGib: z4.number().int() });
|
|
|
1364
1415
|
|
|
1365
1416
|
// ../shared/src/storage.ts
|
|
1366
1417
|
import { z as z5 } from "zod";
|
|
1418
|
+
var RegionSchema = z5.object({ name: z5.string(), country: z5.string().nullable() });
|
|
1367
1419
|
var ObjectStorageSchema = z5.object({
|
|
1368
1420
|
owner: z5.string(),
|
|
1369
1421
|
ownerKind: z5.enum(["user", "org"]),
|
|
1370
1422
|
/** `https://s3-<slug>.<domain>`: what an S3 client is given, with path-style addressing. Null while the address is not claimed. */
|
|
1371
1423
|
endpoint: z5.string().nullable(),
|
|
1424
|
+
/** The S3 region every client of it signs with (`ro-west-1`): its host's when it was made. */
|
|
1372
1425
|
region: z5.string(),
|
|
1373
1426
|
/** The most it may hold. */
|
|
1374
1427
|
sizeGib: z5.number().int(),
|
|
@@ -1398,7 +1451,8 @@ var BucketSchema = z5.object({
|
|
|
1398
1451
|
var CreateBucketRequest = z5.object({
|
|
1399
1452
|
name: z5.string(),
|
|
1400
1453
|
sizeGib: z5.number().int().optional(),
|
|
1401
|
-
near: z5.string().optional()
|
|
1454
|
+
near: z5.string().optional(),
|
|
1455
|
+
region: z5.string().optional()
|
|
1402
1456
|
});
|
|
1403
1457
|
var CreatedBucketSchema = BucketSchema.extend({ storage: ObjectStorageSchema, storageCreated: z5.boolean() });
|
|
1404
1458
|
var BucketInfoSchema = BucketSchema.extend({ storage: ObjectStorageSchema });
|
|
@@ -5882,18 +5936,18 @@ function printRows(rows2) {
|
|
|
5882
5936
|
}
|
|
5883
5937
|
|
|
5884
5938
|
// src/commands/bucket/create.ts
|
|
5885
|
-
var createCommand4 = new Command62("create").description("make a bucket (the first one also makes your object storage)").argument("<name>", "bucket name: 3-63 lowercase letters, digits and '-'").option("--size <GB>", "how much your object storage may hold, when this is your first bucket (default 10)").option("--near <box>", "put the object storage on the host of this box, when this is your first bucket").option("--json", "print as JSON").action(async (name, opts, cmd) => {
|
|
5939
|
+
var createCommand4 = new Command62("create").description("make a bucket (the first one also makes your object storage)").argument("<name>", "bucket name: 3-63 lowercase letters, digits and '-'").option("--size <GB>", "how much your object storage may hold, when this is your first bucket (default 10)").option("--region <region>", "the S3 region of your object storage (ro-west-1, de-center-1), when this is your first bucket").option("--near <box>", "put the object storage on the host of this box, when this is your first bucket").option("--json", "print as JSON").action(async (name, opts, cmd) => {
|
|
5886
5940
|
const sizeGib = opts.size === void 0 ? void 0 : parseGib2(opts.size);
|
|
5887
5941
|
const client = await bucketClient(cmd);
|
|
5888
5942
|
try {
|
|
5889
|
-
const made = await spin(`making bucket ${name}\u2026`, client.createBucket({ name, ...sizeGib !== void 0 ? { sizeGib } : {}, ...opts.near !== void 0 ? { near: opts.near } : {} }));
|
|
5943
|
+
const made = await spin(`making bucket ${name}\u2026`, client.createBucket({ name, ...sizeGib !== void 0 ? { sizeGib } : {}, ...opts.region !== void 0 ? { region: opts.region } : {}, ...opts.near !== void 0 ? { near: opts.near } : {} }));
|
|
5890
5944
|
if (opts.json) {
|
|
5891
5945
|
json(made);
|
|
5892
5946
|
return;
|
|
5893
5947
|
}
|
|
5894
5948
|
const shown = shownName(made, client);
|
|
5895
5949
|
info(`${color.green("\u2713")} bucket ${color.bold(shown)} made`);
|
|
5896
|
-
if (made.storageCreated) info(` object storage made for ${made.owner}: ${made.storage.sizeGib} GB for all its buckets, ${priceText(made.storage)}`);
|
|
5950
|
+
if (made.storageCreated) info(` object storage made for ${made.owner} in ${made.storage.region}: ${made.storage.sizeGib} GB for all its buckets, ${priceText(made.storage)}`);
|
|
5897
5951
|
info(` endpoint: ${endpointText(made.endpoint)} ${color.dim(`region ${made.region}, path-style`)}`);
|
|
5898
5952
|
info(color.dim(` next: kvbox bucket key create ${shown} (an access key for your app)`));
|
|
5899
5953
|
} finally {
|