Deployment
Prerequisites
- Cloudflare account
- Nix with flakes enabled (recommended)
- Or: Rust toolchain with
wasm32-unknown-unknowntarget
Setup
1. Clone and enter dev environment
git clone https://github.com/ananthb/concierge-worker.git
cd concierge-worker
# Using Nix (recommended)
nix develop
# Or using direnv
direnv allow
2. Create Cloudflare resources
# Create D1 database
wrangler d1 create concierge-worker
# Create KV namespace
wrangler kv namespace create concierge-worker
# Create R2 bucket (for file uploads)
wrangler r2 bucket create concierge-worker-uploads
3. Update wrangler.toml
Replace the placeholder IDs with the values from the commands above:
[[d1_databases]]
binding = "DB"
database_name = "concierge-worker"
database_id = "YOUR_DATABASE_ID" # from wrangler d1 create
[[kv_namespaces]]
binding = "KV"
id = "YOUR_KV_ID" # from wrangler kv namespace create
[[r2_buckets]]
binding = "UPLOADS"
bucket_name = "concierge-worker-uploads"
4. Run database migrations
wrangler d1 migrations apply concierge-worker
5. Deploy
Option A: Deploy from local machine
wrangler deploy
Option B: Deploy via GitHub Actions
- Go to your GitHub repo Settings > Secrets and variables > Actions
- Add a secret named
CLOUDFLARE_API_TOKENwith a Cloudflare API token - Push to
mainbranch to trigger automatic deployment
Cloudflare Access Setup
The admin dashboard requires Cloudflare Access for authentication.
- Go to Cloudflare Zero Trust
- Navigate to Access > Applications
- Click Add an application > Self-hosted
- Configure:
- Application name: Concierge Worker Admin
- Session duration: 24 hours (or your preference)
- Application domain:
your-worker.your-subdomain.workers.dev - Path:
/admin
- Add a policy to control who can access (e.g., email ends with
@yourdomain.com) - Save
Local Development
# Run locally with simulated bindings
wrangler dev
# Run locally with real D1/KV/R2 (requires account)
wrangler dev --remote
For local development, set ENVIRONMENT = "development" in wrangler.toml to bypass Access authentication.
Environment Variables
| Variable | Description | Required |
|---|---|---|
ENVIRONMENT | Set to development to bypass auth | No |
See Configuration for secrets setup.