@pnpm/pnpr 0.0.0-26060601 → 0.0.0-26062101
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 +44 -13
- package/bin/pnpr +27 -3
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -16,8 +16,9 @@ pnpm add -g @pnpm/pnpr
|
|
|
16
16
|
|
|
17
17
|
The wrapper resolves to the native binary published under
|
|
18
18
|
`@pnpm/pnpr.<platform>-<arch>` (e.g. `@pnpm/pnpr.linux-x64`). Prebuilt
|
|
19
|
-
binaries are available for `linux-x64`, `linux-arm64`, `
|
|
20
|
-
`
|
|
19
|
+
binaries are available for `linux-x64`, `linux-arm64`, `linux-x64-musl`,
|
|
20
|
+
`linux-arm64-musl`, `darwin-x64`, `darwin-arm64`, `win32-x64`, and
|
|
21
|
+
`win32-arm64`.
|
|
21
22
|
|
|
22
23
|
## Usage
|
|
23
24
|
|
|
@@ -91,8 +92,8 @@ pnpr -c ./pnpr.yaml
|
|
|
91
92
|
By default both are local directories. Adding an `s3:` block moves the
|
|
92
93
|
**hosted** store into an S3-compatible object store, so the durable data
|
|
93
94
|
is replicated by the provider and can be shared by several stateless
|
|
94
|
-
`pnpr` replicas. The cache
|
|
95
|
-
|
|
95
|
+
`pnpr` replicas. The cache stays on local disk — only the hosted
|
|
96
|
+
package store is pluggable here.
|
|
96
97
|
|
|
97
98
|
Because any S3-compatible endpoint works, this also covers **Cloudflare
|
|
98
99
|
R2**, **MinIO**, **Backblaze B2**, **Wasabi**, etc. — point `endpoint`
|
|
@@ -181,21 +182,30 @@ s3:
|
|
|
181
182
|
secretAccessKey: minioadmin
|
|
182
183
|
```
|
|
183
184
|
|
|
184
|
-
### Storing users and tokens in a
|
|
185
|
+
### Storing users and tokens in a shared SQL database
|
|
185
186
|
|
|
186
187
|
Auth state — the registered users and their bearer tokens — is the other
|
|
187
188
|
piece of per-instance disk state. By default users live in an
|
|
188
189
|
htpasswd file and tokens in a local SQLite database (see `auth:` above),
|
|
189
190
|
so two `pnpr` replicas don't see each other's accounts. Adding a
|
|
190
|
-
`backend:` block moves both into one
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
`pnpr` horizontally scaled.
|
|
191
|
+
`backend:` block moves both into one shared SQL database, so several
|
|
192
|
+
stateless replicas share a consistent set of logins and tokens — the
|
|
193
|
+
auth half of running `pnpr` horizontally scaled.
|
|
194
194
|
|
|
195
|
-
The
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
The same auth traits drive every backend, and the SQL schema sticks to
|
|
196
|
+
common column types so records can be moved between supported drivers.
|
|
197
|
+
Only one backend may be selected in a config file.
|
|
198
|
+
|
|
199
|
+
Database drivers are Cargo-feature gated:
|
|
200
|
+
|
|
201
|
+
| Backend | Config key | Cargo feature |
|
|
202
|
+
| --- | --- | --- |
|
|
203
|
+
| libsql / Turso | `backend.libsql` | `backend-libsql` (enabled by default) |
|
|
204
|
+
| PostgreSQL | `backend.postgres` or `backend.postgresql` | `backend-postgres` |
|
|
205
|
+
| MySQL-compatible | `backend.mysql` | `backend-mysql` |
|
|
206
|
+
|
|
207
|
+
Token lookups happen on the request hot path, so the database should be
|
|
208
|
+
low-latency from the server.
|
|
199
209
|
|
|
200
210
|
```yaml
|
|
201
211
|
storage: ./storage
|
|
@@ -234,6 +244,27 @@ replica's writes (a token issued or revoked elsewhere) only after the
|
|
|
234
244
|
next background sync, so lower `syncIntervalSecs` means less
|
|
235
245
|
revocation lag. Omit `replicaPath` to always read the primary directly.
|
|
236
246
|
|
|
247
|
+
PostgreSQL:
|
|
248
|
+
|
|
249
|
+
```yaml
|
|
250
|
+
backend:
|
|
251
|
+
postgres:
|
|
252
|
+
url: ${PNPR_POSTGRES_URL}
|
|
253
|
+
maxConnections: 16
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
MySQL:
|
|
257
|
+
|
|
258
|
+
```yaml
|
|
259
|
+
backend:
|
|
260
|
+
mysql:
|
|
261
|
+
url: ${PNPR_MYSQL_URL}
|
|
262
|
+
maxConnections: 16
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
For PostgreSQL or MySQL support, build pnpr with the matching Cargo
|
|
266
|
+
feature, for example `cargo build -p pnpr --features backend-postgres`.
|
|
267
|
+
|
|
237
268
|
When the `backend:` block is absent, auth stays on local disk and the
|
|
238
269
|
`auth.htpasswd` / `auth.tokens` settings apply as before. The
|
|
239
270
|
`auth.htpasswd.max_users` registration cap is honored either way.
|
package/bin/pnpr
CHANGED
|
@@ -11,12 +11,18 @@ const PLATFORMS = {
|
|
|
11
11
|
arm64: "@pnpm/pnpr.darwin-arm64/pnpr",
|
|
12
12
|
},
|
|
13
13
|
linux: {
|
|
14
|
-
x64:
|
|
15
|
-
|
|
14
|
+
x64: {
|
|
15
|
+
glibc: "@pnpm/pnpr.linux-x64/pnpr",
|
|
16
|
+
musl: "@pnpm/pnpr.linux-x64-musl/pnpr",
|
|
17
|
+
},
|
|
18
|
+
arm64: {
|
|
19
|
+
glibc: "@pnpm/pnpr.linux-arm64/pnpr",
|
|
20
|
+
musl: "@pnpm/pnpr.linux-arm64-musl/pnpr",
|
|
21
|
+
},
|
|
16
22
|
},
|
|
17
23
|
};
|
|
18
24
|
|
|
19
|
-
const binPath =
|
|
25
|
+
const binPath = getBinPath();
|
|
20
26
|
if (binPath) {
|
|
21
27
|
const result = require("child_process").spawnSync(
|
|
22
28
|
require.resolve(binPath),
|
|
@@ -50,3 +56,21 @@ if (binPath) {
|
|
|
50
56
|
);
|
|
51
57
|
process.exitCode = 1;
|
|
52
58
|
}
|
|
59
|
+
|
|
60
|
+
function getBinPath() {
|
|
61
|
+
const platformEntry = PLATFORMS?.[platform]?.[arch];
|
|
62
|
+
|
|
63
|
+
if (platformEntry == null || typeof platformEntry === "string") {
|
|
64
|
+
return platformEntry;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return platformEntry[detectLinuxLibc()];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function detectLinuxLibc() {
|
|
71
|
+
if (platform !== "linux") {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return process.report.getReport().header.glibcVersionRuntime ? "glibc" : "musl";
|
|
76
|
+
}
|
package/package.json
CHANGED
|
@@ -21,14 +21,16 @@
|
|
|
21
21
|
"bin/pnpr",
|
|
22
22
|
"LICENSE.md"
|
|
23
23
|
],
|
|
24
|
-
"version": "0.0.0-
|
|
24
|
+
"version": "0.0.0-26062101",
|
|
25
25
|
"optionalDependencies": {
|
|
26
|
-
"@pnpm/pnpr.win32-x64": "0.0.0-
|
|
27
|
-
"@pnpm/pnpr.win32-arm64": "0.0.0-
|
|
28
|
-
"@pnpm/pnpr.darwin-x64": "0.0.0-
|
|
29
|
-
"@pnpm/pnpr.darwin-arm64": "0.0.0-
|
|
30
|
-
"@pnpm/pnpr.linux-x64": "0.0.0-
|
|
31
|
-
"@pnpm/pnpr.linux-arm64": "0.0.0-
|
|
26
|
+
"@pnpm/pnpr.win32-x64": "0.0.0-26062101",
|
|
27
|
+
"@pnpm/pnpr.win32-arm64": "0.0.0-26062101",
|
|
28
|
+
"@pnpm/pnpr.darwin-x64": "0.0.0-26062101",
|
|
29
|
+
"@pnpm/pnpr.darwin-arm64": "0.0.0-26062101",
|
|
30
|
+
"@pnpm/pnpr.linux-x64": "0.0.0-26062101",
|
|
31
|
+
"@pnpm/pnpr.linux-arm64": "0.0.0-26062101",
|
|
32
|
+
"@pnpm/pnpr.linux-x64-musl": "0.0.0-26062101",
|
|
33
|
+
"@pnpm/pnpr.linux-arm64-musl": "0.0.0-26062101"
|
|
32
34
|
},
|
|
33
35
|
"bin": {
|
|
34
36
|
"pnpr": "bin/pnpr"
|