mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-30 23:32:38 +00:00
docs: update azure deployment page (#1514)
This commit is contained in:
parent
0f329ea871
commit
f5281e5df7
@ -6,54 +6,6 @@ icon: LogoAzure
|
|||||||
|
|
||||||
How to deploy Nuxt to Azure Static Web Apps or Azure Functions.
|
How to deploy Nuxt to Azure Static Web Apps or Azure Functions.
|
||||||
|
|
||||||
## Azure Static Web Apps
|
|
||||||
|
|
||||||
How to deploy Nuxt to Azure Static Web Apps with Nuxt Nitro.
|
|
||||||
|
|
||||||
::list
|
|
||||||
- Support for serverless SSR build
|
|
||||||
- Auto-detected when deploying
|
|
||||||
- Minimal configuration required
|
|
||||||
::
|
|
||||||
|
|
||||||
### Setup
|
|
||||||
|
|
||||||
Azure Static Web Apps are designed to be deployed continuously in a [GitHub Actions workflow](https://docs.microsoft.com/en-us/azure/static-web-apps/github-actions-workflow). By default, Nitro will detect this deployment environment and enable the `azure` preset.
|
|
||||||
|
|
||||||
### Local preview
|
|
||||||
|
|
||||||
You can invoke a development environment to preview before deploying.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
NITRO_PRESET=azure yarn build
|
|
||||||
npx @azure/static-web-apps-cli start .output/public --api-location .output/server
|
|
||||||
```
|
|
||||||
|
|
||||||
### Deploy from CI/CD via GitHub Actions
|
|
||||||
|
|
||||||
When you link your GitHub repository to Azure Static Web Apps, a workflow file is added to the repository.
|
|
||||||
|
|
||||||
Find the build configuration section in this workflow and update the build configuration:
|
|
||||||
|
|
||||||
```yml{}[.github/workflows/azure-static-web-apps-<RANDOM_NAME>.yml]
|
|
||||||
###### Repository/Build Configurations ######
|
|
||||||
app_location: '/'
|
|
||||||
api_location: '.output/server'
|
|
||||||
output_location: '.output/public'
|
|
||||||
###### End of Repository/Build Configurations ######
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note**
|
|
||||||
|
|
||||||
Pending an update in the [Azure Static Web Apps workflow](https://github.com/Azure/static-web-apps-deploy), you will also need to run the following in your root directory:
|
|
||||||
```bash
|
|
||||||
mkdir -p .output/server
|
|
||||||
touch .output/server/.gitkeep
|
|
||||||
git add -f .output/server/.gitkeep
|
|
||||||
```
|
|
||||||
|
|
||||||
That's it! Now Azure Static Web Apps will automatically deploy your Nitro-powered Nuxt application on push.
|
|
||||||
|
|
||||||
## Azure Functions
|
## Azure Functions
|
||||||
|
|
||||||
::list
|
::list
|
||||||
@ -72,6 +24,10 @@ export default {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
::alert
|
||||||
|
If you encounter any issues, please ensure you're using a Node.js 14+ runtime. You can find more information about [how to set the Node version in the Azure docs](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=v2#setting-the-node-version).
|
||||||
|
::
|
||||||
|
|
||||||
### Local preview
|
### Local preview
|
||||||
|
|
||||||
Install [Azure Functions Core Tools](https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local) if you want to test locally.
|
Install [Azure Functions Core Tools](https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local) if you want to test locally.
|
||||||
@ -162,3 +118,62 @@ Consider [turning on immutable packages](https://docs.microsoft.com/en-us/azure/
|
|||||||
### Demo
|
### Demo
|
||||||
|
|
||||||
A live demo is available on https://nuxt-nitro.azurewebsites.net/
|
A live demo is available on https://nuxt-nitro.azurewebsites.net/
|
||||||
|
|
||||||
|
## Azure Static Web Apps
|
||||||
|
|
||||||
|
::alert{type=warning icon=🚧}
|
||||||
|
Azure Static Web Apps currently defaults to a Node.js 12.x runtime, which means it is not currently compatible with Nuxt Nitro. For now, you can deploy via [Azure Functions](#azure-functions) instead.
|
||||||
|
::
|
||||||
|
|
||||||
|
How to deploy Nuxt to Azure Static Web Apps with Nuxt Nitro.
|
||||||
|
|
||||||
|
::list
|
||||||
|
- Support for serverless SSR build
|
||||||
|
- Auto-detected when deploying
|
||||||
|
- Minimal configuration required
|
||||||
|
::
|
||||||
|
|
||||||
|
### Setup
|
||||||
|
|
||||||
|
Azure Static Web Apps are designed to be deployed continuously in a [GitHub Actions workflow](https://docs.microsoft.com/en-us/azure/static-web-apps/github-actions-workflow). By default, Nitro will detect this deployment environment and enable the `azure` preset.
|
||||||
|
|
||||||
|
### Local preview
|
||||||
|
|
||||||
|
You can invoke a development environment to preview before deploying.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
NITRO_PRESET=azure yarn build
|
||||||
|
npx @azure/static-web-apps-cli start .output/public --api-location .output/server
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deploy from CI/CD via GitHub Actions
|
||||||
|
|
||||||
|
When you link your GitHub repository to Azure Static Web Apps, a workflow file is added to the repository.
|
||||||
|
|
||||||
|
When you are asked to select your framework, select custom and provide the following information:
|
||||||
|
|
||||||
|
| --- | --- |
|
||||||
|
| **app_location** | '/' |
|
||||||
|
| **api_location** | '.output/server' |
|
||||||
|
| **output_location** | '.output/public' |
|
||||||
|
|
||||||
|
If you miss this step, you can always find the build configuration section in your workflow and update the build configuration:
|
||||||
|
|
||||||
|
```yml{}[.github/workflows/azure-static-web-apps-<RANDOM_NAME>.yml]
|
||||||
|
###### Repository/Build Configurations ######
|
||||||
|
app_location: '/'
|
||||||
|
api_location: '.output/server'
|
||||||
|
output_location: '.output/public'
|
||||||
|
###### End of Repository/Build Configurations ######
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note**
|
||||||
|
|
||||||
|
Pending an update in the [Azure Static Web Apps workflow](https://github.com/Azure/static-web-apps-deploy), you will also need to run the following in your root directory:
|
||||||
|
```bash
|
||||||
|
mkdir -p .output/server
|
||||||
|
touch .output/server/.gitkeep
|
||||||
|
git add -f .output/server/.gitkeep
|
||||||
|
```
|
||||||
|
|
||||||
|
That's it! Now Azure Static Web Apps will automatically deploy your Nitro-powered Nuxt application on push.
|
||||||
|
Loading…
Reference in New Issue
Block a user