@localctl/cli 0.5.0-beta.3 โ 0.5.0
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/README.md +32 -82
- package/package.json +3 -10
- package/schema/app.schema.json +678 -44
- package/src/commands/doctor.js +1 -16
- package/src/commands/down.js +3 -1
- package/src/commands/generateManifests.js +4 -0
- package/src/commands/logs.js +1 -0
- package/src/commands/new.js +42 -20
- package/src/commands/prune.js +4 -0
- package/src/commands/reload.js +11 -3
- package/src/commands/secrets.js +3 -3
- package/src/commands/setup.js +1 -11
- package/src/commands/tiltConfig.js +11 -0
- package/src/commands/uninstall.js +5 -6
- package/src/commands/up.js +9 -1
- package/src/commands/validate.js +48 -0
- package/src/index.js +2 -0
- package/src/lib/addonDirs.js +1 -2
- package/src/lib/addonLoader.js +38 -17
- package/src/lib/addons/mongo/addon.yaml +2 -0
- package/src/lib/addons/postgres/addon.yaml +5 -1
- package/src/lib/addons/redis/addon.yaml +2 -0
- package/src/lib/appSecrets.js +107 -36
- package/src/lib/clusterProvision.js +45 -211
- package/src/lib/configSchema.js +412 -41
- package/src/lib/engine.js +3 -13
- package/src/lib/envFile.js +58 -0
- package/src/lib/exec.js +6 -7
- package/src/lib/hostGuard.js +107 -0
- package/src/lib/hostsFile.js +9 -8
- package/src/lib/kubeErrors.js +22 -0
- package/src/lib/loadConfig.js +183 -9
- package/src/lib/manifestGen.js +96 -32
- package/src/lib/namespaces.js +83 -0
- package/src/lib/pathGuard.js +79 -0
- package/src/lib/paths.js +2 -6
- package/src/lib/podman.js +3 -93
- package/src/lib/projectContext.js +2 -2
- package/src/lib/quantities.js +20 -0
- package/src/lib/safeRead.js +41 -0
- package/src/lib/tiltConfig.js +25 -0
- package/src/lib/toolInstall.js +2 -141
- package/src/lib/yamlLoad.js +48 -0
- package/templates/Tiltfile.tmpl +22 -14
- package/src/lib/linuxDistro.js +0 -122
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ JSON file per app.
|
|
|
62
62
|
| ๐งฉ **One cluster, one CLI** | A single [k3d](https://k3d.io) cluster runs every app you develop. No per-project Kubernetes setup. |
|
|
63
63
|
| ๐ **A subdomain per app** | `orders.local.test`, `billing.local.test`, routed by Traefik. No `localhost:3000` vs `:3001`. |
|
|
64
64
|
| ๐ **HTTPS by default** | A locally-trusted wildcard certificate (via [mkcert](https://github.com/FiloSottile/mkcert)). Green padlock, no browser warnings. |
|
|
65
|
-
| ๐ **Config, not
|
|
65
|
+
| ๐ **Config, not manifests** | Each app has one `.local/config.yaml`. Every Kubernetes manifest is generated from it. |
|
|
66
66
|
| โก **Fast inner loop** | [Tilt](https://tilt.dev) builds, deploys, and live-syncs changed files into the running container. |
|
|
67
67
|
| ๐ **Debugger-friendly** | Debug ports forwarded to `localhost`. Node, Python, Go, Java and .NET patterns included. |
|
|
68
68
|
| ๐๏ธ **Databases in one line** | Postgres, Redis and MongoDB per app, from real Helm charts, with credentials injected as Secrets. |
|
|
@@ -73,15 +73,14 @@ JSON file per app.
|
|
|
73
73
|
|
|
74
74
|
| Requirement | Notes |
|
|
75
75
|
|---|---|
|
|
76
|
-
| **macOS
|
|
76
|
+
| **macOS** or **Windows** | Windows commands run in PowerShell. |
|
|
77
77
|
| **Node.js 18+** | Needed to install the CLI from npm. |
|
|
78
78
|
| **Container engine** | [Podman Desktop](https://podman-desktop.io/) (or Docker Desktop / Rancher Desktop), running. See [supported container engines](#supported-container-engines). |
|
|
79
|
-
| **Homebrew**
|
|
79
|
+
| **Homebrew** or **winget** | Used once by `localctl setup` to install missing tools. |
|
|
80
80
|
|
|
81
81
|
`localctl setup` installs `k3d`, `kubectl`, `tilt`, `mkcert` and `helm` for you if they're missing.
|
|
82
82
|
On Windows, Tilt isn't on winget, so it's downloaded from its GitHub release into
|
|
83
|
-
|
|
84
|
-
official release binaries into `~/.localctl/tools` (no sudo, no distro packages).
|
|
83
|
+
`~.localctl ools` and added to your user PATH.
|
|
85
84
|
|
|
86
85
|
### Supported container engines
|
|
87
86
|
|
|
@@ -90,69 +89,12 @@ official release binaries into `~/.localctl/tools` (no sudo, no distro packages)
|
|
|
90
89
|
| [Podman Desktop](https://podman-desktop.io/) | โ
Tested |
|
|
91
90
|
| [Docker Desktop](https://www.docker.com/products/docker-desktop/) | ๐งช Experimental โ setup and app deploy verified on Windows |
|
|
92
91
|
| [Rancher Desktop](https://rancherdesktop.io/) | ๐งช Experimental โ not yet tested |
|
|
93
|
-
| Docker Engine / native Podman (Linux) | ๐งช Experimental โ see [Linux](#linux-experimental) |
|
|
94
92
|
|
|
95
93
|
Experimental engines are detected and should work, since k3d only needs a Docker-compatible API,
|
|
96
94
|
but they haven't been through a full test cycle yet. `localctl setup` and `localctl doctor` print
|
|
97
95
|
a warning when one is in use. If you try one, please
|
|
98
96
|
[report how it went](https://github.com/psilvmoreira/localctl/issues/new).
|
|
99
97
|
|
|
100
|
-
### Required tools
|
|
101
|
-
|
|
102
|
-
What has to be on your machine **before** `localctl setup`, and what `setup` installs for you:
|
|
103
|
-
|
|
104
|
-
| | You install | `localctl setup` installs |
|
|
105
|
-
|---|---|---|
|
|
106
|
-
| **All platforms** | **Node.js 18+** (to install and run the CLI), a **container engine** | `k3d`, `kubectl`, `tilt`, `mkcert`, `helm` |
|
|
107
|
-
| **macOS** | [Homebrew](https://brew.sh) | via `brew` (plus `nss` for Firefox, optional) |
|
|
108
|
-
| **Windows** | `winget` (ships with Windows) | via `winget`, Tilt from its GitHub release |
|
|
109
|
-
| **Linux** | `curl` and `tar`, `sudo` (hosts file, CA trust) | downloaded as release binaries into `~/.localctl/tools` |
|
|
110
|
-
|
|
111
|
-
`localctl setup` needs administrator rights once, for the `*.local.test` hosts entry and the local
|
|
112
|
-
CA trust.
|
|
113
|
-
|
|
114
|
-
### Linux (experimental)
|
|
115
|
-
|
|
116
|
-
Linux support is **experimental**: the end-to-end suite passes on the distributions below, but
|
|
117
|
-
only in containers on arm64 (amd64 and bare-metal installs are untested), and `setup`/`doctor`
|
|
118
|
-
print a warning. It's published on the `beta` dist-tag:
|
|
119
|
-
|
|
120
|
-
```sh
|
|
121
|
-
npm install -g @localctl/cli@beta
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Targeted distributions, all with systemd and a mkcert-supported trust store:
|
|
125
|
-
|
|
126
|
-
| Family | Distributions | Docker Engine install |
|
|
127
|
-
|---|---|---|
|
|
128
|
-
| Debian | Ubuntu, Debian, Linux Mint, Pop!_OS | `localctl setup --install-docker` (Docker's official script) |
|
|
129
|
-
| Red Hat | Fedora, RHEL, Rocky, AlmaLinux, CentOS Stream | `localctl setup --install-docker` (Docker's official script on Fedora, Docker's CentOS repository elsewhere) |
|
|
130
|
-
| Arch | Arch, Manjaro, EndeavourOS | `localctl setup --install-docker` (`pacman`) |
|
|
131
|
-
| SUSE | openSUSE Leap/Tumbleweed | `localctl setup --install-docker` (`zypper`) |
|
|
132
|
-
|
|
133
|
-
Verified end to end (`npm run test:e2e:distros`, see [Contributing](docs/contributing.md)): Ubuntu
|
|
134
|
-
22.04 and 24.04, Debian 12, Fedora 41, Rocky 9, openSUSE Leap 15.6 and Arch Linux ARM. Derivatives
|
|
135
|
-
resolve through `ID_LIKE` in `/etc/os-release` (or `/usr/lib/os-release`) but were not run
|
|
136
|
-
themselves.
|
|
137
|
-
|
|
138
|
-
Other distributions (Alpine, Void, Gentoo, NixOS, immutable/atomic desktops) may work if you
|
|
139
|
-
bring Docker (or Podman) and Node.js yourself, but aren't targeted. WSL needs the Windows hosts
|
|
140
|
-
file edited too.
|
|
141
|
-
|
|
142
|
-
What's different on Linux:
|
|
143
|
-
|
|
144
|
-
- **Docker Engine** is the recommended engine (root daemon, nothing else to configure). If none is
|
|
145
|
-
running, `localctl setup --install-docker` installs it for the families above. It needs `sudo`,
|
|
146
|
-
and you must **log out and back in** afterwards so your user joins the `docker` group.
|
|
147
|
-
- **Podman** runs natively, no VM. The insecure-registry entry goes in
|
|
148
|
-
`~/.config/containers/registries.conf.d/` (no sudo, no restart). k3d needs Podman's API socket:
|
|
149
|
-
`systemctl --user enable --now podman.socket`. Rootless Podman also can't bind :80/:443 by
|
|
150
|
-
default: `sudo sysctl net.ipv4.ip_unprivileged_port_start=80`.
|
|
151
|
-
- **Firefox/Chromium trust** needs `certutil` (`libnss3-tools` on Debian/Ubuntu, `nss-tools` on
|
|
152
|
-
Fedora). `setup` prints the command for your distro; install it and re-run `mkcert -install`.
|
|
153
|
-
|
|
154
|
-
Hit a problem? [Open an issue](https://github.com/psilvmoreira/localctl/issues/new).
|
|
155
|
-
|
|
156
98
|
## Installation
|
|
157
99
|
|
|
158
100
|
```sh
|
|
@@ -231,7 +173,7 @@ self-contained shim in `~/.localctl/bin` and run `localctl setup` for you:
|
|
|
231
173
|
localctl app new
|
|
232
174
|
```
|
|
233
175
|
|
|
234
|
-
This asks for an app name and port, then creates `.local/config.
|
|
176
|
+
This asks for an app name and port, then creates `.local/config.yaml` and a `Tiltfile`.
|
|
235
177
|
|
|
236
178
|
**2. Deploy:**
|
|
237
179
|
|
|
@@ -304,7 +246,7 @@ Run `localctl <command> --help` for every option, or see the full
|
|
|
304
246
|
|
|
305
247
|
| Command | Description |
|
|
306
248
|
|---|---|
|
|
307
|
-
| `localctl app new` | Scaffold `.local/config.
|
|
249
|
+
| `localctl app new` | Scaffold `.local/config.yaml` and a `Tiltfile` in the current repository. |
|
|
308
250
|
| `localctl app up [-f]` | Build, deploy and live-reload the app. Background by default; `-f` for the Tilt UI. |
|
|
309
251
|
| `localctl app down` | Stop the dev loop and remove the app. Keeps its data. |
|
|
310
252
|
| `localctl app reload [-a <name>]` | Force a rebuild and redeploy without waiting for a file change. |
|
|
@@ -312,7 +254,7 @@ Run `localctl <command> --help` for every option, or see the full
|
|
|
312
254
|
| `localctl app logs [name] [-f]` | Show or follow an app's logs. Inside its repository the name is optional. |
|
|
313
255
|
| `localctl app exec [cmd...]` | Open a shell (default `sh`) in the app's pod. |
|
|
314
256
|
| `localctl app prune [-y]` | Delete leftover data (volumes, secrets) of apps already taken down. |
|
|
315
|
-
| `localctl app secrets set <KEY> [value]` | Store a secret as a Kubernetes Secret, never in `config.
|
|
257
|
+
| `localctl app secrets set <KEY> [value]` | Store a secret as a Kubernetes Secret, never in `config.yaml`. |
|
|
316
258
|
| `localctl app secrets list` / `show [KEY]` / `unset <KEY>` | List, reveal or remove secrets. |
|
|
317
259
|
|
|
318
260
|
</details>
|
|
@@ -332,20 +274,28 @@ Run `localctl <command> --help` for every option, or see the full
|
|
|
332
274
|
|
|
333
275
|
## Configuration
|
|
334
276
|
|
|
335
|
-
Everything about how an app runs locally lives in its `.local/config.
|
|
336
|
-
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
277
|
+
Everything about how an app runs locally lives in its `.local/config.yaml`:
|
|
278
|
+
|
|
279
|
+
```yaml
|
|
280
|
+
name: orders-api
|
|
281
|
+
subdomain: orders
|
|
282
|
+
port: 3000
|
|
283
|
+
build:
|
|
284
|
+
context: .
|
|
285
|
+
dockerfile: Dockerfile
|
|
286
|
+
env:
|
|
287
|
+
NODE_ENV: development
|
|
288
|
+
debug:
|
|
289
|
+
enabled: true
|
|
290
|
+
port: 9229
|
|
291
|
+
type: node
|
|
292
|
+
dependencies:
|
|
293
|
+
- type: postgres
|
|
294
|
+
database: orders
|
|
295
|
+
sync:
|
|
296
|
+
- localPath: ./src
|
|
297
|
+
remotePath: /app/src
|
|
298
|
+
tls: true
|
|
349
299
|
```
|
|
350
300
|
|
|
351
301
|
This deploys `orders-api` at `https://orders.local.test`, with its own Postgres instance and the
|
|
@@ -374,7 +324,7 @@ To add your own addon, see [**Adding tools**](https://psilvmoreira.github.io/loc
|
|
|
374
324
|
## How it works
|
|
375
325
|
|
|
376
326
|
```
|
|
377
|
-
.local/config.
|
|
327
|
+
.local/config.yaml โโโบ localctl โโโบ Kubernetes manifests โโโบ Tilt โโโบ k3d cluster
|
|
378
328
|
(your app repo) validates (generated, never builds, Traefik ingress
|
|
379
329
|
+ generates hand-written) pushes, + local registry
|
|
380
330
|
live-syncs + *.local.test TLS
|
|
@@ -393,7 +343,7 @@ The full documentation lives at **[psilvmoreira.github.io/localctl](https://psil
|
|
|
393
343
|
| [Getting started](https://psilvmoreira.github.io/localctl/getting-started/) | Install and first deploy, step by step |
|
|
394
344
|
| [Architecture](https://psilvmoreira.github.io/localctl/architecture/) | Every component, why it was chosen, multi-project support |
|
|
395
345
|
| [CLI commands](https://psilvmoreira.github.io/localctl/cli-reference/) | Every command and option |
|
|
396
|
-
| [Config schema](https://psilvmoreira.github.io/localctl/config-schema/) | Every `.local/config.
|
|
346
|
+
| [Config schema](https://psilvmoreira.github.io/localctl/config-schema/) | Every `.local/config.yaml` field |
|
|
397
347
|
| [Debugging](https://psilvmoreira.github.io/localctl/debugging/) | Attach a debugger in Node, Python, Go, Java and .NET |
|
|
398
348
|
| [Adding tools](https://psilvmoreira.github.io/localctl/adding-tools/) | Write your own per-app or cluster-wide addon |
|
|
399
349
|
| [Troubleshooting](https://psilvmoreira.github.io/localctl/troubleshooting/) | Known issues, with cause and fix |
|
|
@@ -458,7 +408,7 @@ localctl/
|
|
|
458
408
|
โ โโโ templates/ Tiltfile copied into apps by `localctl app new`
|
|
459
409
|
โ โโโ scripts/ packaging and test scripts
|
|
460
410
|
โโโ cluster/manifests/ cluster-level manifests (TLS store, addon namespace)
|
|
461
|
-
โโโ schema/ JSON Schema for .local/config.
|
|
411
|
+
โโโ schema/ JSON Schema for .local/config.yaml
|
|
462
412
|
โโโ examples/ ready-to-run sample apps
|
|
463
413
|
โโโ docs/ documentation pages (MkDocs Material, deployed to GitHub Pages)
|
|
464
414
|
โโโ overrides/ docs site template overrides (landing page)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@localctl/cli",
|
|
3
|
-
"version": "0.5.0
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "localctl - local Kubernetes dev platform CLI",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kubernetes",
|
|
@@ -35,10 +35,8 @@
|
|
|
35
35
|
"scripts": {
|
|
36
36
|
"sync-assets": "node scripts/sync-assets.js",
|
|
37
37
|
"prepack": "node scripts/sync-assets.js",
|
|
38
|
-
"test": "node scripts/smoke-test.js",
|
|
39
|
-
"test:pack": "node scripts/pack-test.js"
|
|
40
|
-
"test:e2e": "node scripts/e2e/run.js",
|
|
41
|
-
"test:e2e:distros": "node scripts/e2e/distros.js"
|
|
38
|
+
"test": "node scripts/smoke-test.js && node scripts/schema-check.js && node --test test/config.test.js",
|
|
39
|
+
"test:pack": "node scripts/pack-test.js"
|
|
42
40
|
},
|
|
43
41
|
"dependencies": {
|
|
44
42
|
"chalk": "^4.1.2",
|
|
@@ -50,11 +48,6 @@
|
|
|
50
48
|
"node": ">=18"
|
|
51
49
|
},
|
|
52
50
|
"localctl": {
|
|
53
|
-
"platforms": {
|
|
54
|
-
"darwin": "tested",
|
|
55
|
-
"win32": "tested",
|
|
56
|
-
"linux": "experimental"
|
|
57
|
-
},
|
|
58
51
|
"containerEngines": {
|
|
59
52
|
"podman": "tested",
|
|
60
53
|
"docker": "experimental",
|