Skip to content

Commit

Permalink
docs(cloudflare): update deployment guide (#2074)
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-piotrowicz authored Jan 23, 2024
1 parent bd17281 commit aff9e59
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 184 deletions.
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

0 comments on commit aff9e59

Please sign in to comment.