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

Function runSelfhostContainer

e2e/setup/selfhost-docker.boot.ts:85–133  ·  view source on GitHub ↗
(options: RunContainerOptions)

Source from the content-addressed store, hash-verified

83 * same way the boot did.
84 */
85export const runSelfhostContainer = async (options: RunContainerOptions): Promise<void> => {
86 const name = selfhostDockerContainerName(options.port);
87 const volume = selfhostDockerVolumeName(options.port);
88 const args = [
89 "run",
90 "--detach",
91 "--name",
92 name,
93 "--network",
94 "host",
95 "--volume",
96 `${volume}:/data`,
97 "-e",
98 `PORT=${options.port}`,
99 "-e",
100 "BETTER_AUTH_SECRET=executor-selfhost-e2e-secret-0123456789",
101 "-e",
102 `EXECUTOR_BOOTSTRAP_ADMIN_EMAIL=${options.admin.email}`,
103 "-e",
104 `EXECUTOR_BOOTSTRAP_ADMIN_PASSWORD=${options.admin.password}`,
105 "-e",
106 `EXECUTOR_WEB_BASE_URL=${options.webBaseUrl}`,
107 // Same rationale as the dev target: the harness boots loopback MCP/OAuth
108 // test servers and points the instance at them.
109 "-e",
110 "EXECUTOR_ALLOW_LOCAL_NETWORK=true",
111 // The production image runs Better Auth's rate limiter. It sees no proxy
112 // header here, so it pools every caller into one bucket of three sign-ins
113 // per ten seconds, and this suite signs in from 100+ files at once.
114 "-e",
115 "EXECUTOR_DISABLE_AUTH_RATE_LIMIT=true",
116 options.image,
117 ];
118 log(options.logFile, `docker ${args.join(" ")}`);
119 await exec("docker", args).catch((error: { stderr?: string }) => {
120 throw new Error(`selfhost-docker: docker run failed: ${String(error.stderr ?? error)}`);
121 });
122
123 try {
124 await waitForHttp(`${options.webBaseUrl}/api/health`, { timeoutMs: 120_000 });
125 } catch (error) {
126 const { stdout } = await exec("docker", ["logs", "--tail", "100", name]).catch(() => ({
127 stdout: "(docker logs unavailable)",
128 }));
129 log(options.logFile, String(stdout));
130 await exec("docker", ["rm", "-f", name]).catch(() => {});
131 throw error;
132 }
133};
134
135/**
136 * A deployment shutdown, as orchestrators do it: SIGTERM (docker stop's

Callers 2

selfhostDockerTargetFunction · 0.90
bootSelfhostDockerFunction · 0.85

Calls 4

waitForHttpFunction · 0.90
selfhostDockerVolumeNameFunction · 0.85
logFunction · 0.70

Tested by

no test coverage detected