Compare commits
2 Commits
@paperclip
...
@paperclip
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c672b71f7f | ||
|
|
01c5a6f198 |
@@ -75,6 +75,11 @@ export async function bootstrapCeoInvite(opts: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const db = createDb(dbUrl);
|
const db = createDb(dbUrl);
|
||||||
|
const closableDb = db as typeof db & {
|
||||||
|
$client?: {
|
||||||
|
end?: (options?: { timeout?: number }) => Promise<void>;
|
||||||
|
};
|
||||||
|
};
|
||||||
try {
|
try {
|
||||||
const existingAdminCount = await db
|
const existingAdminCount = await db
|
||||||
.select()
|
.select()
|
||||||
@@ -122,5 +127,7 @@ export async function bootstrapCeoInvite(opts: {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
p.log.error(`Could not create bootstrap invite: ${err instanceof Error ? err.message : String(err)}`);
|
p.log.error(`Could not create bootstrap invite: ${err instanceof Error ? err.message : String(err)}`);
|
||||||
p.log.info("If using embedded-postgres, start the Paperclip server and run this command again.");
|
p.log.info("If using embedded-postgres, start the Paperclip server and run this command again.");
|
||||||
|
} finally {
|
||||||
|
await closableDb.$client?.end?.({ timeout: 5 }).catch(() => undefined);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,20 +49,27 @@ wait_for_http() {
|
|||||||
|
|
||||||
generate_bootstrap_invite_url() {
|
generate_bootstrap_invite_url() {
|
||||||
local bootstrap_output
|
local bootstrap_output
|
||||||
bootstrap_output="$(
|
local bootstrap_status
|
||||||
|
if bootstrap_output="$(
|
||||||
docker exec \
|
docker exec \
|
||||||
-e PAPERCLIP_DEPLOYMENT_MODE="$PAPERCLIP_DEPLOYMENT_MODE" \
|
-e PAPERCLIP_DEPLOYMENT_MODE="$PAPERCLIP_DEPLOYMENT_MODE" \
|
||||||
-e PAPERCLIP_DEPLOYMENT_EXPOSURE="$PAPERCLIP_DEPLOYMENT_EXPOSURE" \
|
-e PAPERCLIP_DEPLOYMENT_EXPOSURE="$PAPERCLIP_DEPLOYMENT_EXPOSURE" \
|
||||||
-e PAPERCLIP_PUBLIC_URL="$PAPERCLIP_PUBLIC_URL" \
|
-e PAPERCLIP_PUBLIC_URL="$PAPERCLIP_PUBLIC_URL" \
|
||||||
-e PAPERCLIP_HOME="/paperclip" \
|
-e PAPERCLIP_HOME="/paperclip" \
|
||||||
"$CONTAINER_NAME" bash -lc \
|
"$CONTAINER_NAME" bash -lc \
|
||||||
'npx --yes "paperclipai@${PAPERCLIPAI_VERSION}" auth bootstrap-ceo --data-dir "$PAPERCLIP_HOME" --base-url "$PAPERCLIP_PUBLIC_URL"' \
|
'timeout 20s npx --yes "paperclipai@${PAPERCLIPAI_VERSION}" auth bootstrap-ceo --data-dir "$PAPERCLIP_HOME" --base-url "$PAPERCLIP_PUBLIC_URL"' \
|
||||||
2>&1
|
2>&1
|
||||||
)" || {
|
)"; then
|
||||||
|
bootstrap_status=0
|
||||||
|
else
|
||||||
|
bootstrap_status=$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $bootstrap_status -ne 0 && $bootstrap_status -ne 124 ]]; then
|
||||||
echo "Smoke bootstrap failed: could not run bootstrap-ceo inside container" >&2
|
echo "Smoke bootstrap failed: could not run bootstrap-ceo inside container" >&2
|
||||||
printf '%s\n' "$bootstrap_output" >&2
|
printf '%s\n' "$bootstrap_output" >&2
|
||||||
return 1
|
return 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
local invite_url
|
local invite_url
|
||||||
invite_url="$(
|
invite_url="$(
|
||||||
@@ -77,6 +84,10 @@ generate_bootstrap_invite_url() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $bootstrap_status -eq 124 ]]; then
|
||||||
|
echo " Smoke bootstrap: bootstrap-ceo timed out after printing invite URL; continuing" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
printf '%s\n' "$invite_url"
|
printf '%s\n' "$invite_url"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,15 @@ function CloudAccessGate() {
|
|||||||
queryKey: queryKeys.health,
|
queryKey: queryKeys.health,
|
||||||
queryFn: () => healthApi.get(),
|
queryFn: () => healthApi.get(),
|
||||||
retry: false,
|
retry: false,
|
||||||
|
refetchInterval: (query) => {
|
||||||
|
const data = query.state.data as
|
||||||
|
| { deploymentMode?: "local_trusted" | "authenticated"; bootstrapStatus?: "ready" | "bootstrap_pending" }
|
||||||
|
| undefined;
|
||||||
|
return data?.deploymentMode === "authenticated" && data.bootstrapStatus === "bootstrap_pending"
|
||||||
|
? 2000
|
||||||
|
: false;
|
||||||
|
},
|
||||||
|
refetchIntervalInBackground: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const isAuthenticatedMode = healthQuery.data?.deploymentMode === "authenticated";
|
const isAuthenticatedMode = healthQuery.data?.deploymentMode === "authenticated";
|
||||||
|
|||||||
Reference in New Issue
Block a user