insta 0.0.29 → 0.0.30
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/commands/compute.js +16 -8
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/commands/compute.js
CHANGED
|
@@ -116,23 +116,32 @@ export function parseCpu(raw) {
|
|
|
116
116
|
throw new Error(`invalid cpu: ${raw} (provider sizes: ${CPU_SIZES.join(', ')})`);
|
|
117
117
|
return n;
|
|
118
118
|
}
|
|
119
|
-
// ---- volume (the persistent /data disk; attach
|
|
119
|
+
// ---- volume (the persistent /data disk; attach any time, grow-only, never detach) ----
|
|
120
120
|
// Render the volume read. Pure, exported for tests (mirrors serviceListLine). Every plan may view;
|
|
121
121
|
// only growth is paid — that gate is the backend's to enforce, so nothing here pre-blocks.
|
|
122
122
|
export function volumeLines(name, volume, cap) {
|
|
123
123
|
if (!volume)
|
|
124
124
|
return [
|
|
125
|
-
`compute ${name}: no volume attached (attach
|
|
125
|
+
`compute ${name}: no volume attached (attach one: \`insta compute volume ${name} --size <gi>\` — it mounts at /data on the next deploy)`,
|
|
126
126
|
];
|
|
127
127
|
return [
|
|
128
128
|
`compute ${name}: volume ${volume.sizeGib}Gi at ${volume.mountPath} (plan max ${cap.volumeGib}Gi)`,
|
|
129
129
|
' billing is actual data stored — the size is a cap, not a price; grow with --size (grow-only)',
|
|
130
130
|
];
|
|
131
131
|
}
|
|
132
|
-
//
|
|
133
|
-
//
|
|
134
|
-
//
|
|
135
|
-
|
|
132
|
+
// Render the PUT result. Pure, exported for tests. `attached` comes from the backend and is what
|
|
133
|
+
// tells a FIRST attach (no disk yet — it mounts on the next deploy) apart from a grow (the live
|
|
134
|
+
// disk was already extended); the wire size is authoritative in both cases.
|
|
135
|
+
export function volumeWriteLine(name, body) {
|
|
136
|
+
if (body.attached) {
|
|
137
|
+
return `compute ${name}: volume ${body.volume.sizeGib}Gi attached — mounts at ${body.volume.mountPath} on the next deploy (plan max ${body.cap.volumeGib}Gi)`;
|
|
138
|
+
}
|
|
139
|
+
return `compute ${name}: volume grown to ${body.volume.sizeGib}Gi at ${body.volume.mountPath} (plan max ${body.cap.volumeGib}Gi)`;
|
|
140
|
+
}
|
|
141
|
+
// Show, attach, or grow a compute service's /data volume. No --size: a safe read (size + mount
|
|
142
|
+
// path + the plan cap). --size: PUT .../volume — attaches when no volume exists, grows otherwise.
|
|
143
|
+
// The paid/cap/machine-count gates all belong to the backend, whose 403/400 messages carry the
|
|
144
|
+
// upgrade hints and must reach the user verbatim (the guard prints ApiError messages as-is).
|
|
136
145
|
export async function computeVolume(serviceName, opts) {
|
|
137
146
|
const api = await ApiClient.load();
|
|
138
147
|
const p = await requireProject();
|
|
@@ -153,8 +162,7 @@ export async function computeVolume(serviceName, opts) {
|
|
|
153
162
|
return;
|
|
154
163
|
if (opts.json)
|
|
155
164
|
return printJson(res.body);
|
|
156
|
-
|
|
157
|
-
info(`compute ${res.body.service?.name ?? serviceName ?? id}: volume grown to ${v.sizeGib}Gi at ${v.mountPath} (plan max ${res.body.cap.volumeGib}Gi)`);
|
|
165
|
+
info(volumeWriteLine(res.body.service?.name ?? serviceName ?? id, res.body));
|
|
158
166
|
}
|
|
159
167
|
// Show or set a compute service's ceiling. With no --memory it PRINTS the current limits and the
|
|
160
168
|
// plan cap (so `insta compute limits` is a safe read), which is also what a UI renders as a slider
|
package/dist/index.js
CHANGED
|
@@ -115,7 +115,7 @@ svc.command('add <type> <name>').description('Provision a service on demand (ass
|
|
|
115
115
|
.option('--image <url>', 'compute only: run this container image at creation')
|
|
116
116
|
.option('--port <n>', 'compute only: port the image listens on (default 8080)')
|
|
117
117
|
.option('--always-on', 'compute only: create as always-on — never scales to zero (all plans; billing is actual usage either way)')
|
|
118
|
-
.option('--volume <gi>', 'compute only: attach a persistent /data volume of this many whole Gi (
|
|
118
|
+
.option('--volume <gi>', 'compute only: attach a persistent /data volume of this many whole Gi (also attachable later: `insta compute volume <name> --size <gi>`; any plan may attach at the default 1; larger sizes are paid and plan-capped). Volume services keep 1 machine and stop (cold wake) instead of suspend when idle')
|
|
119
119
|
.action(guard((type, name, o) => services.servicesAdd(type, name, o)));
|
|
120
120
|
svc.command('list').option('--json').option('--branch <branch>', 'branch (default: current)')
|
|
121
121
|
.action(guard((o) => services.servicesList(o)));
|
|
@@ -171,7 +171,7 @@ compute.command('limits [service]').description("Show or set a compute service's
|
|
|
171
171
|
.option('--json').option('--branch <branch>', 'branch (default: current)').action(guard((service, o) => computeCmd.computeLimits(service, o)));
|
|
172
172
|
compute.command('always-on <mode> [service]').description('Set a compute service always-on (mode: on|off). on = machines never scale to zero; off = default scale-to-zero. All plans; billing is actual usage either way')
|
|
173
173
|
.option('--json').option('--branch <branch>', 'branch (default: current)').action(guard((mode, service, o) => computeCmd.computeAlwaysOn(mode, service, o)));
|
|
174
|
-
compute.command('volume [service]').description("Show or grow a compute service's persistent /data volume. No --size: print size, mount path, and the plan cap (any plan). --size
|
|
174
|
+
compute.command('volume [service]').description("Show, attach, or grow a compute service's persistent /data volume. No --size: print size, mount path, and the plan cap (any plan). --size on a volumeless service ATTACHES one (any plan at the default 1Gi; larger is paid and plan-capped; the disk mounts at /data on the next deploy); on a volume-bearing one it grows (paid plans; grow-only — a provisioned disk cannot shrink). Billing is actual data stored — the size is a cap, not a price")
|
|
175
175
|
.option('--size <gi>', 'new size in whole Gi, e.g. 10 (must be ≥ the current size)')
|
|
176
176
|
.option('--json').option('--branch <branch>', 'branch (default: current)').action(guard((service, o) => computeCmd.computeVolume(service, o)));
|
|
177
177
|
// ---- db (postgres service controls) ----
|