@zhqi9277/marina-db 0.0.0-stage → 0.1.1
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 +219 -2
- package/README.zh-CN.md +737 -0
- package/assets/logo.png +0 -0
- package/assets/logo.svg +7 -0
- package/bin/marina +14 -0
- package/bin/marina.js +19 -0
- package/package.json +53 -4
- package/src/cli.js +677 -0
- package/src/core/env.js +59 -0
- package/src/core/paths.js +90 -0
- package/src/core/platform.js +64 -0
- package/src/core/project.js +32 -0
- package/src/core/registry.js +167 -0
- package/src/core/state.js +257 -0
- package/src/engines/_local_http.js +47 -0
- package/src/engines/_mysql_family.js +276 -0
- package/src/engines/mariadb.js +14 -0
- package/src/engines/memcached.js +72 -0
- package/src/engines/milvus.js +67 -0
- package/src/engines/mongodb.js +91 -0
- package/src/engines/mysql.js +13 -0
- package/src/engines/postgres.js +134 -0
- package/src/engines/qdrant.js +39 -0
- package/src/engines/redis.js +127 -0
- package/src/host/darwin.js +74 -0
- package/src/host/define.js +38 -0
- package/src/host/escape.js +19 -0
- package/src/host/fs.js +33 -0
- package/src/host/index.js +16 -0
- package/src/host/linux.js +57 -0
- package/src/host/match.js +72 -0
- package/src/host/openharmony.js +21 -0
- package/src/host/posix.js +76 -0
- package/src/host/win32.js +149 -0
- package/src/install/archive.js +142 -0
- package/src/install/catalog.js +20 -0
- package/src/install/download.js +172 -0
- package/src/install/installer.js +311 -0
- package/src/install/libcheck.js +63 -0
- package/src/install/overlay.js +70 -0
- package/src/install/versions.js +43 -0
- package/src/runtime/autostart.js +131 -0
- package/src/runtime/config.js +25 -0
- package/src/runtime/doctor.js +79 -0
- package/src/runtime/instance-lock.js +64 -0
- package/src/runtime/inventory.js +81 -0
- package/src/runtime/lifecycle.js +444 -0
- package/src/runtime/settings.js +184 -0
- package/src/runtime/shims.js +55 -0
- package/src/tui/app.js +446 -0
- package/src/tui/draw.js +140 -0
- package/src/tui/input.js +294 -0
- package/src/tui/screen.js +82 -0
- package/src/tui/views.js +391 -0
- package/src/ui/console.js +129 -0
- package/src/update.js +112 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zhqi9277 <zhqi9277@qq.com>
|
|
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
CHANGED
|
@@ -1,3 +1,220 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="./assets/logo.png" alt="Marina logo" width="96">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">Marina</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">Install, switch, and run local databases from one CLI.</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<strong>English</strong> · <a href="./README.zh-CN.md" lang="zh-CN">简体中文</a>
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<a href="https://github.com/zhqi9277/marina-db">GitHub</a> ·
|
|
15
|
+
<a href="https://gitee.com/zhqi9277/marina">Gitee</a> ·
|
|
16
|
+
<a href="https://cnb.cool/zhqi9277/marina">CNB</a> ·
|
|
17
|
+
Hosted in China on <a href="https://atomgit.com/zhqi92771/marina">AtomGit</a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
Marina manages eight local database engines for development, covering SQL, document and key-value storage, caching, and vector search. It installs prebuilt packages, keeps multiple versions side by side, and gives you a keyboard-driven terminal dashboard for everyday operations.
|
|
21
|
+
|
|
22
|
+
[Supported databases](#supported-databases) · [Quick start](#quick-start) · [Supported platforms](#supported-platforms) · [Command reference](#command-reference) · [Development](#development)
|
|
23
|
+
|
|
24
|
+
## Supported databases
|
|
25
|
+
|
|
26
|
+
| Engine | Type | CLI name | Default port | Published versions (examples) |
|
|
27
|
+
| --- | --- | --- | --- | --- |
|
|
28
|
+
| MySQL | SQL | `mysql` | 3306 | 5.6.51, 5.7.44, 8.4.13 |
|
|
29
|
+
| MariaDB | SQL | `mariadb` | 3307 | 10.6.28, 10.11.20, 11.4.14 |
|
|
30
|
+
| PostgreSQL | SQL | `postgres` | 5432 | 14.25, 17.12, 18.7 |
|
|
31
|
+
| MongoDB | Document | `mongodb` | 27017 | 6.0.30, 7.0.48, 8.0.38 |
|
|
32
|
+
| Redis | Key-value | `redis` | 6379 | 6.2.24, 7.4.12, 8.6.7 |
|
|
33
|
+
| Memcached | Cache | `memcached` | 11211 | 1.5.22, 1.6.8, 1.6.45 |
|
|
34
|
+
| Qdrant | Vector | `qdrant` | 6333 | 1.20.2 |
|
|
35
|
+
| Milvus Standalone | Vector | `milvus` | 19530 | 3.0.6 |
|
|
36
|
+
|
|
37
|
+
Run `marina remote` for an overview or `marina remote <db>` for the full list of published builds for your operating system and architecture. [Published catalog](https://github.com/zhqi9277/marina-db/blob/engine-catalog/manifest.json) · [Engine packages](https://github.com/zhqi9277/marina-db/releases)
|
|
38
|
+
|
|
39
|
+
## Quick start
|
|
40
|
+
|
|
41
|
+
You'll need Node.js **18.17 or newer** and `tar` on your PATH. Install Marina from npm, then install Redis 7, start it, and check the connection.
|
|
42
|
+
|
|
43
|
+
On a HarmonyOS PC, follow the [experimental build and installation steps](#experimental-harmonyos-pc-support).
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install -g @zhqi9277/marina-db
|
|
47
|
+
|
|
48
|
+
marina remote redis
|
|
49
|
+
marina install redis@7
|
|
50
|
+
marina start redis@7
|
|
51
|
+
marina exec redis@7 -- ping
|
|
52
|
+
# PONG
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
To try Marina without installing it, run `npx @zhqi9277/marina-db remote redis`. Marina verifies the downloaded package and prepares the instance during installation. Use `start` to run the service and `stop` when you're done.
|
|
56
|
+
|
|
57
|
+
### Run from a Git checkout
|
|
58
|
+
|
|
59
|
+
To work on Marina or follow `main`, clone the repository and run it with Node.js. You'll also need Git.
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
git clone https://github.com/zhqi9277/marina-db.git
|
|
63
|
+
cd marina-db
|
|
64
|
+
node bin/marina.js remote redis
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Run `npm link` from the checkout to use `marina` as a command. On macOS and Linux, you can also install the launcher into `~/.local/bin`.
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
sh scripts/install-cli.sh
|
|
71
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
72
|
+
marina --version
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
When running from a checkout without a launcher, use `node bin/marina.js` for any example that starts with `marina`.
|
|
76
|
+
|
|
77
|
+
### Run a vector database locally
|
|
78
|
+
|
|
79
|
+
```sh
|
|
80
|
+
marina remote qdrant
|
|
81
|
+
marina install qdrant@1
|
|
82
|
+
marina start qdrant@1
|
|
83
|
+
curl -fsS http://127.0.0.1:6333/readyz
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
For Milvus Standalone, check `marina remote milvus`, then install and start `milvus@3` on a supported machine. Milvus uses embedded etcd and local storage.
|
|
87
|
+
|
|
88
|
+
Both engines serve HTTP on loopback by default. Press `y` in the dashboard to see the connection URL. To enable Qdrant's separate gRPC port, use `marina config qdrant` to locate the configuration file and set `service.grpc_port`.
|
|
89
|
+
|
|
90
|
+
### Update the CLI
|
|
91
|
+
|
|
92
|
+
For an npm installation, run `npm update -g @zhqi9277/marina-db`. For a Git checkout:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
marina update --check # Compare your commit with GitHub main
|
|
96
|
+
marina update # Fast-forward the checkout used by Marina
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The updater works with a Git checkout, including installations created with `scripts/install-cli.sh` or `npm link`. It updates a clean local `main` from the official GitHub repository, keeping your Git remote settings, database data, and running services in place. Add `--json` for the full commit IDs.
|
|
100
|
+
|
|
101
|
+
If your installed checkout predates the command, run `git pull --ff-only https://github.com/zhqi9277/marina-db.git main` once from that checkout. For packages installed from npm, use npm to upgrade.
|
|
102
|
+
|
|
103
|
+
## Terminal dashboard
|
|
104
|
+
|
|
105
|
+
Run `marina` in an interactive terminal. Select a database to see its active version, running state, port, and connection details.
|
|
106
|
+
|
|
107
|
+
| Key | Action |
|
|
108
|
+
| --- | --- |
|
|
109
|
+
| `↑` / `↓` | Select a database or version |
|
|
110
|
+
| `Enter` | Open actions or select a version |
|
|
111
|
+
| `v` | Fetch available versions and open the version picker |
|
|
112
|
+
| `g` | Fetch the latest catalog while the version picker is open |
|
|
113
|
+
| `s` / `x` / `r` | Start, stop, or restart the selected instance |
|
|
114
|
+
| `l` / `d` | Open logs or diagnostics |
|
|
115
|
+
| `?` / `q` | Show keyboard help or quit from the dashboard |
|
|
116
|
+
|
|
117
|
+
## Supported platforms
|
|
118
|
+
|
|
119
|
+
| Platform | Architectures | Build and test environment |
|
|
120
|
+
| --- | --- | --- |
|
|
121
|
+
| macOS | Apple Silicon (ARM64), Intel (x64) | macOS 15 |
|
|
122
|
+
| Linux | x64, ARM64 | Ubuntu 22.04 |
|
|
123
|
+
| Windows | x64 | Windows Server 2022 |
|
|
124
|
+
|
|
125
|
+
Published builds vary by engine and version. Qdrant has builds for all five targets in the table. Milvus Standalone 3.0.6 is available on Linux x64 and macOS Apple Silicon. The catalog also includes native Apple Silicon builds of MySQL 5.6.51 and 5.7.44.
|
|
126
|
+
|
|
127
|
+
Set `MARINA_CATALOG_URL` to use another remote catalog or `MARINA_CATALOG_FILE` to read a local manifest.
|
|
128
|
+
|
|
129
|
+
### Experimental HarmonyOS PC support
|
|
130
|
+
|
|
131
|
+
The `main` branch includes native CLI support for ARM64 HarmonyOS PCs using DevEco's Node.js (`openharmony/arm64`). Redis 7.4.11, PostgreSQL 17.11, Memcached 1.6.45, and MariaDB 11.4.13 have been cross-compiled. Build from source, sign the binaries, and install the signed archive with `marina install --file`. Device validation is pending, login autostart is unavailable, and the public catalog has no HarmonyOS packages yet. [Build, sign, and test instructions (Chinese)](README.zh-CN.md#鸿蒙电脑原生数据库)
|
|
132
|
+
|
|
133
|
+
## Command reference
|
|
134
|
+
|
|
135
|
+
| Command | Use it to |
|
|
136
|
+
| --- | --- |
|
|
137
|
+
| `marina remote mysql` | List published MySQL versions for your machine |
|
|
138
|
+
| `marina install mysql@8.4` | Install the latest published patch in the 8.4 series |
|
|
139
|
+
| `marina install mysql@8.4.11` | Install a specific release |
|
|
140
|
+
| `marina use mysql@8.4.11` | Select an installed version |
|
|
141
|
+
| `marina start mysql@8.4` | Start the selected version in that series |
|
|
142
|
+
| `marina status mysql@8.4` | Check the running version, port, and process |
|
|
143
|
+
| `marina logs mysql --lines 50` | Read the last 50 log lines |
|
|
144
|
+
| `marina exec mysql@8.4 -- -e "SELECT VERSION()"` | Run the matching client with the instance's connection settings |
|
|
145
|
+
| `marina port mysql 3308` | Set the instance's port |
|
|
146
|
+
| `marina auth mysql` | Show the instance's connection account |
|
|
147
|
+
| `marina autostart redis` | Start Redis at user login |
|
|
148
|
+
| `marina stop mysql@8.4` | Stop the running instance |
|
|
149
|
+
| `marina ls` | List installed versions |
|
|
150
|
+
| `marina doctor` | Check the local environment, binary libraries, and port conflicts |
|
|
151
|
+
|
|
152
|
+
### Pin versions for a project
|
|
153
|
+
|
|
154
|
+
Install the versions your project needs and add a `.marinarc` JSON file to its root.
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"mysql": "8.4.11",
|
|
159
|
+
"redis": "7.4.11"
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Run `marina use` inside the project to apply the nearest `.marinarc`. Run `marina current` to see the active versions and project pins.
|
|
164
|
+
|
|
165
|
+
### Install from a local archive
|
|
166
|
+
|
|
167
|
+
Use a compatible engine package that you already have on disk.
|
|
168
|
+
|
|
169
|
+
```sh
|
|
170
|
+
marina install redis@7.4.11 --file ./redis-7.4.11-linux-x64.tar.gz
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Local data
|
|
174
|
+
|
|
175
|
+
Marina uses `runtime/` when the checkout is writable. It falls back to `~/.marina` in a read-only installation. Set `MARINA_HOME` to choose another runtime directory.
|
|
176
|
+
|
|
177
|
+
| Path under the runtime directory | Contents |
|
|
178
|
+
| --- | --- |
|
|
179
|
+
| `engines/<db>/<series>/<version>/` | Extracted binaries for each installed release |
|
|
180
|
+
| `data/<db>/<series>/` | Database files for the version series |
|
|
181
|
+
| `etc/<db>/<series>/` | Instance configuration |
|
|
182
|
+
| `logs/<db>/<series>.log` | Server logs |
|
|
183
|
+
| `state.json` | Version selections, ports, and local credentials |
|
|
184
|
+
|
|
185
|
+
Patch releases in the same series share a data directory. For example, MySQL 8.4 patches share `data/mysql/8.4/`. Removing a version with `marina rm` keeps its data. Use `--purge` only when you intend to delete the data for the series.
|
|
186
|
+
|
|
187
|
+
Services bind to loopback by default. Marina stores local credentials in plain text in `state.json`. Use development credentials for these instances.
|
|
188
|
+
|
|
189
|
+
## Troubleshooting
|
|
190
|
+
|
|
191
|
+
| If you see | Check |
|
|
192
|
+
| --- | --- |
|
|
193
|
+
| A version is missing | Run `marina remote <db>` to check the current catalog for your platform |
|
|
194
|
+
| The catalog is unavailable | Check access to GitHub and retry the command, or install an existing archive with `--file` |
|
|
195
|
+
| A port is already in use | Run `marina doctor` and choose a free port with `marina port <db> <port>` |
|
|
196
|
+
| A service fails to start | Check `marina logs <db>` for the server error and run `marina doctor` |
|
|
197
|
+
|
|
198
|
+
## Development
|
|
199
|
+
|
|
200
|
+
The CLI uses Node.js built-in modules. Run the test suite from the repository root.
|
|
201
|
+
|
|
202
|
+
```sh
|
|
203
|
+
npm test
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Run `build-engines` with one database and a comma-separated list of versions. GitHub Actions builds and smoke-tests each version and platform, then keeps the packages as workflow artifacts for seven days. Run `promote-engines` with the successful run ID to add the packages to the database's shared Release, such as `engines-redis`, and update the installation catalog. Use `migrate_engine` to copy that database's already published archives into the shared Release and update their catalog links without rebuilding. [Build workflow](./.github/workflows/build-engines.yml) · [Promotion workflow](./.github/workflows/promote-engines.yml)
|
|
207
|
+
|
|
208
|
+
The build workflow checks upstream releases for each database daily on `main`. It discovers new versions and release series and skips packages already published or covered by unexpired build artifacts. To check immediately, select an engine and enable `incremental` in `build-engines`. Use the successful run ID to promote the builds when ready.
|
|
209
|
+
|
|
210
|
+
Changes to Milvus packaging on `main` check for missing Linux x64 and macOS ARM64 builds. Milvus packages from these checks and from the daily Milvus run publish automatically after smoke tests pass. Linux can reuse a compatible package from an earlier run, and macOS caches the compiled files before packaging.
|
|
211
|
+
|
|
212
|
+
Report bugs and feature requests in [GitHub Issues](https://github.com/zhqi9277/marina-db/issues).
|
|
213
|
+
|
|
214
|
+
### Release the CLI
|
|
215
|
+
|
|
216
|
+
Every push to `main` that changes `bin/`, `src/`, `assets/`, `package.json`, or a README runs the tests, bumps the patch version, tags the commit, publishes to npm with provenance, and creates a GitHub Release with generated notes. Add `#minor` or `#major` to the commit message for a larger bump, or `[skip release]` to skip publishing. To choose the bump yourself, open **Actions → Release → Run workflow**. The workflow needs an `NPM_TOKEN` repository secret. Engine releases (`engines-*`) are separate and unaffected.
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
Marina is released under the [MIT License](./LICENSE).
|