Skip to content

Install with the Deploy button

The repository has a Deploy to Cloudflare button. It deploys the main Worker (amable-core: dashboard, CRM, automations, email and API) into your account from the browser. To get a complete installation you then add the edge Worker and the first owner with the setup script.

Deploy button Setup script
Where you run it In the browser On your computer
Deploys amable-core only amable-core and amable-edge
Creates the first owner No Yes (--owner-email)
Secrets You type them in the form Generated for you
Result A partial installation, to be completed with the script A complete installation

If you are comfortable with a terminal, the setup script alone is simpler. The button is useful to see the dashboard deployed quickly, or when your Git provider is where you want the code to live.

The button link is:

https://deploy.workers.cloudflare.com/?url=https://github.com/Ratne/AmableData/tree/main/deploy/cloudflare

Cloudflare’s Deploy to Cloudflare flow:

  1. clones the repository into your own GitHub or GitLab account,
  2. lets you adjust the project name, Worker name and resource names,
  3. builds and deploys with Workers Builds, and provisions the resources declared in the Wrangler configuration.

amabledata’s button points at deploy/cloudflare, whose wrangler.jsonc declares:

Declared in deploy/cloudflare/wrangler.jsonc Value
Worker name amable-core
Dashboard assets apps/web/dist (built by the project’s build script)
D1 database binding DB, name amable-installation
Durable Objects TenantDb, Engine, MailDb, EditSession, BookingCalendar
Queues producers and consumers for email-send, events-rollup, webhooks-out, form-submissions, esign-seal
CPU limit limits.cpu_ms 120000 on amable-core
R2 bucket binding FILES, name amable-files
Cron Trigger */5 * * * *
Rate limiting RL_AUTH (60/60 s), RL_API (600/60 s)
Variables ENVIRONMENT=production, ERROR_REPORTING=local

The package.json of that folder runs the monorepo build (pnpm install --frozen-lockfile && pnpm run build:web) and deploys with this configuration.

The form lists the secrets of deploy/cloudflare/.dev.vars.example:

Secret What to enter
PASSWORD_PEPPER A random value: openssl rand -base64 32. Never change it once users exist.
AUTH_ENCRYPTION_KEY A random value: openssl rand -base64 32 (it must decode to exactly 32 bytes). Never change it once users exist.
EMAIL_TOKEN_SECRET A random value: openssl rand -base64 32
EDGE_GATEWAY_SECRET A random value: openssl rand -base64 32. The setup script later replaces it with a new value shared by the core and the edge Worker (Cloudflare never reveals a secret, so the script cannot copy yours to the edge).
APP_ORIGIN The public origin of the app, for example https://amable-core.<your-subdomain>.workers.dev

Without PASSWORD_PEPPER and AUTH_ENCRYPTION_KEY a production Worker refuses to start authentication.

Until the edge Worker is deployed:

  • web analytics, hosted forms, booking pages and landing pages answer 503;
  • email links point at APP_ORIGIN instead of a tracking hostname;
  • there is no first owner, so nobody can sign in yet.
  1. Make sure the Cloudflare account is on Workers Paid with R2 enabled. See Plans and billing.

  2. Open the button link (above) or select Deploy to Cloudflare in the repository README.

  3. Sign in to Cloudflare and connect your GitHub or GitLab account when asked.

  4. Keep the proposed names: the Worker amable-core, the database amable-installation, the bucket amable-files and the queue names. The setup script later looks for exactly these names.

  5. Fill in the secrets listed above. Keep a copy of PASSWORD_PEPPER and AUTH_ENCRYPTION_KEY in your password manager.

  6. Start the deployment and wait for the build to finish. The dashboard opens at https://amable-core.<your-subdomain>.workers.dev.

Complete the installation with the setup script

Section titled “Complete the installation with the setup script”
  1. On your computer, clone your copy of the repository (the one the button created) or the original one, check out the same release, and install: pnpm install.

  2. Sign in: pnpm exec wrangler login.

  3. Run the full setup:

    Terminal window
    pnpm self-host:setup --deploy \
    --app-origin https://amable-core.<sub>.workers.dev \
    --edge-origin https://amable-edge.<sub>.workers.dev \
    --owner-email you@example.com --workspace "My company"

    It finds the existing database, bucket and queues, creates the analytics queue, deploys the edge, redeploys the core with the analytics binding, and prints the owner invitation link. It keeps every secret you already set except EDGE_GATEWAY_SECRET: since only the core has it, the script writes one new random value to both Workers and prints core EDGE_GATEWAY_SECRET: missing on the other worker, both rotated.

  4. Open the link and create the owner account. If you lose it or it expires before anyone signs up, rerun the same command: it prints a new link for the same workspace and the old one stops working.

Item Value
Button URL https://deploy.workers.cloudflare.com/?url=https://github.com/Ratne/AmableData/tree/main/deploy/cloudflare
Config used deploy/cloudflare/wrangler.jsonc
Secrets template deploy/cloudflare/.dev.vars.example
Build command cd ../.. && pnpm install --frozen-lockfile && pnpm run build:web
Deploy command cd ../.. && pnpm --filter @amable/app-core exec wrangler deploy --config ../../deploy/cloudflare/wrangler.jsonc
Deploys amable-core only
Missing until the script runs amable-edge, the analytics queue, the ANALYTICS binding, EDGE_ORIGIN, the first owner
  • The button deploys from the main branch of the repository. For a specific release, use the setup script with a checked-out tag.
  • Cloudflare’s Deploy button supports only public GitHub and GitLab repositories and has limited monorepo support; if the build fails in Workers Builds, install with the setup script instead.
  • You need permission to create Workers, D1, R2 and Queues on the Cloudflare account.
Symptom Cause Fix
The build fails in Workers Builds Monorepo build or dependency install failed Use the setup script, which builds on your computer.
The dashboard shows an authentication configuration error PASSWORD_PEPPER or AUTH_ENCRYPTION_KEY missing or invalid Set them (AUTH_ENCRYPTION_KEY must be base64 of exactly 32 bytes) and redeploy.
Analytics pages answer analytics unavailable (503) The edge Worker is not deployed Complete the installation with the setup script.
Hosted forms or booking pages fail after deploying the edge EDGE_GATEWAY_SECRET differs between the two Workers (for example it was changed by hand on one of them) Delete it on the edge (pnpm exec wrangler secret delete EDGE_GATEWAY_SECRET --config apps/edge/wrangler.self-host.jsonc) and rerun the setup script with --deploy: both Workers get a new shared value.
Nobody can sign in No owner yet, or the first-owner link was lost or expired Run the setup script with --deploy and --owner-email; while nobody has signed up, every run prints a new link.