-
Notifications
You must be signed in to change notification settings - Fork 9.9k
Adds environments docs #24301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: production
Are you sure you want to change the base?
Adds environments docs #24301
Conversation
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
|
Preview URL: https://e9b20e48.preview.developers.cloudflare.com Files with changes (up to 15)
|
irvinebroque
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There are the existing docs here:
https://developers.cloudflare.com/workers/wrangler/environments/
Which are going to be people's default starting place
How should that change? Should content adapt, what should redirect, etc.
Think the challenge of this content will be — how can it be comprehensive and have lots of code examples (what's here is great) — without feeling overwhelming to the reader?
separate pages? tabbed components? expandable code blocks? etc.
| <details> | ||
| <summary>Complete configuration example with all binding types</summary> | ||
|
|
||
| This comprehensive example shows how to configure all available binding types across environments. The inline comments explain isolation requirements for each binding type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this format as a way to explain
Wonder how it looks to highlight the comments, to break it up into sections visually
https://starlight.astro.build/guides/authoring-content/#expressive-code-features
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And maybe collapsable?
https://expressive-code.com/plugins/collapsible-sections/#collapsible-start
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately the expressive code features don't work currently with the WranglerConfig component -- can see if I can update the component itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kodster28 for context (this docs page has a lot of stuff to explain and kind of pushing bounds of how we use code samples to convey things)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@korinne, let me throw some time on your cal to chat and see if we can work through some of these.
| "certificate_id": "<STAGING_CERTIFICATE_ID>", | ||
| }, | ||
| ], | ||
| // Version metadata - can be shared across environments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean for this to be "shared across environments"?
| "zone_name": "example.org", | ||
| }, | ||
| // Service bindings - target specific Worker environments | ||
| // Use just the worker name to target its production environment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know from context what this means but wonder if someone / LLM might need example
ex: if you have worker foo with env bar
and you want to bind to foo
you would set service to foo
if you wanted to bind to the worker named "foo" but target the environment "bar"
you would set service to foo-bar
| - The production environment deploys as a Worker named `my-api` | ||
| - The staging environment deploys as a separate Worker named `my-api-staging` | ||
|
|
||
| To deploy environments programmatically using the [Cloudflare API](/api/resources/workers/subresources/scripts/methods/update/), you upload each environment as a separate Worker script and specify tags to identify the relationship: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would restructure and bring the tags part way up in this, make it the topline thing that someone needs to understand
- this works by adding tags
- each environment is its own Worker, with common tag
|
|
||
| **Deploy to production:** | ||
|
|
||
| ```bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SDK
| { | ||
| "binding": "<BINDING_NAME1>", | ||
| "bucket_name": "<STAGING_BUCKET_NAME>", | ||
| // Warning: Using the production bucket would share files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"share files" ?
|
|
||
| This approach means each environment runs as a completely separate Worker with its own isolated execution context, routes, and bindings. The tagging system helps Cloudflare understand the relationship between these separate Workers for management purposes. | ||
|
|
||
| ## How bindings behave in environments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this section
Wonder about using tabbed component with tab for each code example so that page doesn't get super long?
Co-authored-by: Brendan Irvine-Broque <[email protected]>
Co-authored-by: Brendan Irvine-Broque <[email protected]>
Co-authored-by: Brendan Irvine-Broque <[email protected]>
To do