---
title: "Cloudflare Workers पर वेब टियर"
description: "Cloudflare Workers पर Quire का सीमित वेब टियर चलाएँ।"
image: "https://docs.quirelms.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.quirelms.com/hi/llms.txt
> Use this file to discover all available pages before exploring further.

# Cloudflare Workers पर वेब टियर

<span id="the-web-tier-on-cloudflare-workers"></span>

डिज़ाइन `docs/architecture/23-ops.md` के अनुभाग 6 में है। Workers सीमित वेब
टियर चलाते हैं। Workers पर feature parity दायरे से बाहर है (PRD का अनुभाग 12):
यह लक्ष्य जो नहीं कर सकता, उसे शुरू होते समय नाम से अस्वीकार किया जाता है।

## इस रिलीज़ में स्थिति <!--quire:status-in-this-release-->

कॉन्फ़िगरेशन तैयार है (`apps/web/wrangler.jsonc`, `cloudflare-module` Nitro
preset, Hyperdrive bridge और startup जाँच)। Worker को R2 के लिए S3-संगत storage
(`QUIRE_STORAGE_DRIVER=s3`), requests के बीच realtime driver
(`QUIRE_REALTIME_DRIVER=durable_objects` या `centrifugo`), साझा cache
(`QUIRE_CACHE_DRIVER=postgres` या `valkey`) और HTTP email provider चाहिए। इनके
बिना Worker शुरू होने से मना करता है और log हर setting का नाम देता है। Durable
Objects driver `apps/realtime-worker` में realtime Worker का client है (fan-out,
presence और history के लिए प्रति channel एक Durable Object, disconnect के लिए
प्रति व्यक्ति एक); नीचे बताए अनुसार इसे साथ deploy करें या Centrifugo इस्तेमाल करें।

## हिस्से <!--quire:the-pieces-->

| हिस्सा | Cloudflare पर |
| --- | --- |
| `web` | `nodejs_compat` वाला Worker |
| Postgres | बाहरी, Hyperdrive से पहुँचा: application role के लिए `HYPERDRIVE`, उसी physical database पर report role के लिए `REPORT_HYPERDRIVE`। शुरू होते समय web tier हर connection string को `DATABASE_URL` और `QUIRE_REPORT_DATABASE_URL` में कॉपी करता है |
| फ़ाइलें | R2, इसकी S3 API से (`S3_ENDPOINT=https://<account>.r2.cloudflarestorage.com`); `FILES` binding bucket जोड़ता है |
| Background jobs | लिखने वाली request के साथ job जोड़ना हो तो Hyperdrive पर pg-boss। Companion worker पर `QUIRE_QUEUE_DRIVER=cloudflare` हो तो हल्के jobs (बिना क्रम की सूचनाएँ और webhook delivery) Cloudflare Queues से जाते हैं, इसलिए उनके लिए Postgres poll नहीं होता। Companion worker दोनों चलाता है |
| Realtime | Durable Objects वाला realtime Worker, `apps/realtime-worker` |
| `worker`, `scheduler`, `collab`, `content`, ClamAV, Gotenberg, ffmpeg | Companion container host। Worker इन्हें नहीं चला सकता |
| Tracing | Workers observability, `wrangler.jsonc` में चालू |

`REPORT_HYPERDRIVE`, `HYPERDRIVE` द्वारा नामित physical database के लिए report
role देता है। नीचे बताए अनुसार यह लक्ष्य अतिरिक्त physical databases पर pin किए
tenant की सेवा नहीं करता।

## यह लक्ष्य क्या नहीं कर सकता <!--quire:what-this-target-cannot-do-->

शुरू होते समय सभी समस्याएँ एक साथ सूचीबद्ध करके अस्वीकार:

- **SMTP नहीं।** `QUIRE_EMAIL_PROVIDER_CONFIG` में HTTP provider इस्तेमाल करें।
- **स्थानीय disk नहीं।** `QUIRE_STORAGE_DRIVER` को object storage बताना होगा।
- **In-process realtime या cache नहीं।** Workers requests के बीच memory साझा
  नहीं करते, इसलिए `QUIRE_REALTIME_DRIVER=inprocess` और
  `QUIRE_CACHE_DRIVER=memory` अस्वीकार होते हैं।
- **Worker में ClamAV, Gotenberg या ffmpeg नहीं।** Worker पर सेट
  `CLAMAV_URL`, `GOTENBERG_URL` और `FFMPEG_PATH` अस्वीकार हैं; इसके बजाय companion
  worker पर सेट करें।
- **समर्पित database वाले संगठन नहीं।** Worker के Hyperdrive bindings deploy के
  समय तय होते हैं, इसलिए अपना database रखने वाले संगठन को स्पष्ट “यहाँ उपलब्ध
  नहीं” पृष्ठ मिलता है। उसे Compose या Vercel से सेवा दें।

और एक बात जिसे अस्वीकार नहीं किया जाता, पर जानना चाहिए: framework के दस्तावेज़ कुछ
भी कहें, **Workers पर prerendering और incremental static regeneration काम नहीं
करते**। हर route हर request पर render होता है।

इस लक्ष्य पर transactions छोटे रखें और network call के दौरान कभी खुला न रखें:
connection pool में लौटने पर Hyperdrive session state रीसेट करता है, इसलिए tenant
context हर transaction के लिए सेट होता है।

## डिप्लॉय करना <!--quire:deploying-->

1. Resources बनाएँ:
   ```sh
   bun run --bun wrangler hyperdrive create quire-app --connection-string="postgres://quire_app:...@db.example.com:5432/quire"
   bun run --bun wrangler hyperdrive create quire-report --connection-string="postgres://quire_report:...@db.example.com:5432/quire"
   bun run --bun wrangler r2 bucket create quire-files
   bun run --bun wrangler queues create quire-jobs
   ```
   दोनों Hyperdrive IDs को `apps/web/wrangler.jsonc` में रखें।
2. एक-एक करके secrets `bun run --bun wrangler secret put <NAME>` से सेट करें, यह `apps/web` से चलाएँ:
   `QUIRE_SECRET_KEY`, `QUIRE_MASTER_KEY`, `QUIRE_EMAIL_PROVIDER_CONFIG`,
   `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY`, `QUIRE_COLLAB_SIGNING_KEY`,
   `QUIRE_REALTIME_WORKER_SECRET`। सामान्य settings (`QUIRE_APP_ORIGIN`,
   `QUIRE_CONTENT_ORIGIN`, `QUIRE_PLATFORM_DOMAINS`, `QUIRE_DATABASE_ID`,
   `S3_ENDPOINT`, `S3_BUCKET`, `QUIRE_COLLAB_URL`) `vars` में रखें।
3. `apps/web` से build और deploy करें:
   ```sh
   NITRO_PRESET=cloudflare-module bun run build
   bun run --bun wrangler deploy
   ```
4. Realtime Worker को web tier का `QUIRE_REALTIME_WORKER_SECRET` और उसका token
   secret `QUIRE_REALTIME_TOKEN_SECRET` के रूप में देकर deploy करें (web tier अपने
   `QUIRE_REALTIME_TOKEN_SECRET`, या वह unset हो तो `QUIRE_SECRET_KEY` से realtime
   tokens पर हस्ताक्षर करता है; जो वह इस्तेमाल करता है वही लें)। Web tier पर
   `QUIRE_REALTIME_WORKER_URL` को उसके पते पर सेट करें:
   ```sh
   cd apps/realtime-worker
   bun run --bun wrangler secret put QUIRE_REALTIME_WORKER_SECRET
   bun run --bun wrangler secret put QUIRE_REALTIME_TOKEN_SECRET
   bun run --bun wrangler deploy
   ```
5. Cloudflare Queues पर हल्के jobs के लिए हर हल्की queue के लिए एक queue बनाएँ
   और companion worker पर ये सेट करें (Queues पर read और write अधिकार वाला API
   token):
   ```sh
   bun run --bun wrangler queues create quire-events-notifications
   bun run --bun wrangler queues create quire-events-notifications-dead
   bun run --bun wrangler queues create quire-events-webhooks
   bun run --bun wrangler queues create quire-events-webhooks-dead
   ```
   `QUIRE_QUEUE_DRIVER=cloudflare`, `CLOUDFLARE_ACCOUNT_ID`,
   `CLOUDFLARE_QUEUES_TOKEN`, और `QUIRE_QUEUE_PREFIX` सेट करें यदि उसका मान `quire-` न हो।
6. [Vercel मार्गदर्शिका](/hi/ops/vercel/) के चरण 3 के अनुसार companion host चलाएँ।
   हर Worker deployment से पहले migration वहाँ चलती है।

अस्वीकृत कॉन्फ़िगरेशन `bun run --bun wrangler tail` में "The web tier did not start on
cloudflare" के बाद बदलने वाली हर setting सहित दिखता है।

Source: https://docs.quirelms.com/hi/ops/cloudflare/index.mdx
