35dbaedf69
* add amin email regex env var * fix displayed init command for self-hosted setups * shared env var to disable telemetry in cli and webapp * pin sdk version during init * if specified, add api url to dev command shown after init * improve checkpoint support detection * control forced checkpoint simulation via env var * add public init to providers * better checkpoint support check for coordinator * add docker to coordinator image * update docker provider containerfile * bump remaining containers to node 20 * add infra image build to default publish workflow * lockfile * remove concurrency group from infra workflow * add docker provider to build matrix * fix var subst * checkpoint test is docker specific * enable v3 projects by default on self-hosted instances * fix v3 setup command again * add default posthog key * self-hosting docs * add latest tags to versioned infra and webapp builds * some checkpoint errors should skip retrying * add changeset * shorten paragraph * some docs updates * update tunnelling section * add registry setup section * use correct cli push flag * add checkout to v3 branch * update the worker machine setup steps * fix infra build * small docs update * remove unused feature function * Revert "remove unused feature function" This reverts commit cfe07887a12b6893dca8ce499964481a9b3dc9db. * fix self-hosted v3 feature gate * add note about missing arm support * simplify helper script syntax
275 lines
8.6 KiB
TypeScript
275 lines
8.6 KiB
TypeScript
import { useProject } from "~/hooks/useProject";
|
||
import { InlineCode } from "./code/InlineCode";
|
||
import {
|
||
ClientTabs,
|
||
ClientTabsContent,
|
||
ClientTabsList,
|
||
ClientTabsTrigger,
|
||
} from "./primitives/ClientTabs";
|
||
import { ClipboardField } from "./primitives/ClipboardField";
|
||
import { Paragraph } from "./primitives/Paragraph";
|
||
import { useAppOrigin } from "~/hooks/useAppOrigin";
|
||
|
||
export function InitCommand({ appOrigin, apiKey }: { appOrigin: string; apiKey: string }) {
|
||
return (
|
||
<ClientTabs defaultValue="npm">
|
||
<ClientTabsList>
|
||
<ClientTabsTrigger value={"npm"}>npm</ClientTabsTrigger>
|
||
<ClientTabsTrigger value={"pnpm"}>pnpm</ClientTabsTrigger>
|
||
<ClientTabsTrigger value={"yarn"}>yarn</ClientTabsTrigger>
|
||
</ClientTabsList>
|
||
<ClientTabsContent value={"npm"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
className="mb-4"
|
||
secure={`npx @trigger.dev/cli@latest init -k ••••••••• -t ${appOrigin}`}
|
||
value={`npx @trigger.dev/cli@latest init -k ${apiKey} -t ${appOrigin}`}
|
||
/>
|
||
</ClientTabsContent>
|
||
<ClientTabsContent value={"pnpm"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
className="mb-4"
|
||
secure={`pnpm dlx @trigger.dev/cli@latest init -k ••••••••• -t ${appOrigin}`}
|
||
value={`pnpm dlx @trigger.dev/cli@latest init -k ${apiKey} -t ${appOrigin}`}
|
||
/>
|
||
</ClientTabsContent>
|
||
<ClientTabsContent value={"yarn"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
className="mb-4"
|
||
secure={`yarn dlx @trigger.dev/cli@latest init -k ••••••••• -t ${appOrigin}`}
|
||
value={`yarn dlx @trigger.dev/cli@latest init -k ${apiKey} -t ${appOrigin}`}
|
||
/>
|
||
</ClientTabsContent>
|
||
</ClientTabs>
|
||
);
|
||
}
|
||
|
||
export function RunDevCommand({ extra }: { extra?: string }) {
|
||
return (
|
||
<ClientTabs defaultValue="npm">
|
||
<ClientTabsList>
|
||
<ClientTabsTrigger value={"npm"}>npm</ClientTabsTrigger>
|
||
<ClientTabsTrigger value={"pnpm"}>pnpm</ClientTabsTrigger>
|
||
<ClientTabsTrigger value={"yarn"}>yarn</ClientTabsTrigger>
|
||
</ClientTabsList>
|
||
<ClientTabsContent value={"npm"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
className="mb-4"
|
||
value={`npm run dev${extra ? ` ${extra}` : ""}`}
|
||
/>
|
||
</ClientTabsContent>
|
||
<ClientTabsContent value={"pnpm"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
className="mb-4"
|
||
value={`pnpm run dev${extra ? ` ${extra}` : ""}`}
|
||
/>
|
||
</ClientTabsContent>
|
||
<ClientTabsContent value={"yarn"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
className="mb-4"
|
||
value={`yarn run dev${extra ? ` ${extra}` : ""}`}
|
||
/>
|
||
</ClientTabsContent>
|
||
</ClientTabs>
|
||
);
|
||
}
|
||
|
||
export function TriggerDevCommand({ extra }: { extra?: string }) {
|
||
return (
|
||
<ClientTabs defaultValue="npm">
|
||
<ClientTabsList>
|
||
<ClientTabsTrigger value={"npm"}>npm</ClientTabsTrigger>
|
||
<ClientTabsTrigger value={"pnpm"}>pnpm</ClientTabsTrigger>
|
||
<ClientTabsTrigger value={"yarn"}>yarn</ClientTabsTrigger>
|
||
</ClientTabsList>
|
||
<ClientTabsContent value={"npm"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
className="mb-4"
|
||
value={`npx @trigger.dev/cli@latest dev${extra ? ` ${extra}` : ""}`}
|
||
/>
|
||
</ClientTabsContent>
|
||
<ClientTabsContent value={"pnpm"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
className="mb-4"
|
||
value={`pnpm dlx @trigger.dev/cli@latest dev${extra ? ` ${extra}` : ""}`}
|
||
/>
|
||
</ClientTabsContent>
|
||
<ClientTabsContent value={"yarn"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
className="mb-4"
|
||
value={`yarn dlx @trigger.dev/cli@latest dev${extra ? ` ${extra}` : ""}`}
|
||
/>
|
||
</ClientTabsContent>
|
||
</ClientTabs>
|
||
);
|
||
}
|
||
|
||
export function TriggerDevStep({ extra }: { extra?: string }) {
|
||
return (
|
||
<>
|
||
<Paragraph spacing>
|
||
In a <span className="text-amber-400">separate terminal window or tab</span> run:
|
||
</Paragraph>
|
||
<TriggerDevCommand extra={extra} />
|
||
<Paragraph spacing variant="small">
|
||
If you’re not running on the default you can specify the port by adding{" "}
|
||
<InlineCode variant="extra-small">--port 3001</InlineCode> to the end.
|
||
</Paragraph>
|
||
<Paragraph spacing variant="small">
|
||
You should leave the <InlineCode variant="extra-small">dev</InlineCode> command running when
|
||
you're developing.
|
||
</Paragraph>
|
||
</>
|
||
);
|
||
}
|
||
|
||
// Trigger.dev version 3 setup commands
|
||
const v3PackageTag = "beta";
|
||
|
||
function getApiUrlArg() {
|
||
const appOrigin = useAppOrigin();
|
||
|
||
let apiUrl: string | undefined = undefined;
|
||
|
||
switch (appOrigin) {
|
||
case "https://cloud.trigger.dev":
|
||
// don't display the arg, use the CLI default
|
||
break;
|
||
case "https://test-cloud.trigger.dev":
|
||
apiUrl = "https://test-api.trigger.dev";
|
||
break;
|
||
case "https://internal.trigger.dev":
|
||
apiUrl = "https://internal-api.trigger.dev";
|
||
break;
|
||
default:
|
||
apiUrl = appOrigin;
|
||
break;
|
||
}
|
||
|
||
return apiUrl ? `-a ${apiUrl}` : undefined;
|
||
}
|
||
|
||
export function InitCommandV3() {
|
||
const project = useProject();
|
||
const projectRef = project.ref;
|
||
|
||
const apiUrlArg = getApiUrlArg();
|
||
|
||
const initCommandParts = [`trigger.dev@${v3PackageTag}`, "init", `-p ${projectRef}`, apiUrlArg];
|
||
const initCommand = initCommandParts.filter(Boolean).join(" ");
|
||
|
||
return (
|
||
<ClientTabs defaultValue="npm">
|
||
<ClientTabsList>
|
||
<ClientTabsTrigger value={"npm"}>npm</ClientTabsTrigger>
|
||
<ClientTabsTrigger value={"pnpm"}>pnpm</ClientTabsTrigger>
|
||
<ClientTabsTrigger value={"yarn"}>yarn</ClientTabsTrigger>
|
||
</ClientTabsList>
|
||
<ClientTabsContent value={"npm"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
iconButton
|
||
className="mb-4"
|
||
value={`npx ${initCommand}`}
|
||
/>
|
||
</ClientTabsContent>
|
||
<ClientTabsContent value={"pnpm"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
iconButton
|
||
className="mb-4"
|
||
value={`pnpm dlx ${initCommand}`}
|
||
/>
|
||
</ClientTabsContent>
|
||
<ClientTabsContent value={"yarn"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
iconButton
|
||
className="mb-4"
|
||
value={`yarn dlx ${initCommand}`}
|
||
/>
|
||
</ClientTabsContent>
|
||
</ClientTabs>
|
||
);
|
||
}
|
||
|
||
export function TriggerDevStepV3() {
|
||
return (
|
||
<ClientTabs defaultValue="npm">
|
||
<ClientTabsList>
|
||
<ClientTabsTrigger value={"npm"}>npm</ClientTabsTrigger>
|
||
<ClientTabsTrigger value={"pnpm"}>pnpm</ClientTabsTrigger>
|
||
<ClientTabsTrigger value={"yarn"}>yarn</ClientTabsTrigger>
|
||
</ClientTabsList>
|
||
<ClientTabsContent value={"npm"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
iconButton
|
||
className="mb-4"
|
||
value={`npx trigger.dev@${v3PackageTag} dev`}
|
||
/>
|
||
</ClientTabsContent>
|
||
<ClientTabsContent value={"pnpm"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
iconButton
|
||
className="mb-4"
|
||
value={`pnpm dlx trigger.dev@${v3PackageTag} dev`}
|
||
/>
|
||
</ClientTabsContent>
|
||
<ClientTabsContent value={"yarn"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
iconButton
|
||
className="mb-4"
|
||
value={`yarn dlx trigger.dev@${v3PackageTag} dev`}
|
||
/>
|
||
</ClientTabsContent>
|
||
</ClientTabs>
|
||
);
|
||
}
|
||
|
||
export function TriggerLoginStepV3() {
|
||
return (
|
||
<ClientTabs defaultValue="npm">
|
||
<ClientTabsList>
|
||
<ClientTabsTrigger value={"npm"}>npm</ClientTabsTrigger>
|
||
<ClientTabsTrigger value={"pnpm"}>pnpm</ClientTabsTrigger>
|
||
<ClientTabsTrigger value={"yarn"}>yarn</ClientTabsTrigger>
|
||
</ClientTabsList>
|
||
<ClientTabsContent value={"npm"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
iconButton
|
||
className="mb-4"
|
||
value={`npx trigger.dev@${v3PackageTag} login`}
|
||
/>
|
||
</ClientTabsContent>
|
||
<ClientTabsContent value={"pnpm"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
iconButton
|
||
className="mb-4"
|
||
value={`pnpm dlx trigger.dev@${v3PackageTag} login`}
|
||
/>
|
||
</ClientTabsContent>
|
||
<ClientTabsContent value={"yarn"}>
|
||
<ClipboardField
|
||
variant="primary/medium"
|
||
iconButton
|
||
className="mb-4"
|
||
value={`yarn dlx trigger.dev@${v3PackageTag} login`}
|
||
/>
|
||
</ClientTabsContent>
|
||
</ClientTabs>
|
||
);
|
||
}
|