Skip to content

Commit

Permalink
Merge branch 'cloudflare:production' into patch-4
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrandeb authored Jan 8, 2025
2 parents 158d653 + be13e9e commit 9cd0a7e
Show file tree
Hide file tree
Showing 19 changed files with 211 additions and 62 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
name: Publish Preview
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22.x
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
name: Publish Production
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22.x
Expand Down
1 change: 1 addition & 0 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ export default defineConfig({
Footer: "./src/components/overrides/Footer.astro",
Head: "./src/components/overrides/Head.astro",
Hero: "./src/components/overrides/Hero.astro",
LastUpdated: "./src/components/overrides/LastUpdated.astro",
MarkdownContent: "./src/components/overrides/MarkdownContent.astro",
Sidebar: "./src/components/overrides/Sidebar.astro",
PageSidebar: "./src/components/overrides/PageSidebar.astro",
Expand Down
Binary file added src/assets/images/ai-gateway/deepseek.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/components/overrides/LastUpdated.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
import type { Props } from "@astrojs/starlight/props";
import Default from "@astrojs/starlight/components/LastUpdated.astro";
// Disable lastUpdated in footer if `updated` is present,
// since this will show the date in PageTitle.astro instead.
if (Astro.props.entry.data.updated) {
Astro.props.lastUpdated = undefined;
}
---

<Default {...Astro.props} />
34 changes: 34 additions & 0 deletions src/content/changelogs-next/2025-01-07-aig-provider-deepseek.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: AI Gateway adds DeepSeek as a Provider
description: AI Gateway has added DeepSeek as a new provider.
products:
- ai-gateway
date: 2025-01-02T11:00:00Z
---

[**AI Gateway**](/ai-gateway/) now supports [**DeepSeek**](/ai-gateway/providers/deepseek/), including their cutting-edge DeepSeek-V3 model. With this addition, you have even more flexibility to manage and optimize your AI workloads using AI Gateway. Whether you're leveraging DeepSeek or other providers, like OpenAI, Anthropic, or [Workers AI](/workers-ai/), AI Gateway empowers you to:

- **Monitor**: Gain actionable insights with analytics and logs.
- **Control**: Implement caching, rate limiting, and fallbacks.
- **Optimize**: Improve performance with feedback and evaluations.

![AI Gateway adds DeepSeek as a provider](~/assets/images/ai-gateway/deepseek.png)

To get started, simply update the base URL of your DeepSeek API calls to route through AI Gateway. Here's how you can send a request using cURL:

```bash title="Example fetch request"
curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/deepseek/chat/completions \
--header 'content-type: application/json' \
--header 'Authorization: Bearer DEEPSEEK_TOKEN' \
--data '{
"model": "deepseek-chat",
"messages": [
{
"role": "user",
"content": "What is Cloudflare?"
}
]
}'
```

For detailed setup instructions, see our [DeepSeek provider documentation](/ai-gateway/providers/deepseek/).
11 changes: 11 additions & 0 deletions src/content/changelogs/api-deprecations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ productLink: "/fundamentals/"
productArea: Core platform
productAreaLink: /fundamentals/reference/changelog/platform/
entries:
- publish_date: "2025-07-01"
title: Cloudflare DWeb Resolver
description: |-
Deprecation date: July 1, 2025
The Cloudflare DWeb Resolver experiment is ending.
Deprecated APIs:
- DoH resolver on resolver.cloudflare-eth.com
- publish_date: "2025-03-23"
title: "Eligible Zones For Account Custom Nameservers"
description: |-
Expand Down
36 changes: 21 additions & 15 deletions src/content/docs/byoip/concepts/prefix-delegations.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,41 @@ sidebar:

---

BYOIP supports prefix delegations, which occur when a prefix owner account (Account A) allows another account (Account B) to use part or all of their prefix.
BYOIP supports prefix delegations, which occur when a prefix owner’s account (Account A) allows another account (Account B) to use all or part of their prefix. The original prefix is still managed by the original account, but a delegation allows another account to use the delegated IP(s) on various services within that account.

The effect of a delegation depends on the service used with the prefix. Currently BYOIP + CDN and BYOIP + Spectrum support prefix delegations.
Refer to [service bindings](/byoip/service-bindings/) for more information on the services an IP can be bound to.

## CDN

CDN delegations only have an effect if you are using [Cloudflare for SaaS](/cloudflare-for-platforms/cloudflare-for-saas/security/certificate-management/) in addition to BYOIP + CDN.

In this example, Account A is using BYOIP + CDN and Cloudflare for SaaS. Account A can validate and serve traffic for a custom hostname on any of the IPs in its prefix. If Account A delegates some or all of the prefix to Account B, Account B may also validate and serve traffic for custom hostnames on those IPs as well. This is very useful if you use Cloudflare for SaaS but manage different configurations in different accounts. All the accounts can use the IPs through a delegation.
CDN delegations allow you to use the IP(s) with [Address Maps](/byoip/address-maps/) or [Cloudflare for SaaS](/cloudflare-for-platforms/cloudflare-for-saas/) customers.

Address Maps allows you to assign IPs either at the account level or zone level.

In the Cloudflare for SaaS example, Account A is using BYOIP + CDN and Cloudflare for SaaS. Account A can validate and serve traffic for a custom hostname on any of the IPs in its prefix. If Account A delegates some or all of the prefix to Account B, Account B may also validate and serve traffic for custom hostnames on those IPs as well. This is very useful if you use Cloudflare for SaaS but manage different configurations in different accounts. All the accounts can use the IPs through a delegation.

## Spectrum

If Account A delegates use of part or all of a prefix to Account B via a prefix delegation, Account B can also use the [Spectrum API](/spectrum/about/byoip/) with the IPs it was delegated access to.

**Example:** Account A is the primary owner of prefix 1.2.3.0/24. Account A delegates the use of 1.2.3.0/32 to Account B. Account B can now use the Spectrum API to create a Spectrum app with 1.2.3.0/32.

## API calls for prefix delegations

API calls for delegations can be found at [Prefix Delegations](/api/resources/addressing/subresources/prefixes/subresources/delegations/methods/list/).

:::note

The dashboard only supports delegation of an entire prefix. If you want to delegate less than the entire prefix, use the API.

To bind an IP from one service to another, use the API.
:::

## Configure prefix delegations

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/) and select your account.
2. Go to **IP Addresses** > **IP Prefixes**.
3. Select **Edit** to modify a prefix. **Edit IP Prefixes** displays.
4. At the bottom of the page, select **Add Delegation**. Other accounts that your user is a part of will auto-load when you create the delegation.
5. Select **Save**.

:::note

The dashboard only supports delegation of an entire prefix. If you want to delegate less than the entire prefix, use the API.
:::

## Spectrum

If Account A delegates use of part or all of a prefix to Account B via a prefix delegation, Account B can also use the [Spectrum API](/spectrum/about/byoip/) with the IPs it was delegated access to.

**Example:** Account A is the primary owner of prefix 1.2.3.0/24. Account A delegates the use of 1.2.3.0/32 to Account B. Account B can now use the Spectrum API to create a Spectrum app with 1.2.3.0/32.
6. Bind IPs to a service via the [Service Bindings API](/api/resources/addressing/subresources/prefixes/subresources/service_bindings/) as needed.
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ To proceed with the installation, here is an example of the XML code you will ne

Refer to [deployment parameters](/cloudflare-one/connections/connect-devices/warp/deployment/mdm-deployment/parameters/) for a description of each argument.

## Android
## Android / ChromeOS

:::note[Migrate from 1.1.1.1]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ If you deployed the 1.1.1.1 app with an [MDM provider](/cloudflare-one/connectio

2. Add the **Cloudflare One Agent** app from the Google Play store. Its application ID is `com.cloudflare.cloudflareoneagent`.

3. Copy your [MDM deployment parameters](/cloudflare-one/connections/connect-devices/warp/deployment/mdm-deployment/#android) for the **1.1.1.1** app.
3. Copy your [MDM deployment parameters](/cloudflare-one/connections/connect-devices/warp/deployment/mdm-deployment/#android--chromeos) for the **1.1.1.1** app.

4. Paste the MDM deployment parameters into the **Cloudflare One Agent** app configuration. Make sure that you do not accidentally overwrite the application ID (`com.cloudflare.cloudflareoneagent`).

Expand All @@ -89,7 +89,7 @@ If you deployed the 1.1.1.1 app with an [MDM provider](/cloudflare-one/connectio

2. Add the **Cloudflare One Agent** app from the App store. Its application ID is `com.cloudflare.cloudflareoneagent`.

3. Copy your [MDM deployment parameters](/cloudflare-one/connections/connect-devices/warp/deployment/mdm-deployment/#android) for the **1.1.1.1** app.
3. Copy your [MDM deployment parameters](/cloudflare-one/connections/connect-devices/warp/deployment/mdm-deployment/#ios) for the **1.1.1.1** app.

4. Paste the MDM deployment parameters into the **Cloudflare One Agent** app configuration. Make sure that you do not accidentally overwrite the application ID (`com.cloudflare.cloudflareoneagent`).

Expand Down
27 changes: 18 additions & 9 deletions src/content/docs/durable-objects/api/storage-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ sidebar:
order: 6
---

import { Render, Type, MetaInfo, GlossaryTooltip, TypeScriptExample } from "~/components";
import {
Render,
Type,
MetaInfo,
GlossaryTooltip,
TypeScriptExample,
} from "~/components";

The Durable Object Storage API allows <GlossaryTooltip term="Durable Object">Durable Objects</GlossaryTooltip> to access transactional and strongly consistent storage. A Durable Object's attached storage is private to its unique instance and cannot be accessed by other objects.

Expand All @@ -18,9 +24,9 @@ Note that Durable Object storage is scoped by individual <GlossaryTooltip term="
However, storage is scoped per individual Durable Object.
:::

Durable Objects gain access to a persistent Durable Object Storage API via `ctx.storage`, on the `ctx` parameter passed to the Durable Object constructor.
Durable Objects gain access to a persistent Durable Object Storage API via the `DurableObjectStorage` interface and accessed by the `DurableObjectState::storage` property. This is frequently accessed via `this.ctx.storage` when the `ctx` parameter passed to the Durable Object constructor.

While access to a Durable Object is single-threaded, request executions can still interleave with each other when they wait on I/O, such as when waiting on the promises returned by persistent storage methods or `fetch()` requests.
JavaScript is a single-threaded and event-driven programming language. This means that JavaScript runtimes, by default, allow requests to interleave with each other which can lead to concurrency bugs. The Durable Objects runtime uses a combination of <GlossaryTooltip term="input gate">input gates</GlossaryTooltip> and <GlossaryTooltip term="output gate">output gates</GlossaryTooltip> to avoid this type of concurrency bug when performing storage operations.

The following code snippet shows you how to store and retrieve data using the Durable Object Storage API.

Expand All @@ -31,13 +37,15 @@ export class Counter extends DurableObject {
super(ctx, env);
}

async increment(): Promise<number> {
let value: number = (await this.ctx.storage.get('value')) || 0;
value += 1;
await this.ctx.storage.put('value', value);
return value;
}
async increment(): Promise<number> {
let value: number = (await this.ctx.storage.get('value')) || 0;
value += 1;
await this.ctx.storage.put('value', value);
return value;
}

}

```
</TypeScriptExample>

Expand Down Expand Up @@ -255,3 +263,4 @@ The `put()` method returns a `Promise`, but most applications can discard this p

- [Durable Objects: Easy, Fast, Correct – Choose Three](https://blog.cloudflare.com/durable-objects-easy-fast-correct-choose-three/)
- [WebSockets API](/durable-objects/best-practices/websockets/)
```
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,21 @@ If the connection pool does not have pre-existing connections, it will establish
Hyperdrive automatically manages the connection pool properties for you, including limiting the total number of connections to your origin database. Refer to [Limits](/hyperdrive/platform/limits/) to learn more.
:::

The connection pool operates in transaction mode, where the client that executes the query communicates through a single connection for the duration of a transaction.
## Pooling mode

When that transaction has completed, the connection is returned to the pool.
The Hyperdrive connection pooler operates in transaction mode, where the client that executes the query communicates through a single connection for the duration of a transaction. When that transaction has completed, the connection is returned to the pool.


Hyperdrive supports [`SET` statements](https://www.postgresql.org/docs/current/sql-set.html) for the duration of a transaction or a query. For instance, if you manually create a transaction with `BEGIN`/`COMMIT`, `SET` statements within the transaction will take effect. Moreover, a query that includes a `SET` command (`SET X; SELECT foo FROM bar;`) will also apply the `SET` command. When a connection is returned to the pool, the connection is `RESET` such that the `SET` commands will not take effect on subsequent queries.

This implies that a single Worker invocation may obtain multiple connections to perform its database operations and may need to `SET` any configurations for every query or transaction. It is not recommended to wrap multiple database operations with a single transaction to maintain the `SET` state. Doing so will affect the performance and scaling of Hyperdrive as the connection cannot be reused by other Worker isolates for the duration of the transaction.

Hyperdrive supports named prepared statements as implemented in the `postgres.js` and `node-postgres` drivers. Named prepared statements in other drivers may have worse performance.

## Unsupported PostgreSQL features:

Hyperdrive does not support the following PostgreSQL features:

* `SET` statements.
* SQL-level management of prepared statements, such as using `PREPARE`, `DISCARD`, `DEALLOCATE`, or `EXECUTE`.
* Advisory locks ([PostgreSQL documentation](https://www.postgresql.org/docs/current/explicit-locking.html#ADVISORY-LOCKS)).
* `LISTEN` and `NOTIFY`.
Expand Down
Loading

0 comments on commit 9cd0a7e

Please sign in to comment.