Skip to content
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

docs(cloudflare): update deployment guide #2074

Merged
merged 4 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions docs/content/2.deploy/0.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ icon: ri:upload-cloud-2-line

Nitro can generate different output formats suitable for different hosting providers from the same code base.

Using built-in presets, you can easily configure Nitro to adjust it's output format with almost no additional code or configuration!
Using built-in presets, you can easily configure Nitro to adjust its output format with almost no additional code or configuration!

## Default output

Default production output preset is [Node.js server](/deploy/node).
The default production output preset is [Node.js server](/deploy/node).

When running Nitro in development mode, Nitro will always use a special preset called `nitro-dev` using Node.js with ESM in an isolated Worker environment with behavior as close as possible to the production environment.


## Zero-Config Providers

When deploying to the production using CI/CD, Nitro tries to automatically detect the provider environment and set the right one without any additional configuration. Currently, providers below can be auto-detected with zero config.
When deploying to production using CI/CD, Nitro tries to automatically detect the provider environment and set the right one without any additional configuration required. Currently, the providers below can be auto-detected with zero config.

- [aws amplify](/deploy/providers/aws-amplify)
- [azure](/deploy/providers/azure)
Expand All @@ -29,17 +29,19 @@ When deploying to the production using CI/CD, Nitro tries to automatically detec

## Changing the deployment preset

If you need to build Nitro against a specific provider, you can override it using an environment variable or `nitro.config.ts`. Using environment variable is recommended for deployments depending on CI/CD.
If you need to build Nitro against a specific provider, you can target it by defining an environment variable named `NITRO_PRESET` or `SERVER_PRESET`, or by updating your Nitro [configuration](/guide/configuration) or using `--preset` argument.

**Example:** Using `NITRO_PRESET`
Using the environment variable approach is recommended for deployments depending on CI/CD.

**Example:** Defining a `NITRO_PRESET` environment variable
```bash
NITRO_PRESET=aws_lambda nitro build
nitro build --preset cloudflare_pages
```

**Example:** Using [nitro.config.ts](/guide/configuration)
**Example:** Updating the `nitro.config.ts` file

```ts
export default defineNitroConfig({
preset: 'node-server'
preset: 'cloudflare_pages'
})
```
Loading