Documentation
02Deployment

Manual deployment

Create the Cloudflare resources yourself and deploy the Worker from your own repository.

Use this method if you maintain a custom fork or prefer not to use InsightFlare Deploy.

Steps

  1. Fork or clone the InsightFlare repository into your GitHub account.
  2. Create these resources in Cloudflare:
    • A D1 database.
    • A KV namespace.
    • An R2 bucket. This is optional; see R2 archive.
  3. Edit wrangler.toml and replace the placeholders YOUR_D1_ID and YOUR_KV_ID with the IDs of the D1 database and the KV namespace. Alternatively, supply the IDs through environment variables so you do not have to edit the file.
  4. Set the secrets MAIN_SECRET and BOOTSTRAP_ADMIN_PASSWORD. Use the Cloudflare dashboard, or the helper scripts pnpm run ops:secret:main and pnpm run ops:secret:bootstrap-admin-password.
  5. Import the repository from the Cloudflare Workers page, or deploy from the command line.

What the build does

The Cloudflare build entry points are pnpm run build (build:cf) and pnpm run deploy (deploy:cf). Before building, the prebuild step:

  1. Applies environment variable overrides to wrangler.toml.
  2. Applies pending D1 migrations to the remote database.
  3. Builds the tracker SDK.

If your Cloudflare account has not enabled Analytics Engine, the deployment is retried without the Analytics Engine bindings. See Analytics Engine.

Helper scripts

CommandPurpose
pnpm run ops:d1:createCreate the D1 database.
pnpm run ops:secret:mainSet the MAIN_SECRET Worker secret.
pnpm run ops:secret:bootstrap-admin-passwordSet the BOOTSTRAP_ADMIN_PASSWORD Worker secret.
pnpm run db:migrate:cfApply D1 migrations to the Cloudflare database.
pnpm run ops:tailTail the online Worker logs.

See the command reference for more.