openpalm 0.9.5 → 0.9.6
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/e2e/start-wizard-server.ts +64 -0
- package/package.json +1 -1
- package/src/commands/install.ts +12 -7
- package/src/commands/start.ts +2 -2
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bun-only launcher for the CLI setup wizard server.
|
|
3
|
+
*
|
|
4
|
+
* Called from Playwright tests as a child process:
|
|
5
|
+
* bun run packages/cli/e2e/start-wizard-server.ts <port>
|
|
6
|
+
*
|
|
7
|
+
* Starts the wizard server on the given port with a temp config directory
|
|
8
|
+
* so tests do not affect real dev state. Prints "WIZARD_READY:<port>" to
|
|
9
|
+
* stdout when listening, which the Playwright test waits for.
|
|
10
|
+
*/
|
|
11
|
+
import { createSetupServer } from "../src/setup-wizard/server.ts";
|
|
12
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
13
|
+
import type { CoreAssetProvider } from "@openpalm/lib";
|
|
14
|
+
|
|
15
|
+
const port = parseInt(Bun.argv[2] || "18100", 10);
|
|
16
|
+
const tmpBase = `/tmp/openpalm-wizard-test-${port}`;
|
|
17
|
+
|
|
18
|
+
// Create minimal directory structure so the server can start.
|
|
19
|
+
// API endpoints that need real files are mocked at the browser level
|
|
20
|
+
// by Playwright's page.route(), so these dirs just prevent crashes.
|
|
21
|
+
mkdirSync(`${tmpBase}/config`, { recursive: true });
|
|
22
|
+
mkdirSync(`${tmpBase}/data`, { recursive: true });
|
|
23
|
+
mkdirSync(`${tmpBase}/state/artifacts`, { recursive: true });
|
|
24
|
+
|
|
25
|
+
writeFileSync(`${tmpBase}/config/secrets.env`, "# test\n");
|
|
26
|
+
writeFileSync(`${tmpBase}/state/artifacts/stack.env`, "OPENPALM_SETUP_COMPLETE=false\n");
|
|
27
|
+
|
|
28
|
+
// No-op asset provider — mocked tests intercept API calls before they
|
|
29
|
+
// reach performSetup(), so these methods are never invoked.
|
|
30
|
+
const noopAssetProvider: CoreAssetProvider = {
|
|
31
|
+
coreCompose: () => "",
|
|
32
|
+
caddyfile: () => "",
|
|
33
|
+
ollamaCompose: () => "",
|
|
34
|
+
agentsMd: () => "",
|
|
35
|
+
opencodeConfig: () => "",
|
|
36
|
+
adminOpencodeConfig: () => "",
|
|
37
|
+
secretsSchema: () => "",
|
|
38
|
+
stackSchema: () => "",
|
|
39
|
+
cleanupLogs: () => "",
|
|
40
|
+
cleanupData: () => "",
|
|
41
|
+
validateConfig: () => "",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// Override state/config home so the server doesn't touch real dirs.
|
|
45
|
+
process.env.OPENPALM_CONFIG_HOME = `${tmpBase}/config`;
|
|
46
|
+
process.env.OPENPALM_STATE_HOME = `${tmpBase}/state`;
|
|
47
|
+
process.env.OPENPALM_DATA_HOME = `${tmpBase}/data`;
|
|
48
|
+
|
|
49
|
+
const { server } = createSetupServer(port, {
|
|
50
|
+
configDir: `${tmpBase}/config`,
|
|
51
|
+
assetProvider: noopAssetProvider,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
console.log(`WIZARD_READY:${port}`);
|
|
55
|
+
|
|
56
|
+
// Keep alive until killed
|
|
57
|
+
process.on("SIGTERM", () => {
|
|
58
|
+
server.stop();
|
|
59
|
+
process.exit(0);
|
|
60
|
+
});
|
|
61
|
+
process.on("SIGINT", () => {
|
|
62
|
+
server.stop();
|
|
63
|
+
process.exit(0);
|
|
64
|
+
});
|
package/package.json
CHANGED
package/src/commands/install.ts
CHANGED
|
@@ -222,25 +222,29 @@ export async function bootstrapInstall(options: InstallOptions): Promise<void> {
|
|
|
222
222
|
const managedServices = buildManagedServiceNames(state);
|
|
223
223
|
|
|
224
224
|
wizard.updateDeployStatus(
|
|
225
|
-
|
|
225
|
+
allServices.map(s => ({ service: s, status: 'pending', label: 'Waiting...' })),
|
|
226
226
|
);
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
// Include admin profile so admin + docker-socket-proxy start by default
|
|
229
|
+
const adminServices = ['admin', 'docker-socket-proxy'];
|
|
230
|
+
const allServices = [...managedServices, ...adminServices];
|
|
231
|
+
|
|
232
|
+
await runDockerCompose([...composeArgs, '--profile', 'admin', 'pull', ...allServices]).catch(() => {
|
|
229
233
|
// Pull failure is non-fatal — images may already be cached
|
|
230
234
|
});
|
|
231
235
|
|
|
232
236
|
wizard.updateDeployStatus(
|
|
233
|
-
|
|
237
|
+
allServices.map(s => ({ service: s, status: 'pulling', label: 'Starting...' })),
|
|
234
238
|
);
|
|
235
239
|
|
|
236
|
-
await runDockerCompose([...composeArgs, 'up', '-d', ...
|
|
240
|
+
await runDockerCompose([...composeArgs, '--profile', 'admin', 'up', '-d', ...allServices]);
|
|
237
241
|
|
|
238
242
|
wizard.markAllRunning();
|
|
239
243
|
|
|
240
244
|
console.log(JSON.stringify({
|
|
241
245
|
ok: true,
|
|
242
246
|
mode: 'install',
|
|
243
|
-
services:
|
|
247
|
+
services: allServices,
|
|
244
248
|
}, null, 2));
|
|
245
249
|
|
|
246
250
|
// Give the browser a moment to poll the final status, then stop
|
|
@@ -264,12 +268,13 @@ export async function bootstrapInstall(options: InstallOptions): Promise<void> {
|
|
|
264
268
|
const state = await ensureStagedState();
|
|
265
269
|
const composeArgs = fullComposeArgs(state);
|
|
266
270
|
const managedServices = buildManagedServiceNames(state);
|
|
271
|
+
const allServices = [...managedServices, 'admin', 'docker-socket-proxy'];
|
|
267
272
|
|
|
268
|
-
await runDockerCompose([...composeArgs, 'up', '-d', ...
|
|
273
|
+
await runDockerCompose([...composeArgs, '--profile', 'admin', 'up', '-d', ...allServices]);
|
|
269
274
|
|
|
270
275
|
console.log(JSON.stringify({
|
|
271
276
|
ok: true,
|
|
272
277
|
mode: 'update',
|
|
273
|
-
services:
|
|
278
|
+
services: allServices,
|
|
274
279
|
}, null, 2));
|
|
275
280
|
}
|
package/src/commands/start.ts
CHANGED
|
@@ -16,8 +16,8 @@ export default defineCommand({
|
|
|
16
16
|
},
|
|
17
17
|
'with-admin': {
|
|
18
18
|
type: 'boolean',
|
|
19
|
-
description: 'Include admin UI and docker-socket-proxy',
|
|
20
|
-
default:
|
|
19
|
+
description: 'Include admin UI and docker-socket-proxy (use --no-with-admin to skip)',
|
|
20
|
+
default: true,
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
async run({ args }) {
|