@parity/ppn 0.2.0-rc.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 +202 -0
- package/README.md +84 -0
- package/config/ports.env +128 -0
- package/config/versions.env +120 -0
- package/dist/bin.d.ts +2 -0
- package/dist/bin.js +30 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +471 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/bite.d.ts +27 -0
- package/dist/commands/bite.js +556 -0
- package/dist/commands/bite.js.map +1 -0
- package/dist/commands/dashboard.d.ts +2 -0
- package/dist/commands/dashboard.js +503 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/dist.d.ts +7 -0
- package/dist/commands/dist.js +121 -0
- package/dist/commands/dist.js.map +1 -0
- package/dist/commands/fetch.d.ts +11 -0
- package/dist/commands/fetch.js +550 -0
- package/dist/commands/fetch.js.map +1 -0
- package/dist/commands/fork.d.ts +1 -0
- package/dist/commands/fork.js +164 -0
- package/dist/commands/fork.js.map +1 -0
- package/dist/commands/generate.d.ts +7 -0
- package/dist/commands/generate.js +201 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/genesis-toml.d.ts +1 -0
- package/dist/commands/genesis-toml.js +26 -0
- package/dist/commands/genesis-toml.js.map +1 -0
- package/dist/commands/nginx-conf.d.ts +1 -0
- package/dist/commands/nginx-conf.js +32 -0
- package/dist/commands/nginx-conf.js.map +1 -0
- package/dist/commands/service-context.d.ts +13 -0
- package/dist/commands/service-context.js +5 -0
- package/dist/commands/service-context.js.map +1 -0
- package/dist/commands/service.d.ts +28 -0
- package/dist/commands/service.js +807 -0
- package/dist/commands/service.js.map +1 -0
- package/dist/commands/stamp-spawn.d.ts +7 -0
- package/dist/commands/stamp-spawn.js +43 -0
- package/dist/commands/stamp-spawn.js.map +1 -0
- package/dist/commands/start.d.ts +33 -0
- package/dist/commands/start.js +462 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/upgrade.d.ts +15 -0
- package/dist/commands/upgrade.js +101 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/fork/chains.d.ts +25 -0
- package/dist/fork/chains.js +36 -0
- package/dist/fork/chains.js.map +1 -0
- package/dist/fork/codec.d.ts +36 -0
- package/dist/fork/codec.js +122 -0
- package/dist/fork/codec.js.map +1 -0
- package/dist/fork/manifest.d.ts +13 -0
- package/dist/fork/manifest.js +77 -0
- package/dist/fork/manifest.js.map +1 -0
- package/dist/fork/overrides.d.ts +45 -0
- package/dist/fork/overrides.js +255 -0
- package/dist/fork/overrides.js.map +1 -0
- package/dist/fork/products.d.ts +68 -0
- package/dist/fork/products.js +265 -0
- package/dist/fork/products.js.map +1 -0
- package/dist/fork/rpc.d.ts +25 -0
- package/dist/fork/rpc.js +51 -0
- package/dist/fork/rpc.js.map +1 -0
- package/dist/fork/shared-relay.d.ts +99 -0
- package/dist/fork/shared-relay.js +162 -0
- package/dist/fork/shared-relay.js.map +1 -0
- package/dist/fork/sleep.d.ts +3 -0
- package/dist/fork/sleep.js +2 -0
- package/dist/fork/sleep.js.map +1 -0
- package/dist/fork/validators.d.ts +81 -0
- package/dist/fork/validators.js +170 -0
- package/dist/fork/validators.js.map +1 -0
- package/dist/fork/verify.d.ts +79 -0
- package/dist/fork/verify.js +192 -0
- package/dist/fork/verify.js.map +1 -0
- package/dist/lib/archive.d.ts +8 -0
- package/dist/lib/archive.js +40 -0
- package/dist/lib/archive.js.map +1 -0
- package/dist/lib/fork-bundle-name.d.ts +4 -0
- package/dist/lib/fork-bundle-name.js +20 -0
- package/dist/lib/fork-bundle-name.js.map +1 -0
- package/dist/lib/github.d.ts +48 -0
- package/dist/lib/github.js +192 -0
- package/dist/lib/github.js.map +1 -0
- package/dist/lib/provenance.d.ts +67 -0
- package/dist/lib/provenance.js +98 -0
- package/dist/lib/provenance.js.map +1 -0
- package/dist/lib/spawn-env.d.ts +33 -0
- package/dist/lib/spawn-env.js +71 -0
- package/dist/lib/spawn-env.js.map +1 -0
- package/dist/lib/spawn-stamp.d.ts +34 -0
- package/dist/lib/spawn-stamp.js +63 -0
- package/dist/lib/spawn-stamp.js.map +1 -0
- package/dist/upgrade/chains.d.ts +4 -0
- package/dist/upgrade/chains.js +17 -0
- package/dist/upgrade/chains.js.map +1 -0
- package/dist/upgrade/fund.d.ts +38 -0
- package/dist/upgrade/fund.js +119 -0
- package/dist/upgrade/fund.js.map +1 -0
- package/dist/upgrade/provider-node.d.ts +2 -0
- package/dist/upgrade/provider-node.js +7 -0
- package/dist/upgrade/provider-node.js.map +1 -0
- package/dist/upgrade/signer.d.ts +21 -0
- package/dist/upgrade/signer.js +48 -0
- package/dist/upgrade/signer.js.map +1 -0
- package/dist/upgrade/sudo.d.ts +2 -0
- package/dist/upgrade/sudo.js +26 -0
- package/dist/upgrade/sudo.js.map +1 -0
- package/dist/upgrade/upgrade.d.ts +128 -0
- package/dist/upgrade/upgrade.js +539 -0
- package/dist/upgrade/upgrade.js.map +1 -0
- package/networks/README.md +120 -0
- package/networks/devnet.json +113 -0
- package/networks/kusama.json +56 -0
- package/networks/paseo-next-v2.json +87 -0
- package/networks/polkadot.json +57 -0
- package/networks/previewnet.json +186 -0
- package/package.json +54 -0
- package/scripts/assign-cores.sh +12 -0
- package/scripts/dashboard.sh +11 -0
- package/scripts/docker-entrypoint.sh +52 -0
- package/scripts/dub/postgres.sh +116 -0
- package/scripts/dub/service.sh +202 -0
- package/scripts/ensure-dot-cli.sh +23 -0
- package/scripts/eth-rpc.sh +45 -0
- package/scripts/force-open-hrmp.sh +11 -0
- package/scripts/grant-invites.sh +11 -0
- package/scripts/increase-people-lite-attestation-allowance.sh +11 -0
- package/scripts/install.sh +12 -0
- package/scripts/ipfs-daemon.sh +48 -0
- package/scripts/ipfs-swarm.sh +48 -0
- package/scripts/kill-port.sh +11 -0
- package/scripts/lib/workspace.sh +47 -0
- package/scripts/omni-node.sh +112 -0
- package/scripts/patch-bootnodes.sh +11 -0
- package/scripts/pin-bulletin-products.sh +11 -0
- package/scripts/pin-design-families.sh +144 -0
- package/scripts/set-dispatcher-address.sh +11 -0
- package/scripts/storage-provider-node.sh +11 -0
- package/web/assets/index-BW4b1s2y.js +7 -0
- package/web/assets/index-X3pZpnYk.css +1 -0
- package/web/index.html +13 -0
- package/zombienet-configs/local-dev.toml +253 -0
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
// `ppn service dashboard` — the network's own status server.
|
|
2
|
+
//
|
|
3
|
+
// One zombienet custom_process, like eth-rpc: spawns with the network, dies with it, and
|
|
4
|
+
// renders what the network *is* from the same resolution the CLI runs on. Serves the UI,
|
|
5
|
+
// the contract (/api/network), the provenance stamps written at fetch/spawn time, health
|
|
6
|
+
// probes, log streams, and — locally — a path→port proxy so the laptop gets the same
|
|
7
|
+
// URL shapes the servers get from nginx. See docs/DASHBOARD.md.
|
|
8
|
+
//
|
|
9
|
+
// Never in the production data path: on servers nginx routes the chains directly and only
|
|
10
|
+
// `/` is proxied here, so this process crashing costs the dashboard, not the network.
|
|
11
|
+
import fs from 'node:fs';
|
|
12
|
+
import http from 'node:http';
|
|
13
|
+
import net from 'node:net';
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
import { dashboardModel } from '@parity/ppn-network-config';
|
|
16
|
+
import { PROVENANCE_FILE } from '../lib/provenance.js';
|
|
17
|
+
const LOG_NAME = /^[A-Za-z0-9][A-Za-z0-9-]*$/;
|
|
18
|
+
/**
|
|
19
|
+
* One JSON-RPC batch per chain per tick: head, runtime version, client version. A batch
|
|
20
|
+
* rather than three requests because it is one round trip and one connection, and the probe
|
|
21
|
+
* runs against every chain every five seconds.
|
|
22
|
+
*
|
|
23
|
+
* Responses are matched by id, not by position — the spec allows a server to answer a batch
|
|
24
|
+
* in any order, and reading by index would silently attribute one method's result to another.
|
|
25
|
+
*/
|
|
26
|
+
async function rpcBatch(port) {
|
|
27
|
+
const calls = [
|
|
28
|
+
{ jsonrpc: '2.0', id: 1, method: 'chain_getHeader', params: [] },
|
|
29
|
+
{ jsonrpc: '2.0', id: 2, method: 'state_getRuntimeVersion', params: [] },
|
|
30
|
+
{ jsonrpc: '2.0', id: 3, method: 'system_version', params: [] },
|
|
31
|
+
];
|
|
32
|
+
const res = await fetch(`http://127.0.0.1:${port}`, {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: { 'content-type': 'application/json' },
|
|
35
|
+
body: JSON.stringify(calls),
|
|
36
|
+
signal: AbortSignal.timeout(3000),
|
|
37
|
+
});
|
|
38
|
+
const body = (await res.json());
|
|
39
|
+
const rows = Array.isArray(body) ? body : [body];
|
|
40
|
+
return new Map(rows.filter((r) => r && r.result !== undefined).map((r) => [r.id, r.result]));
|
|
41
|
+
}
|
|
42
|
+
export async function dashboard(ctx) {
|
|
43
|
+
// Environment first: the test harness points fixtures at ephemeral ports, and a server
|
|
44
|
+
// can repoint without editing ports.env — the same precedence loadContext gives BIN.
|
|
45
|
+
const port = Number(process.env.DASHBOARD_PORT || ctx.ports.DASHBOARD_PORT || 8090);
|
|
46
|
+
// Env first, then the ports file — the same precedence dataDir uses below, and for the
|
|
47
|
+
// same reason: the dashboard runs as a zombienet custom process, which is handed no
|
|
48
|
+
// environment. redeploy.sh writes PPN_PUBLIC_URL to /etc/ppn/deploy.env for ppn.service,
|
|
49
|
+
// but that never reaches here, so a server advertised ws://127.0.0.1:8090 for every chain
|
|
50
|
+
// — an address no browser on the far side of nginx can use.
|
|
51
|
+
const baseUrl = process.env.PPN_PUBLIC_URL || ctx.ports.PPN_PUBLIC_URL || `http://127.0.0.1:${port}`;
|
|
52
|
+
const proxyEnabled = (process.env.DASHBOARD_PROXY ?? '1') !== '0';
|
|
53
|
+
// Per-mode (data/ vs data-fork/), resolved by `ppn start` and carried through
|
|
54
|
+
// ports.local.env because zombienet strips the environment of custom processes.
|
|
55
|
+
const dataDir = process.env.DATA_DIR ||
|
|
56
|
+
ctx.ports.PPN_DATA_DIR ||
|
|
57
|
+
path.join(path.dirname(ctx.sharedBinDir), 'data');
|
|
58
|
+
// Actions are sudo: a runtime upgrade is a root call, so the plane is fail-closed.
|
|
59
|
+
// Open on the local profile (your machine, your Alice); anywhere else only with an
|
|
60
|
+
// explicit bearer token an operator chose to set. An environment that says nothing
|
|
61
|
+
// gets a read-only dashboard.
|
|
62
|
+
const profile = process.env.PPN_PROFILE || 'local';
|
|
63
|
+
const actionsToken = process.env.DASHBOARD_ACTIONS_TOKEN || null;
|
|
64
|
+
const actionsEnabled = profile === 'local' || actionsToken !== null;
|
|
65
|
+
const authorized = (req) => {
|
|
66
|
+
if (!actionsEnabled)
|
|
67
|
+
return false;
|
|
68
|
+
if (profile === 'local' && !actionsToken)
|
|
69
|
+
return true;
|
|
70
|
+
return req.headers.authorization === `Bearer ${actionsToken}`;
|
|
71
|
+
};
|
|
72
|
+
// One action at a time: two concurrent sudo upgrades interleave nonces and both die.
|
|
73
|
+
let running = null;
|
|
74
|
+
let nextActionId = 1;
|
|
75
|
+
const model = dashboardModel(ctx.net, baseUrl);
|
|
76
|
+
// Chain specs, for light clients (smoldot) — what the old landing page published. Which
|
|
77
|
+
// basename exists depends on the mode (genesis writes <chainId>.json, a fork the source's
|
|
78
|
+
// name), so the candidates are resolved against the data directory and a chain with no
|
|
79
|
+
// spec on disk simply gets no link.
|
|
80
|
+
// Names come from the descriptor where it knows them, but a fork's parachain specs land
|
|
81
|
+
// under the *source's* chain id (asset-hub-paseo.json, not asset-hub.json), which no
|
|
82
|
+
// descriptor field predicts. So the candidates are a hint and the disk is the authority:
|
|
83
|
+
// any <name>.json in the data directory that is not a plain spec or zombienet's own file
|
|
84
|
+
// is offered, matched to a chain by longest shared prefix.
|
|
85
|
+
const specFile = (name) => path.join(dataDir, `${name}.json`);
|
|
86
|
+
const onDisk = (() => {
|
|
87
|
+
try {
|
|
88
|
+
return fs.readdirSync(dataDir)
|
|
89
|
+
.filter((f) => f.endsWith('.json'))
|
|
90
|
+
.map((f) => f.slice(0, -'.json'.length))
|
|
91
|
+
.filter((n) => LOG_NAME.test(n) && !n.endsWith('-plain') && n !== 'zombie' && n !== 'spawn');
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
})();
|
|
97
|
+
const specFor = (c) => {
|
|
98
|
+
for (const n of c.specCandidates ?? [])
|
|
99
|
+
if (onDisk.includes(n))
|
|
100
|
+
return n;
|
|
101
|
+
// A relay entry is relay-<validator>; its spec is the relay's, already in candidates.
|
|
102
|
+
if (c.id.startsWith('relay-'))
|
|
103
|
+
return undefined;
|
|
104
|
+
// Otherwise take the on-disk name that contains the chain key (asset-hub-paseo for
|
|
105
|
+
// asset-hub); the longest match wins so `people` cannot claim `paseo-people`'s file
|
|
106
|
+
// ahead of a more specific candidate.
|
|
107
|
+
const matches = onDisk.filter((n) => n === c.id || n.includes(c.id));
|
|
108
|
+
return matches.sort((a, b) => b.length - a.length)[0];
|
|
109
|
+
};
|
|
110
|
+
for (const c of model.chains) {
|
|
111
|
+
const found = specFor(c);
|
|
112
|
+
if (found && fs.existsSync(specFile(found)))
|
|
113
|
+
c.links.spec = `${baseUrl}/chainspecs/${found}.json`;
|
|
114
|
+
}
|
|
115
|
+
const routes = new Map();
|
|
116
|
+
for (const e of [...model.chains, ...model.services]) {
|
|
117
|
+
routes.set(e.path, { port: e.port, ws: e.protocol === 'ws', keepPrefix: Boolean(e.keepPrefix) });
|
|
118
|
+
}
|
|
119
|
+
// ---- health: one probe loop, results cached; browsers read the cache ----
|
|
120
|
+
const health = new Map();
|
|
121
|
+
const probe = async () => {
|
|
122
|
+
await Promise.all([...model.chains, ...model.services].map(async (e) => {
|
|
123
|
+
if (!e.health)
|
|
124
|
+
return;
|
|
125
|
+
const at = new Date().toISOString();
|
|
126
|
+
try {
|
|
127
|
+
if (e.health.kind === 'rpc') {
|
|
128
|
+
// Substrate answers JSON-RPC over plain HTTP on the same port as WS.
|
|
129
|
+
const got = await rpcBatch(e.port);
|
|
130
|
+
const head = got.get(1);
|
|
131
|
+
// The head is what decides up-or-down; the other two are extra detail, and a
|
|
132
|
+
// node that answers a header but not (say) system_version is still healthy.
|
|
133
|
+
if (!head)
|
|
134
|
+
throw new Error('no header');
|
|
135
|
+
const rt = got.get(2);
|
|
136
|
+
const client = got.get(3);
|
|
137
|
+
health.set(e.id, {
|
|
138
|
+
id: e.id,
|
|
139
|
+
status: 'ok',
|
|
140
|
+
block: parseInt(head.number, 16),
|
|
141
|
+
runtime: rt && {
|
|
142
|
+
specName: rt.specName,
|
|
143
|
+
specVersion: rt.specVersion,
|
|
144
|
+
implVersion: rt.implVersion,
|
|
145
|
+
transactionVersion: rt.transactionVersion,
|
|
146
|
+
},
|
|
147
|
+
clientVersion: typeof client === 'string' ? client : undefined,
|
|
148
|
+
checkedAt: at,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
const res = await fetch(`http://127.0.0.1:${e.port}${e.health.path}`, {
|
|
153
|
+
signal: AbortSignal.timeout(3000),
|
|
154
|
+
});
|
|
155
|
+
if (!res.ok)
|
|
156
|
+
throw new Error(`HTTP ${res.status}`);
|
|
157
|
+
health.set(e.id, { id: e.id, status: 'ok', checkedAt: at });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
health.set(e.id, {
|
|
162
|
+
id: e.id, status: 'down', error: err.message, checkedAt: at,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}));
|
|
166
|
+
};
|
|
167
|
+
probe();
|
|
168
|
+
const probeTimer = setInterval(probe, 5000);
|
|
169
|
+
probeTimer.unref();
|
|
170
|
+
// ---- logs: whitelist is what exists on disk as DATA_DIR/<name>/<name>.log ----
|
|
171
|
+
// Names come from zombienet (alice-paseo-validator, eth-rpc, …) and differ between genesis
|
|
172
|
+
// and fork spawns, so the truth is the disk, not a prediction. A name must match the
|
|
173
|
+
// pattern AND the scan — no caller-supplied path ever reaches the filesystem.
|
|
174
|
+
const logIds = () => {
|
|
175
|
+
try {
|
|
176
|
+
return fs.readdirSync(dataDir).filter((n) => LOG_NAME.test(n) && fs.existsSync(path.join(dataDir, n, `${n}.log`))).sort();
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
return [];
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
const json = (res, code, body) => {
|
|
183
|
+
res.writeHead(code, { 'content-type': 'application/json', 'access-control-allow-origin': '*' });
|
|
184
|
+
res.end(JSON.stringify(body, null, 2));
|
|
185
|
+
};
|
|
186
|
+
const readJson = (file) => {
|
|
187
|
+
try {
|
|
188
|
+
return JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
const uiDir = path.join(path.dirname(new URL(import.meta.url).pathname), '..', '..', 'web');
|
|
195
|
+
const MIME = {
|
|
196
|
+
'.html': 'text/html', '.js': 'text/javascript', '.css': 'text/css',
|
|
197
|
+
'.svg': 'image/svg+xml', '.json': 'application/json', '.png': 'image/png',
|
|
198
|
+
};
|
|
199
|
+
const server = http.createServer((req, res) => {
|
|
200
|
+
const url = new URL(req.url || '/', baseUrl);
|
|
201
|
+
const p = url.pathname;
|
|
202
|
+
// ---- API ----
|
|
203
|
+
if (p === '/api/network')
|
|
204
|
+
return json(res, 200, model);
|
|
205
|
+
if (p === '/api/health')
|
|
206
|
+
return json(res, 200, [...health.values()]);
|
|
207
|
+
if (p === '/api/provenance') {
|
|
208
|
+
return json(res, 200, {
|
|
209
|
+
provenance: readJson(path.join(ctx.binDir, PROVENANCE_FILE)),
|
|
210
|
+
spawn: readJson(path.join(dataDir, 'spawn.json')),
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
if (p === '/api/addresses') {
|
|
214
|
+
// The descriptor is the per-network address book (devnet pins its deployment there);
|
|
215
|
+
// previewnet's addresses ship as a release artifact instead, built with its genesis.
|
|
216
|
+
return json(res, 200, {
|
|
217
|
+
dotns: ctx.net.dotns?.addresses ?? readJson(path.join(ctx.binDir, 'dotns-addresses.json')),
|
|
218
|
+
dub: model.services.find((s) => s.id === 'dub')?.links ?? {},
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
// The same files nginx publishes from ${DATA_DIR} on a server — served here so a laptop
|
|
222
|
+
// (which has no nginx) offers the same light-client downloads. Whitelisted by name
|
|
223
|
+
// against what the model resolved: no caller-supplied path reaches the filesystem.
|
|
224
|
+
if (p.startsWith('/chainspecs/')) {
|
|
225
|
+
const name = p.slice('/chainspecs/'.length).replace(/\.json$/, '');
|
|
226
|
+
const allowed = model.chains.some((c) => c.links.spec?.endsWith(`/${name}.json`));
|
|
227
|
+
if (!allowed || !LOG_NAME.test(name))
|
|
228
|
+
return json(res, 404, { error: 'no such chain spec' });
|
|
229
|
+
res.writeHead(200, {
|
|
230
|
+
'content-type': 'application/json',
|
|
231
|
+
'access-control-allow-origin': '*',
|
|
232
|
+
'content-disposition': `attachment; filename="${name}.json"`,
|
|
233
|
+
});
|
|
234
|
+
fs.createReadStream(specFile(name)).pipe(res);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (p === '/api/logs') {
|
|
238
|
+
// Grouped for reading, not a-z: the chains you watch, the services that stay up, and
|
|
239
|
+
// the one-off scripts that ran once at spawn. Chain log names come from zombienet
|
|
240
|
+
// (alice-paseo-validator, asset-hub-collator1); a long-running service is anything on
|
|
241
|
+
// the model's services list plus its workers; the rest ran and exited.
|
|
242
|
+
const ids = logIds();
|
|
243
|
+
// Genesis names: alice-paseo-validator, asset-hub-collator1. Fork names: the bare
|
|
244
|
+
// well-known validators (alice…ferdie) and Collator-<paraId> (see docs/FORK.md).
|
|
245
|
+
const WELL_KNOWN = new Set(['alice', 'bob', 'charlie', 'dave', 'eve', 'ferdie']);
|
|
246
|
+
const chainish = (n) => /-validator\d*$|-collator\d*$|^Collator-/.test(n) || WELL_KNOWN.has(n) || n === 'doppelganger';
|
|
247
|
+
const serviceIds = new Set([
|
|
248
|
+
...model.services.map((s) => s.id),
|
|
249
|
+
'dashboard', 'ipfs-swarm', 'dub-api', 'dub-postgres',
|
|
250
|
+
'device-attestation-chain-writer', 'registration-queue', 'invite-tickets-pool',
|
|
251
|
+
]);
|
|
252
|
+
return json(res, 200, {
|
|
253
|
+
chains: ids.filter(chainish),
|
|
254
|
+
services: ids.filter((n) => !chainish(n) && serviceIds.has(n)),
|
|
255
|
+
scripts: ids.filter((n) => !chainish(n) && !serviceIds.has(n)),
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
if (p.startsWith('/api/logs/')) {
|
|
259
|
+
const name = p.slice('/api/logs/'.length);
|
|
260
|
+
if (!LOG_NAME.test(name) || !logIds().includes(name))
|
|
261
|
+
return json(res, 404, { error: 'no such log' });
|
|
262
|
+
return streamLog(res, path.join(dataDir, name, `${name}.log`));
|
|
263
|
+
}
|
|
264
|
+
// ---- actions (gated; see docs/DASHBOARD.md) ----
|
|
265
|
+
if (p === '/api/actions') {
|
|
266
|
+
return json(res, 200, {
|
|
267
|
+
enabled: actionsEnabled,
|
|
268
|
+
running: running && !running.done ? { id: running.id, chain: running.chain } : null,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
if (p === '/api/actions/upgrade' && req.method === 'POST') {
|
|
272
|
+
if (!authorized(req))
|
|
273
|
+
return json(res, actionsEnabled ? 401 : 403, { error: 'actions are not enabled here' });
|
|
274
|
+
if (running && !running.done)
|
|
275
|
+
return json(res, 409, { error: `action ${running.id} still running` });
|
|
276
|
+
const chain = url.searchParams.get('chain') || '';
|
|
277
|
+
if (!/^[a-z0-9-]+$/.test(chain))
|
|
278
|
+
return json(res, 400, { error: 'bad chain' });
|
|
279
|
+
const limit = 16 * 1024 * 1024;
|
|
280
|
+
// A local path instead of an upload: the build artifact is usually already on this
|
|
281
|
+
// machine (a runtime repo's target/), and round-tripping it through the browser is
|
|
282
|
+
// pointless. Server-side file access is exactly what the actions gate guards — on the
|
|
283
|
+
// local profile this is the user's own disk, on a server it needs the operator token.
|
|
284
|
+
const wasmFrom = url.searchParams.get('path');
|
|
285
|
+
if (wasmFrom) {
|
|
286
|
+
const resolved = path.resolve(wasmFrom);
|
|
287
|
+
if (!resolved.endsWith('.wasm'))
|
|
288
|
+
return json(res, 400, { error: 'path must name a .wasm file' });
|
|
289
|
+
let stat;
|
|
290
|
+
try {
|
|
291
|
+
stat = fs.statSync(resolved);
|
|
292
|
+
}
|
|
293
|
+
catch {
|
|
294
|
+
return json(res, 404, { error: `no file at ${resolved}` });
|
|
295
|
+
}
|
|
296
|
+
if (!stat.isFile() || stat.size === 0 || stat.size > limit) {
|
|
297
|
+
return json(res, 400, { error: `not a usable runtime (size ${stat.size}, cap ${limit})` });
|
|
298
|
+
}
|
|
299
|
+
const action = { id: nextActionId++, chain, lines: [], done: false, error: undefined };
|
|
300
|
+
running = action;
|
|
301
|
+
json(res, 202, { id: action.id, events: `/api/actions/${action.id}/events` });
|
|
302
|
+
(async () => {
|
|
303
|
+
try {
|
|
304
|
+
const { run: upgrade } = await import('./upgrade.js');
|
|
305
|
+
const orig = console.log;
|
|
306
|
+
console.log = (...a) => { action.lines.push(a.join(' ')); orig(...a); };
|
|
307
|
+
action.lines.push(`using ${resolved} (${stat.size} bytes)`);
|
|
308
|
+
try {
|
|
309
|
+
await upgrade([chain, resolved], {});
|
|
310
|
+
}
|
|
311
|
+
finally {
|
|
312
|
+
console.log = orig;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
catch (err) {
|
|
316
|
+
action.error = err.message;
|
|
317
|
+
action.lines.push(`ERROR: ${action.error}`);
|
|
318
|
+
}
|
|
319
|
+
finally {
|
|
320
|
+
action.done = true;
|
|
321
|
+
}
|
|
322
|
+
})();
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
// Body: the raw WASM. Same cap the spawner uses for runtime uploads.
|
|
326
|
+
const parts = [];
|
|
327
|
+
let size = 0;
|
|
328
|
+
req.on('data', (c) => {
|
|
329
|
+
size += c.length;
|
|
330
|
+
if (size > limit) {
|
|
331
|
+
req.destroy();
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
parts.push(c);
|
|
335
|
+
});
|
|
336
|
+
req.on('end', async () => {
|
|
337
|
+
if (size === 0 || size > limit)
|
|
338
|
+
return json(res, 400, { error: 'expected a WASM body up to 16 MB' });
|
|
339
|
+
const wasmPath = path.join(fs.mkdtempSync(path.join(dataDir, '.upgrade-')), 'runtime.wasm');
|
|
340
|
+
fs.writeFileSync(wasmPath, Buffer.concat(parts));
|
|
341
|
+
const action = { id: nextActionId++, chain, lines: [], done: false, error: undefined };
|
|
342
|
+
running = action;
|
|
343
|
+
json(res, 202, { id: action.id, events: `/api/actions/${action.id}/events` });
|
|
344
|
+
try {
|
|
345
|
+
const { run: upgrade } = await import('./upgrade.js');
|
|
346
|
+
const orig = console.log;
|
|
347
|
+
console.log = (...a) => { action.lines.push(a.join(' ')); orig(...a); };
|
|
348
|
+
try {
|
|
349
|
+
await upgrade([chain, wasmPath], {});
|
|
350
|
+
}
|
|
351
|
+
finally {
|
|
352
|
+
console.log = orig;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
catch (err) {
|
|
356
|
+
action.error = err.message;
|
|
357
|
+
action.lines.push(`ERROR: ${action.error}`);
|
|
358
|
+
}
|
|
359
|
+
finally {
|
|
360
|
+
action.done = true;
|
|
361
|
+
fs.rmSync(path.dirname(wasmPath), { recursive: true, force: true });
|
|
362
|
+
}
|
|
363
|
+
});
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
{
|
|
367
|
+
const m = p.match(/^\/api\/actions\/(\d+)\/events$/);
|
|
368
|
+
if (m) {
|
|
369
|
+
if (!running || running.id !== Number(m[1]))
|
|
370
|
+
return json(res, 404, { error: 'no such action' });
|
|
371
|
+
const action = running;
|
|
372
|
+
res.writeHead(200, { 'content-type': 'text/event-stream', 'cache-control': 'no-cache', 'access-control-allow-origin': '*' });
|
|
373
|
+
let sent = 0;
|
|
374
|
+
const tick = setInterval(() => {
|
|
375
|
+
while (sent < action.lines.length)
|
|
376
|
+
res.write(`data: ${action.lines[sent++]}\n\n`);
|
|
377
|
+
if (action.done) {
|
|
378
|
+
res.write(`event: done\ndata: ${action.error ? 'error' : 'ok'}\n\n`);
|
|
379
|
+
clearInterval(tick);
|
|
380
|
+
res.end();
|
|
381
|
+
}
|
|
382
|
+
}, 300);
|
|
383
|
+
res.on('close', () => clearInterval(tick));
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
// ---- local proxy (HTTP side; WS upgrades handled below) ----
|
|
388
|
+
if (proxyEnabled) {
|
|
389
|
+
const route = matchRoute(routes, p);
|
|
390
|
+
if (route) {
|
|
391
|
+
// The upstream sees itself as 127.0.0.1:<port>; forwarding the browser's Host
|
|
392
|
+
// (127.0.0.1:8090) trips substrate's RPC host whitelist and kubo's gateway check —
|
|
393
|
+
// "Provided Host header is not whitelisted". Same rewrite nginx does per location.
|
|
394
|
+
const upstream = http.request({ host: '127.0.0.1', port: route.target.port,
|
|
395
|
+
path: route.target.keepPrefix ? route.matched + route.rest : (route.rest || '/'),
|
|
396
|
+
method: req.method,
|
|
397
|
+
headers: { ...req.headers, host: `127.0.0.1:${route.target.port}` } }, (up) => { res.writeHead(up.statusCode || 502, up.headers); up.pipe(res); });
|
|
398
|
+
upstream.on('error', () => json(res, 502, { error: 'upstream unreachable' }));
|
|
399
|
+
req.pipe(upstream);
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
// ---- static UI ----
|
|
404
|
+
const rel = p === '/' ? '/index.html' : p;
|
|
405
|
+
const file = path.join(uiDir, path.normalize(rel).replace(/^([.][.][/\\])+/, ''));
|
|
406
|
+
if (file.startsWith(uiDir) && fs.existsSync(file) && fs.statSync(file).isFile()) {
|
|
407
|
+
res.writeHead(200, { 'content-type': MIME[path.extname(file)] || 'application/octet-stream' });
|
|
408
|
+
fs.createReadStream(file).pipe(res);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
json(res, 404, { error: 'not found' });
|
|
412
|
+
});
|
|
413
|
+
// WebSocket proxying: a raw TCP splice after replaying the upgrade request. The dashboard
|
|
414
|
+
// does not speak the WS protocol — it only moves bytes, which is all a proxy needs.
|
|
415
|
+
server.on('upgrade', (req, socket, head) => {
|
|
416
|
+
if (!proxyEnabled)
|
|
417
|
+
return socket.destroy();
|
|
418
|
+
const route = matchRoute(routes, new URL(req.url || '/', baseUrl).pathname);
|
|
419
|
+
if (!route || !route.target.ws)
|
|
420
|
+
return socket.destroy();
|
|
421
|
+
const upstream = net.connect(route.target.port, '127.0.0.1', () => {
|
|
422
|
+
const headers = Object.entries({ ...req.headers, host: `127.0.0.1:${route.target.port}` })
|
|
423
|
+
.map(([k, v]) => `${k}: ${Array.isArray(v) ? v.join(', ') : v}`)
|
|
424
|
+
.join('\r\n');
|
|
425
|
+
upstream.write(`${req.method} ${route.target.keepPrefix ? route.matched + route.rest : (route.rest || '/')} HTTP/1.1\r\n${headers}\r\n\r\n`);
|
|
426
|
+
if (head.length)
|
|
427
|
+
upstream.write(head);
|
|
428
|
+
upstream.pipe(socket);
|
|
429
|
+
socket.pipe(upstream);
|
|
430
|
+
});
|
|
431
|
+
upstream.on('error', () => socket.destroy());
|
|
432
|
+
socket.on('error', () => upstream.destroy());
|
|
433
|
+
});
|
|
434
|
+
server.listen(port, () => {
|
|
435
|
+
console.log(`dashboard: ${baseUrl}`);
|
|
436
|
+
console.log(` api: ${baseUrl}/api/network`);
|
|
437
|
+
console.log(` proxy: ${proxyEnabled ? [...routes.keys()].join(' ') : 'off'}`);
|
|
438
|
+
});
|
|
439
|
+
// zombienet owns the lifecycle; hold the process open until it kills us.
|
|
440
|
+
await new Promise(() => { });
|
|
441
|
+
}
|
|
442
|
+
/** Longest-prefix route match; returns the remainder to forward upstream. */
|
|
443
|
+
function matchRoute(routes, pathname) {
|
|
444
|
+
let best = null;
|
|
445
|
+
for (const key of routes.keys()) {
|
|
446
|
+
if ((pathname === key || pathname.startsWith(key + '/')) && (!best || key.length > best.length)) {
|
|
447
|
+
best = key;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return best ? { target: routes.get(best), matched: best, rest: pathname.slice(best.length) } : null;
|
|
451
|
+
}
|
|
452
|
+
/** SSE-tail a log file: replay the last 64 KB, then follow appended bytes. */
|
|
453
|
+
function streamLog(res, file) {
|
|
454
|
+
res.writeHead(200, {
|
|
455
|
+
'content-type': 'text/event-stream',
|
|
456
|
+
'cache-control': 'no-cache',
|
|
457
|
+
'access-control-allow-origin': '*',
|
|
458
|
+
});
|
|
459
|
+
// Node services log with ANSI colour even into files; raw escapes render as `[2m` noise
|
|
460
|
+
// in a browser. Severity is re-derived client-side from the words, so nothing is lost.
|
|
461
|
+
const ANSI = /\x1b?\[[0-9;]*m/g;
|
|
462
|
+
const send = (chunk) => {
|
|
463
|
+
for (const line of chunk.split('\n')) {
|
|
464
|
+
const clean = line.replace(ANSI, '');
|
|
465
|
+
if (clean.length)
|
|
466
|
+
res.write(`data: ${clean}\n\n`);
|
|
467
|
+
}
|
|
468
|
+
};
|
|
469
|
+
let position = 0;
|
|
470
|
+
try {
|
|
471
|
+
const size = fs.statSync(file).size;
|
|
472
|
+
position = Math.max(0, size - 64 * 1024);
|
|
473
|
+
const fd = fs.openSync(file, 'r');
|
|
474
|
+
const buf = Buffer.alloc(size - position);
|
|
475
|
+
fs.readSync(fd, buf, 0, buf.length, position);
|
|
476
|
+
fs.closeSync(fd);
|
|
477
|
+
position = size;
|
|
478
|
+
send(buf.toString('utf-8'));
|
|
479
|
+
}
|
|
480
|
+
catch {
|
|
481
|
+
/* file may rotate away mid-read; the watcher below recovers */
|
|
482
|
+
}
|
|
483
|
+
const poll = setInterval(() => {
|
|
484
|
+
try {
|
|
485
|
+
const size = fs.statSync(file).size;
|
|
486
|
+
if (size < position)
|
|
487
|
+
position = 0; // rotated
|
|
488
|
+
if (size > position) {
|
|
489
|
+
const fd = fs.openSync(file, 'r');
|
|
490
|
+
const buf = Buffer.alloc(size - position);
|
|
491
|
+
fs.readSync(fd, buf, 0, buf.length, position);
|
|
492
|
+
fs.closeSync(fd);
|
|
493
|
+
position = size;
|
|
494
|
+
send(buf.toString('utf-8'));
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
catch {
|
|
498
|
+
/* transient stat/read failure — retry next tick */
|
|
499
|
+
}
|
|
500
|
+
}, 1000);
|
|
501
|
+
res.on('close', () => clearInterval(poll));
|
|
502
|
+
}
|
|
503
|
+
//# sourceMappingURL=dashboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/commands/dashboard.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,yFAAyF;AACzF,yFAAyF;AACzF,yFAAyF;AACzF,qFAAqF;AACrF,gEAAgE;AAChE,EAAE;AACF,0FAA0F;AAC1F,sFAAsF;AAEtF,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAoB9C;;;;;;;GAOG;AACH,KAAK,UAAU,QAAQ,CAAC,IAAY;IAClC,MAAM,KAAK,GAAG;QACZ,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,EAAE,EAAE;QAChE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,yBAAyB,EAAE,MAAM,EAAE,E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