influx-local-cli 0.1.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/LICENSE +21 -0
- package/README.md +265 -0
- package/bin/influx-local.js +5 -0
- package/package.json +42 -0
- package/src/cli.js +1092 -0
- package/src/config.js +349 -0
- package/src/manager.js +1794 -0
- package/src/versions.js +270 -0
- package/src/web.js +387 -0
- package/web/app.js +816 -0
- package/web/index.html +136 -0
- package/web/style.css +208 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 influx-local-cli contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# influx-local-cli
|
|
2
|
+
|
|
3
|
+
Create, start and manage local **InfluxDB** instances without Docker, Podman or
|
|
4
|
+
a system-wide InfluxDB install. Works in both a **CLI** and a **web dashboard**.
|
|
5
|
+
|
|
6
|
+
`influx-local-cli` follows the same UX as [mongo-local-cli](https://www.npmjs.com/package/mongo-local-cli)
|
|
7
|
+
and [pg-local-cli](https://www.npmjs.com/package/pg-local-cli): multiple named
|
|
8
|
+
instances, first-run setup wizard, one binary for everything.
|
|
9
|
+
|
|
10
|
+
- **Pick the InfluxDB version per instance** — `1.8.10`, `2.7.11`, `3.11.4`, …
|
|
11
|
+
each instance pins its own build and they run side by side.
|
|
12
|
+
- **No Docker/Podman** — the pinned build is installed through your existing
|
|
13
|
+
[mise](https://mise.jdx.dev) toolchain, which fetches the official tarball
|
|
14
|
+
from `dl.influxdata.com`.
|
|
15
|
+
- **Multiple instances** — `my_app`, `dev_db`, `default`, … each with its own
|
|
16
|
+
port, data dir, version and credentials.
|
|
17
|
+
- **Daemon** — `start` forks the server; it keeps running after you close the
|
|
18
|
+
terminal.
|
|
19
|
+
- **Managed credentials** — per line, in `creds.env` (mode 0600), rotatable:
|
|
20
|
+
- 1.x: an `admin` user (`ALL PRIVILEGES`) and an `app` user (`ALL` on the
|
|
21
|
+
database),
|
|
22
|
+
- 2.x: an operator user + all-access token, plus a bucket-scoped app token,
|
|
23
|
+
- 3.x: a single admin token (3 Core has no per-database scoping).
|
|
24
|
+
- **Web dashboard** — `influx-local web` opens a local UI for all instances:
|
|
25
|
+
status, start/stop/setup, secret rotation, connection DSNs, version picker,
|
|
26
|
+
live operation log.
|
|
27
|
+
- **Escape hatches** — `query` runs InfluxQL/Flux/SQL against the instance and
|
|
28
|
+
`shell` opens the 1.x REPL.
|
|
29
|
+
|
|
30
|
+
## Requirements
|
|
31
|
+
|
|
32
|
+
- Node.js ≥ 18
|
|
33
|
+
- [mise](https://mise.jdx.dev) on `PATH` (used to install/run InfluxDB)
|
|
34
|
+
- macOS / Linux (x64 or arm64). Windows is not supported: InfluxData publishes
|
|
35
|
+
no Windows artifacts for these lines through mise's http backend.
|
|
36
|
+
|
|
37
|
+
## Install
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g influx-local-cli
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The binary is `influx-local`.
|
|
44
|
+
|
|
45
|
+
## Quick start
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
influx-local create my_app # wizard: version, port, database, users → creds
|
|
49
|
+
influx-local setup my_app # installs that version, provisions it, starts the server
|
|
50
|
+
influx-local status my_app # health, running version, measurements, DSNs
|
|
51
|
+
influx-local list # all instances and their state (alias: ls)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
That's it: you have a local InfluxDB with managed credentials. Data lives in
|
|
55
|
+
`~/.influx-local/instances/<name>/`.
|
|
56
|
+
|
|
57
|
+
## Choosing the InfluxDB version
|
|
58
|
+
|
|
59
|
+
The version is a first-class property of an instance: it decides the binaries,
|
|
60
|
+
daemon flags, auth model, storage layout and credentials that the tool manages.
|
|
61
|
+
It can be set when the instance is created and inspected/changed afterwards.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
influx-local versions # catalog, grouped by line (1.x / 2.x / 3.x)
|
|
65
|
+
influx-local versions --json # machine readable
|
|
66
|
+
influx-local create metrics -v 2.7.11 # pin 2.x explicitly
|
|
67
|
+
influx-local create dev -v 1.x # line alias → newest 1.x (1.8.10)
|
|
68
|
+
influx-local config show metrics # what is pinned now
|
|
69
|
+
influx-local config set metrics version 2.9.1
|
|
70
|
+
influx-local install metrics # (re)install the pinned build through mise
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
On an interactive terminal `create` also offers an arrow-key picker containing
|
|
74
|
+
every catalog version plus an “enter another published version…” entry, so any
|
|
75
|
+
version InfluxData publishes can be pinned (it is validated against
|
|
76
|
+
`dl.influxdata.com` when installed).
|
|
77
|
+
|
|
78
|
+
Catalog (verified to exist on `dl.influxdata.com`):
|
|
79
|
+
|
|
80
|
+
| Line | Auth | Versions | Default |
|
|
81
|
+
| --- | --- | --- | --- |
|
|
82
|
+
| InfluxDB 1.x (InfluxQL) | HTTP basic (users) | 1.7.11, 1.8.0, 1.8.4, 1.8.6, 1.8.9, 1.8.10 | 1.8.10 |
|
|
83
|
+
| InfluxDB 2.x (Flux) | API token | 2.7.3, 2.7.5, 2.7.7, 2.7.9, 2.7.10, 2.7.11, 2.8.0, 2.9.0, 2.9.1 | 2.7.11 |
|
|
84
|
+
| InfluxDB 3 Core (SQL) | API token | 3.0.0, 3.0.3, 3.3.0, 3.4.0, 3.9.0, 3.10.0, 3.10.6, 3.11.2, 3.11.3, 3.11.4 | 3.11.4 |
|
|
85
|
+
|
|
86
|
+
The default pinned version is **1.8.10**: the 1.x line is the closest match to
|
|
87
|
+
the mongo-local-cli model (two users, one database scoped app user, a REPL).
|
|
88
|
+
|
|
89
|
+
InfluxDB’s lines are **not** data-compatible. Changing the version within a line
|
|
90
|
+
is fine; changing the line (1.x ↔ 2.x ↔ 3.x) is refused once the instance has
|
|
91
|
+
data — create a new instance instead.
|
|
92
|
+
|
|
93
|
+
## Commands
|
|
94
|
+
|
|
95
|
+
| Command | Description |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `versions` | List every installable InfluxDB version (grouped by line). `-f/--flavor 1\|2\|3`, `-j/--json`. |
|
|
98
|
+
| `create [name]` | Create a stopped instance with a pinned version + credentials (`-v/--influxdb`, `--port`, `--host`, `--database`, `--measurement`, `--org`, `--admin-user`, `--app-user`, `--admin-password`, `--app-password`); interactive wizard on a terminal. |
|
|
99
|
+
| `setup [name]` (alias `bootstrap`) | Install the pinned version if missing, provision credentials/database, start the server. Repairs a running instance **online** (no restart) when its credentials are valid. |
|
|
100
|
+
| `start [name]` | Start the daemon (auto-installs the pinned version when missing). |
|
|
101
|
+
| `stop [name]` | Graceful stop (`-f/--force` to kill). |
|
|
102
|
+
| `restart [name]` | Stop + start. |
|
|
103
|
+
| `status [name]` (alias `ps`) | Health, flavors, running version, measurements, DSNs. `-j/--json`, `-s/--show-secrets`. |
|
|
104
|
+
| `list` (alias `ls`) | All instances with state/version/port. `-j/--json`. |
|
|
105
|
+
| `rename <name> <newName>` | Rename an instance (must be stopped first). |
|
|
106
|
+
| `clone <name> <newName>` (alias `duplicate`) | Copy config + credentials to a new name (`-p/--port` optional; next free port by default). |
|
|
107
|
+
| `set-password <name>` | Set an explicit password (`--user admin\|app`, `-p/--password`). 1.x applies live; 2.x only for the operator user. |
|
|
108
|
+
| `users [name]` | List users/tokens (managed + server-side) with their scopes. |
|
|
109
|
+
| `user-add <name> <username>` | Create a user (`-p/--password`, 1.x: `--db admin\|database`, `--privileges read,write,all`). |
|
|
110
|
+
| `user-password <name> <username>` | Set a user's password (`-p/--password`). |
|
|
111
|
+
| `user-rm <name> <username>` | Delete a user; the managed users are protected. |
|
|
112
|
+
| `rotate [name]` | Rotate the managed secrets on the running server and verify them (`--admin` / `--app`). |
|
|
113
|
+
| `query [name] [statement]` | One statement: InfluxQL (1.x), Flux (2.x), SQL (3.x). Reads stdin when omitted. `--admin` uses the admin credential. |
|
|
114
|
+
| `logs [name]` | Server log tail (`-f` to follow, `-n/--lines`). |
|
|
115
|
+
| `shell [name]` | Authenticated 1.x `influx` REPL (append args after `--`). `--admin` for the admin user. |
|
|
116
|
+
| `install [name]` | Install the pinned version through mise (idempotent). |
|
|
117
|
+
| `config show [name]` / `config set <name> <key> <value>` | View/edit configuration. |
|
|
118
|
+
| `doctor [name]` | Environment + instance diagnostics. `-j/--json`. |
|
|
119
|
+
| `web` | Start the web dashboard (`-H/--host`, `-p/--port`, `-t/--token`). |
|
|
120
|
+
| `destroy [name]` (alias `rm`) | Stop and delete ALL instance data (`-y/--yes` for scripts). |
|
|
121
|
+
|
|
122
|
+
Every instance-targeting command accepts either a positional name
|
|
123
|
+
(`influx-local status my_app`) or `-n/--instance my_app`.
|
|
124
|
+
|
|
125
|
+
When you run a command without a name and have several instances, an
|
|
126
|
+
interactive picker (↑/↓ + Enter) asks which one to use. One instance → it is
|
|
127
|
+
used directly; none → `default`. Non-interactive shells fall back to `default`.
|
|
128
|
+
|
|
129
|
+
### Config keys
|
|
130
|
+
|
|
131
|
+
`version` (pinned InfluxDB version), `port`, `host` (bind IP), `database`
|
|
132
|
+
(1.x/3.x database, 2.x bucket), `measurement` (1.x/3.x sample measurement),
|
|
133
|
+
`org` (2.x), `adminUser`, `appUser` (1.x), `publicHost` (advertised in DSNs).
|
|
134
|
+
|
|
135
|
+
## Connection details
|
|
136
|
+
|
|
137
|
+
`status` prints DSNs with masked secrets by default (secrets never land in your
|
|
138
|
+
terminal/logs unless you pass `--show-secrets`):
|
|
139
|
+
|
|
140
|
+
| Line | App DSN | Admin DSN |
|
|
141
|
+
| --- | --- | --- |
|
|
142
|
+
| 1.x | `influxdb://app:<pw>@127.0.0.1:8086/<db>` | `influxdb://admin:<pw>@127.0.0.1:8086` |
|
|
143
|
+
| 2.x | `influxdb2://<app-token>@127.0.0.1:8086?org=<org>&bucket=<db>` | `influxdb2://<all-access-token>@127.0.0.1:8086?org=<org>` |
|
|
144
|
+
| 3.x | `influxdb3://<admin-token>@127.0.0.1:8181/<db>` | — (the token is the credential) |
|
|
145
|
+
|
|
146
|
+
The `influxdb*://` scheme is this tool's display format (InfluxDB itself has no
|
|
147
|
+
DSN scheme); the endpoint, user/token, database/bucket/org in it are exactly
|
|
148
|
+
what a client needs.
|
|
149
|
+
|
|
150
|
+
## What maps to what
|
|
151
|
+
|
|
152
|
+
If you are porting an app from mongo-local-cli, the concepts line up like this:
|
|
153
|
+
|
|
154
|
+
| mongo-local-cli | InfluxDB 1.x | InfluxDB 2.x | InfluxDB 3 Core |
|
|
155
|
+
| --- | --- | --- | --- |
|
|
156
|
+
| `mongosh` REPL | `shell` (`influx`) | — (use `query`) | — (use `query`) |
|
|
157
|
+
| admin user (`root`) | `admin` (`ALL PRIVILEGES`) | operator user | admin token |
|
|
158
|
+
| app user (`readWrite`) | `app` (`ALL` on one database) | bucket-scoped token | — |
|
|
159
|
+
| database | database | bucket | database |
|
|
160
|
+
| collection | measurement | measurement | table |
|
|
161
|
+
| password rotation | `SET PASSWORD` | token re-issue | not possible (see below) |
|
|
162
|
+
|
|
163
|
+
## Web dashboard
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
influx-local web
|
|
167
|
+
# → http://127.0.0.1:8788
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Expose it on your LAN with a token — the panel can start/stop instances, rotate
|
|
171
|
+
secrets and destroy data, so a non-loopback bind **requires** `--token`
|
|
172
|
+
(refused otherwise):
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
influx-local web --host 0.0.0.0 --port 8788 --token <secret>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The “+ New” dialog contains the version picker (grouped by line, with the auth
|
|
179
|
+
model and default port shown), so instances can be created with the right
|
|
180
|
+
InfluxDB version straight from the browser. Operations run one at a time;
|
|
181
|
+
progress streams into the operation log.
|
|
182
|
+
|
|
183
|
+
## How it works / storage
|
|
184
|
+
|
|
185
|
+
- Config per instance: `~/.influx-local/instances/<name>/config.json`
|
|
186
|
+
- Toolchain per instance: `~/.influx-local/instances/<name>/.mise.toml`
|
|
187
|
+
(pins the version and the exact tarball URL)
|
|
188
|
+
- Data: `~/.influx-local/instances/<name>/data/`
|
|
189
|
+
- Secrets: `~/.influx-local/instances/<name>/creds.env` (0600)
|
|
190
|
+
- Daemon pid / logs: `<influxd|influxdb3>.pid`, `<influxd|influxdb3>.log`
|
|
191
|
+
- 2.x CLI client config is kept inside the instance dir
|
|
192
|
+
(`influx-cli-configs`), never in `~/.influxdbv2`.
|
|
193
|
+
- `influx-local web` shares the same storage, so CLI and web interoperate.
|
|
194
|
+
- Override the base dir with `INFLUX_LOCAL_HOME` and the mise executable with
|
|
195
|
+
`INFLUX_LOCAL_MISE` (used by the test suite).
|
|
196
|
+
|
|
197
|
+
### Why mise needs a custom tool declaration
|
|
198
|
+
|
|
199
|
+
InfluxData publishes server tarballs on `dl.influxdata.com`; the GitHub releases
|
|
200
|
+
for these tags carry **no assets**, so mise's `github:`/`ubi` backends cannot
|
|
201
|
+
install `influxd`. Each instance therefore carries a tiny `.mise.toml` that
|
|
202
|
+
declares a generic `http:` tool with the versioned URL, e.g.:
|
|
203
|
+
|
|
204
|
+
```toml
|
|
205
|
+
[tools]
|
|
206
|
+
"http:influxdb-1x" = { version = "1.8.10", url = "https://dl.influxdata.com/influxdb/releases/influxdb-{{ version }}_linux_amd64.tar.gz", strip_components = "1", bin_path = "usr/bin" }
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
`setup`/`install` run `mise install` against that file and resolve the resulting
|
|
210
|
+
binaries through `mise where`, so several versions can be installed side by side.
|
|
211
|
+
Every mise call is made with `MISE_CEILING_PATHS`/`MISE_TRUSTED_CONFIG_PATHS`
|
|
212
|
+
set to the instance directory: mise otherwise walks *up* the tree and aborts with
|
|
213
|
+
`Config files ... are not trusted` as soon as an unrelated `.mise.toml` exists in
|
|
214
|
+
`$HOME` (or any parent), and it would also silently pick up a project toolchain
|
|
215
|
+
that has nothing to do with this instance.
|
|
216
|
+
|
|
217
|
+
### Per-line provisioning
|
|
218
|
+
|
|
219
|
+
- **1.x** — users can only be created while authentication is off, so `setup`
|
|
220
|
+
starts a short-lived unauthenticated server bound to `127.0.0.1`, runs the
|
|
221
|
+
InfluxQL `CREATE USER`/`GRANT`/`CREATE DATABASE` statements, then restarts
|
|
222
|
+
with `auth-enabled = true`.
|
|
223
|
+
- **2.x** — there is no unauthenticated window: `influx setup` is the only way
|
|
224
|
+
in and is refused once the instance is onboarded. Credentials are an operator
|
|
225
|
+
user + all-access token plus a bucket-scoped app token; a missing app token is
|
|
226
|
+
re-issued (and stale ones deleted) on every `setup`.
|
|
227
|
+
- **3.x** — a single binary (`influxdb3 serve`). The admin token is minted once
|
|
228
|
+
by the server, so it is written to `creds.env` and reused; the database and
|
|
229
|
+
the initial table are created afterwards.
|
|
230
|
+
|
|
231
|
+
## Known limitations
|
|
232
|
+
|
|
233
|
+
- **3 Core tokens cannot be rotated in place.** InfluxDB refuses to create a
|
|
234
|
+
second `_admin` token, and starting the server with `--without-auth` disables
|
|
235
|
+
the token endpoints (HTTP 405). `rotate` therefore refuses for 3.x and tells
|
|
236
|
+
you to recreate the instance. 1.x and 2.x rotate normally.
|
|
237
|
+
- **2.x `set-password --user app`** is refused: 2.x scopes access with tokens,
|
|
238
|
+
not users. Use `rotate --app` to replace the app token instead.
|
|
239
|
+
- **1.x passes passwords as CLI flags** (`influx -username … -password …`),
|
|
240
|
+
which is visible to other local users via `ps` — the same exposure
|
|
241
|
+
mongo-local-cli has with its `mongosh` connection URIs. The 1.x CLI has no
|
|
242
|
+
environment-variable equivalent.
|
|
243
|
+
- No user management on 3.x (tokens only), and `shell` exists only for 1.x
|
|
244
|
+
(2.x and 3.x CLIs have no REPL) — use `query`.
|
|
245
|
+
- 1.8.10 is the last upstream 1.x OSS release; the 1.x line is supported here
|
|
246
|
+
because it maps most directly onto the classic user/role model.
|
|
247
|
+
|
|
248
|
+
## Development
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
npm install
|
|
252
|
+
npm test
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
The unit tests cover the version catalog (URL/bin-path per line, catalog
|
|
256
|
+
integrity) and the credential schema; they need no network and no InfluxDB
|
|
257
|
+
install. For an end-to-end check, create an instance and run `setup` — that is
|
|
258
|
+
the path CI cannot cover without downloading InfluxDB.
|
|
259
|
+
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
MIT — see [LICENSE](LICENSE).
|
|
263
|
+
|
|
264
|
+
`web/style.css` is reused from [mongo-local-cli](https://www.npmjs.com/package/mongo-local-cli)
|
|
265
|
+
(MIT), which this tool models its UX on.
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "influx-local-cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Create, start and manage local InfluxDB instances (1.x / 2.x / 3.x) without Docker/Podman. CLI + Web dashboard, powered by mise.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"influxdb",
|
|
7
|
+
"influx",
|
|
8
|
+
"local",
|
|
9
|
+
"cli",
|
|
10
|
+
"web",
|
|
11
|
+
"database",
|
|
12
|
+
"time-series",
|
|
13
|
+
"influxql",
|
|
14
|
+
"flux",
|
|
15
|
+
"mise",
|
|
16
|
+
"without-docker",
|
|
17
|
+
"development"
|
|
18
|
+
],
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"bin": {
|
|
21
|
+
"influx-local": "bin/influx-local.js"
|
|
22
|
+
},
|
|
23
|
+
"main": "src/manager.js",
|
|
24
|
+
"files": [
|
|
25
|
+
"bin",
|
|
26
|
+
"src",
|
|
27
|
+
"web",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"test": "node --test test/catalog.test.js test/creds.test.js",
|
|
33
|
+
"start": "node bin/influx-local.js web"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=18.0.0"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"commander": "^12.1.0",
|
|
40
|
+
"express": "^4.21.2"
|
|
41
|
+
}
|
|
42
|
+
}
|