@norskvideo/ctl-dev-kit 0.1.35 → 0.1.37
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.
|
@@ -104,6 +104,11 @@ jobs:
|
|
|
104
104
|
# reaches host-published ports via the host-gateway alias, not
|
|
105
105
|
# localhost — same as the integration suite.
|
|
106
106
|
NORSK_TEST_HOST: host.docker.internal
|
|
107
|
+
# Reach launched instances over norsk-net by service DNS (as the
|
|
108
|
+
# integration tier already does) AND, on a ctl that supports it, launch
|
|
109
|
+
# them binding no host ports — so concurrent doc-guide instances can't
|
|
110
|
+
# collide on the product's deterministic host-port bands.
|
|
111
|
+
NORSK_TEST_NET: direct
|
|
107
112
|
run: |
|
|
108
113
|
nix develop .#build --command bash -c '
|
|
109
114
|
set -euo pipefail
|
|
@@ -13,4 +13,13 @@ export declare function startInstanceProxy(opts: {
|
|
|
13
13
|
studioHostPort: number;
|
|
14
14
|
instanceId: string;
|
|
15
15
|
dashboardKey: string;
|
|
16
|
+
/** Explicit upstream studio endpoint. When set, the proxy forwards here
|
|
17
|
+
* instead of `NORSK_TEST_HOST:studioHostPort` — a `noPublish` instance binds
|
|
18
|
+
* no host port, so the caller supplies its `norsk-net` reach
|
|
19
|
+
* (`<id>-studio-1:8000`) via `resolveEndpoint`. Omitted = today's
|
|
20
|
+
* host-published behaviour. */
|
|
21
|
+
upstream?: {
|
|
22
|
+
host: string;
|
|
23
|
+
port: number;
|
|
24
|
+
};
|
|
16
25
|
}): InstanceProxy;
|
|
@@ -27,8 +27,10 @@ export function startInstanceProxy(opts) {
|
|
|
27
27
|
// (host.docker.internal), mirroring @norskvideo/ctl-test-harness's STUDIO_HOST.
|
|
28
28
|
// Without this the proxy's own fetch/WebSocket dials localhost inside the
|
|
29
29
|
// runner container and ConnectionRefuses, so the baked dashboard never loads.
|
|
30
|
-
|
|
31
|
-
const
|
|
30
|
+
// An explicit `upstream` (direct/noPublish mode) overrides both.
|
|
31
|
+
const upstreamHost = opts.upstream?.host ?? process.env.NORSK_TEST_HOST ?? "localhost";
|
|
32
|
+
const upstreamPort = opts.upstream?.port ?? opts.studioHostPort;
|
|
33
|
+
const httpUpstream = `http://${upstreamHost}:${upstreamPort}`;
|
|
32
34
|
const strip = (pathname) => pathname === prefix ? "/" : pathname.startsWith(`${prefix}/`) ? pathname.slice(prefix.length) : pathname;
|
|
33
35
|
const server = Bun.serve({
|
|
34
36
|
port: 0,
|
|
@@ -36,7 +38,7 @@ export function startInstanceProxy(opts) {
|
|
|
36
38
|
const u = new URL(req.url);
|
|
37
39
|
const path = strip(u.pathname);
|
|
38
40
|
if (req.headers.get("upgrade")?.toLowerCase() === "websocket") {
|
|
39
|
-
const upstreamUrl = `ws://${upstreamHost}:${
|
|
41
|
+
const upstreamUrl = `ws://${upstreamHost}:${upstreamPort}${path}${u.search}`;
|
|
40
42
|
const ok = srv.upgrade(req, { data: { upstreamUrl, upstream: null, queue: [] } });
|
|
41
43
|
return ok ? undefined : new Response("ws upgrade failed", { status: 400 });
|
|
42
44
|
}
|
package/local-dev/README.md
CHANGED
|
@@ -57,12 +57,12 @@ HARDWARE=none NORSK_LICENSE_FILE=... bun run iterate # no GPU reservat
|
|
|
57
57
|
To develop a product against **un-published** ctl code or a **locally-built**
|
|
58
58
|
media server, there are three independent override layers. Each is opt-in and
|
|
59
59
|
leaves the default (registry/pinned) path untouched when unset. They compose:
|
|
60
|
-
changing the daemon
|
|
60
|
+
changing the daemon _and_ a ctl library it exposes means layers 1 + 3 together.
|
|
61
61
|
|
|
62
62
|
## 1. The npm layer — local `@norskvideo/ctl-*` checkouts
|
|
63
63
|
|
|
64
64
|
The product depends on `@norskvideo/ctl-{sdk,foundation,product-template-schema,
|
|
65
|
-
|
|
65
|
+
test-harness,commands,dev-kit}` at a caret range. To point one (or all)
|
|
66
66
|
at a local checkout of the ctl monorepo instead of the registry, use
|
|
67
67
|
`dev-link.sh`:
|
|
68
68
|
|
|
@@ -119,9 +119,9 @@ bun run --cwd ../norsk-ctl cli product add --dev-url http://localhost:<backendPo
|
|
|
119
119
|
bun run --cwd ../norsk-ctl cli instance launch-template demo --template <t> --hardware none
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
No linking is needed for this — you are running the daemon
|
|
122
|
+
No linking is needed for this — you are running the daemon _code_ directly. Pair
|
|
123
123
|
with layer 1 (`dev-link.sh`) only if you also changed a `@norskvideo/ctl-*`
|
|
124
|
-
library the product
|
|
124
|
+
library the product _compiles_ against.
|
|
125
125
|
|
|
126
126
|
### Integration tests against source ctl
|
|
127
127
|
|
package/local-dev/dev-link.sh
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# Nothing is committed — the links live only in this repo's node_modules.
|
|
9
9
|
set -euo pipefail
|
|
10
10
|
|
|
11
|
-
PACKAGES=(sdk foundation product-template-schema
|
|
11
|
+
PACKAGES=(sdk foundation product-template-schema test-harness commands dev-kit)
|
|
12
12
|
product_root="$(cd "$(dirname "${BASH_SOURCE[0]}")" && git -C . rev-parse --show-toplevel 2>/dev/null || pwd)"
|
|
13
13
|
|
|
14
14
|
if [ "${1:-}" = "--unlink" ]; then
|