Skip to content

Latest commit

 

History

History
40 lines (35 loc) · 1.16 KB

SELF_HOSTING.md

File metadata and controls

40 lines (35 loc) · 1.16 KB

Deploying to Cloudflare

Install and login to wrangler

npm install -g wrangler
wrangler login

Create service

Go to workers tab from your cloudflare profile and create a new worker. Use HTTP Handler as service type. The name of worker must match the name field in wrangler.toml.

Setup wrangler.toml

Edit the following variables in wrangler.toml and wrangler.toml.dev:

  • account_id: Get account id by using
    wrangler whoami
  • kv_namespaces: Run the following comands to create a new KV namespace.
    wrangler kv:namespace create DOCUMENTS # gives namespace id
    wrangler kv:namespace create DOCUMENTS --preview # gives preview id for namespace
    Replace current entry for kv_namespaces as:
    kv_namespaces = [
    { binding = "DOCUMENTS", id = <YOUR_ID>, preview_id = <YOUR_PREVIEW_ID> }
    ]

Configure Environment Variables

Set SESSION_SECRET environment for worker.

wrangler secret put SESSION_SECRET

Optionally set other secrets listed at the end of wrangler.toml.

Publish worker

wrangler publish