MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / selfhostDockerTarget

Function selfhostDockerTarget

e2e/targets/selfhost-docker.ts:20–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18 process.env.E2E_SELFHOST_DOCKER_URL ?? `http://localhost:${SELFHOST_DOCKER_PORT}`;
19
20export const selfhostDockerTarget = (): Target => ({
21 name: "selfhost-docker",
22 baseUrl: SELFHOST_DOCKER_BASE_URL,
23 mcpUrl: `${SELFHOST_DOCKER_BASE_URL}/mcp`,
24 capabilities: new Set(["api", "browser", "mcp-oauth"]),
25 newIdentity: () =>
26 Effect.promise(async (): Promise<Identity> => {
27 const { cookieHeader, cookies } = await signInSession(
28 SELFHOST_DOCKER_BASE_URL,
29 SELFHOST_ADMIN,
30 );
31 return {
32 label: SELFHOST_ADMIN.email,
33 credentials: SELFHOST_ADMIN,
34 headers: { cookie: cookieHeader },
35 cookies,
36 };
37 }),
38 mcpConsent: (identity: Identity) =>
39 cookieConsentStrategy({
40 appBaseUrl: SELFHOST_DOCKER_BASE_URL,
41 email: identity.credentials?.email ?? SELFHOST_ADMIN.email,
42 password: identity.credentials?.password ?? SELFHOST_ADMIN.password,
43 }),
44 // A real deployment cycle, not a warm `docker restart`: graceful stop
45 // (SIGTERM + docker's grace), remove the container, start a NEW one from
46 // the same image against the same data volume — what an upgrade, reboot,
47 // or `compose down && up` does to a user's instance. Only when this suite
48 // owns the container (attach mode can't assume the instance is docker).
49 ...(process.env.E2E_SELFHOST_DOCKER_URL
50 ? {}
51 : {
52 restart: () =>
53 Effect.promise(async () => {
54 // Published by the globalsetup after it resolved/built the image.
55 const image = process.env.E2E_SELFHOST_DOCKER_RESOLVED_IMAGE;
56 if (!image) throw new Error("selfhost-docker: no resolved image — boot ran?");
57 await stopSelfhostContainer(SELFHOST_DOCKER_PORT);
58 await runSelfhostContainer({
59 image,
60 port: SELFHOST_DOCKER_PORT,
61 webBaseUrl: SELFHOST_DOCKER_BASE_URL,
62 admin: SELFHOST_ADMIN,
63 });
64 }),
65 }),
66});

Callers

nothing calls this directly

Calls 3

signInSessionFunction · 0.90
stopSelfhostContainerFunction · 0.90
runSelfhostContainerFunction · 0.90

Tested by

no test coverage detected