Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

1.3 KB
Raw Blame

Cloudflare Workers

Source code for our Cloudflare Workers.

Workers are npm workspaces that share a root package.json and base tsconfig, but are deployed individually.

Deploying

Install dependencies:

npm ci

Log in if needed, then deploy the worker:

npm exec --workspace health-check -- wrangler login
npm exec --workspace health-check -- wrangler deploy

Replace health-check with the worker to deploy. Wrangler credentials are shared across the workspaces.

Stream logs from a deployed worker:

npm exec --workspace health-check -- wrangler tail

Log out when finished:

npm exec --workspace health-check -- wrangler logout

Creating a new worker

Copy an existing workspace. This avoids the unnecessary boilerplate in Cloudflare's template. To create one from scratch, use npm create cloudflare@latest.

To import an existing worker from the Cloudflare dashboard, use

npm create cloudflare@2 existing-worker-name -- --type pre-existing --existing-script existing-worker-name

Logging

Attach the tail worker by adding this to wrangler.toml:

tail_consumers = [{ service = "tail" }]

The tail worker sends console output and uncaught exceptions to Grafana.