import { SOURCE_URL } from "./site";
export type SelfHostStep = {
title: string;
body: string;
code?: string;
};
export const SELF_HOST_REQUIREMENTS = [
"Bun",
"Docker, to build the runner image",
"A Cloudflare account on the Workers Paid plan with Artifacts enabled",
] as const;
export const SELF_HOST_STEPS: ReadonlyArray<SelfHostStep> = [
{
title: "Get the code",
body: "Clone the repository and install dependencies.",
code: `git clone ${SOURCE_URL}.git gitfor\ncd gitfor\nbun install`,
},
{
title: "Create storage",
body: "Create the database, key-value namespace, bucket and queues, then copy their IDs into wrangler.jsonc.",
code: [
"bunx wrangler d1 create gitfor",
"bunx wrangler kv namespace create gitfor",
"bunx wrangler r2 bucket create gitfor",
"bunx wrangler queues create gitfor-events",
"bunx wrangler queues create gitfor-events-dlq",
"bunx wrangler secret put SECRETS_KEY",
].join("\n"),
},
{
title: "Point it at your domain",
body: "Set PUBLIC_URL to your forge's URL and USERCONTENT_ORIGIN to a separate domain for raw files and uploads, so user content can never read your session. Add GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET to enable GitHub sign-in.",
},
{
title: "Deploy",
body: 'Apply migrations and ship. Create the administrator by signing up with the one-time BOOTSTRAP_TOKEN link (/signup?bootstrap=…), or set ADMIN_EMAIL and verify that address; set SIGNUPS_ENABLED to "false" to keep registration closed.',
code: "bun run deploy",