Browse Source

Merge pull request #23078 from abpframework/auto-merge/rel-9-2/3781

Merge branch dev with rel-9.2
pull/23079/head
maliming 1 year ago
committed by GitHub
parent
commit
590302807f
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. BIN
      docs/en/images/azure-deploy-create-web-app-2.png
  2. BIN
      docs/en/images/azure-deploy-create-web-app-6.png
  3. 2
      docs/en/solution-templates/layered-web-application/deployment/azure-deployment/azure-deployment.md
  4. 114
      docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step1-create-azure-resources.md
  5. 216
      docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step2-configuration-application.md
  6. 263
      docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step3-deployment-github-action.md
  7. 138
      docs/en/solution-templates/layered-web-application/deployment/azure-deployment/terraform-web-app-service.md

BIN
docs/en/images/azure-deploy-create-web-app-2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 200 KiB

After

Width:  |  Height:  |  Size: 141 KiB

BIN
docs/en/images/azure-deploy-create-web-app-6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 296 KiB

After

Width:  |  Height:  |  Size: 183 KiB

2
docs/en/solution-templates/layered-web-application/deployment/azure-deployment/azure-deployment.md

@ -3,7 +3,7 @@
````json
//[doc-params]
{
"UI": ["MVC", "Blazor", "BlazorServer", "NG"],
"UI": ["MVC", "Blazor", "BlazorServer", "BlazorWebApp", "NG"],
"DB": ["EF", "Mongo"],
"Tiered": ["Yes", "No"]
}

114
docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step1-create-azure-resources.md

@ -1,7 +1,7 @@
````json
//[doc-params]
{
"UI": ["MVC", "Blazor", "BlazorServer", "NG"],
"UI": ["MVC", "Blazor", "BlazorServer", "BlazorWebApp", "NG"],
"DB": ["EF", "Mongo"],
"Tiered": ["Yes", "No"]
}
@ -15,7 +15,9 @@ To create a new Azure Web App Service, choose one of the following options:
- [Create a new Azure Web App Service using the Terraform Template](terraform-web-app-service.md) (If you have experience with Terraform)
{{ if UI == "MVC" && Tiered == "No" }}
{{ if Tiered == "No" }}
{{ if UI == "BlazorServer" || UI == "MVC" || UI == "BlazorWebApp"}}
### Create a new Azure Web App service using the Azure Portal
@ -39,9 +41,102 @@ To create a new Azure Web App Service, choose one of the following options:
![Create Web App](../../../../images/azure-deploy-create-web-app-3.png)
{{else}}
{{else if UI == 'NG'}}
### Create a new Azure Static Web App for Angular using the Azure Portal
1. Log in to the [Azure Portal](https://portal.azure.com/).
2. Click the **Create a resource** button.
3. Search for **Static Web App** and select **Static Web App** from the results.
![Create a resource angular](../../../../images/azure-deploy-create-a-resource-angular.png)
4. Click the **Create** button.
5. Fill in the required fields and click the **Review + create** button.
6. Click the **Create** button.
![Create Web App](../../../../images/azure-deploy-create-web-app-4.png)
7. Wait for the deployment to complete.
![Create Web App](../../../../images/azure-deploy-create-web-app-5.png)
### Create a new Azure Web App Service for API application
1. You can create a new Azure Web App Service for an API application in the same resource group.
2. Click the **Create** button on the top of the resource group page.
3. Search for **Web App** and select **Web App** from the results.
![Create a resource](../../../../images/azure-deploy-create-a-resource.png)
4. Click the **Create** button.
5. Fill in the required fields and click the **Review + create** button.
6. Click the **Create** button.
![Create Web App](../../../../images/azure-deploy-create-web-app-6.png)
7. Wait for the deployment to complete.
![Create Web App](../../../../images/azure-deploy-create-web-app-3.png)
{{ else }}
### Create a new Azure Static Web App for Blazor using the Azure Portal
1. Log in to the [Azure Portal](https://portal.azure.com/).
2. Click the **Create a resource** button.
3. Search for **Static Web App** and select **Static Web App** from the results.
![Create a resource blazor](../../../../images/azure-deploy-create-a-resource-angular.png)
4. Click the **Create** button.
5. Fill in the required fields and click the **Review + create** button.
6. Click the **Create** button.
![Create Web App](../../../../images/azure-deploy-create-web-app-7.png)
7. Wait for the deployment to complete.
![Create Web App](../../../../images/azure-deploy-create-web-app-8.png)
### Create a new Azure Web App Service for API application
1. You can create a new Azure Web App Service for an API application in the same resource group.
2. Click the **Create** button on the top of the resource group page.
3. Search for **Web App** and select **Web App** from the results.
![Create a resource](../../../../images/azure-deploy-create-a-resource.png)
4. Click the **Create** button.
5. Fill in the required fields and click the **Review + create** button.
6. Click the **Create** button.
![Create Web App](../../../../images/azure-deploy-create-web-app-6.png)
7. Wait for the deployment to complete.
![Create Web App](../../../../images/azure-deploy-create-web-app-3.png)
{{end}}
{{ else }}
{{ if UI == "BlazorServer" || UI == "MVC" }}
{{ if UI == "BlazorServer" || UI == "MVC" || UI == "BlazorWebApp"}}
### Create a new Azure Web App service using the Azure Portal
@ -65,8 +160,7 @@ To create a new Azure Web App Service, choose one of the following options:
![Create Web App](../../../../images/azure-deploy-create-web-app-3.png)
{{ else if UI == 'NG' }}
{{ else if UI == 'NG'}}
### Create a new Azure Static Web App for Angular using the Azure Portal
1. Log in to the [Azure Portal](https://portal.azure.com/).
@ -89,7 +183,7 @@ To create a new Azure Web App Service, choose one of the following options:
![Create Web App](../../../../images/azure-deploy-create-web-app-5.png)
{{else}}
{{ else }}
### Create a new Azure Static Web App for Blazor using the Azure Portal
@ -111,8 +205,6 @@ To create a new Azure Web App Service, choose one of the following options:
7. Wait for the deployment to complete.
![Create Web App](../../../../images/azure-deploy-create-web-app-8.png)
{{end}}
### Create a new Azure Web App Service for API application
@ -137,8 +229,6 @@ To create a new Azure Web App Service, choose one of the following options:
![Create Web App](../../../../images/azure-deploy-create-web-app-3.png)
{{ if Tiered == "Yes" && (UI == "MVC" || UI == "BlazorServer")}}
### Create a new Azure Web App Service for AuthServer application
Similar to the API application, you can create a new Azure Web App Service for an AuthServer application in the same resource group.
@ -167,8 +257,6 @@ Same as above, but you only need to modify the name of the web app service to **
{{ end }}
{{ end }}
## What's next?
- [Customizing the Azure Web App Service](step2-configuration-application.md)

216
docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step2-configuration-application.md

@ -1,7 +1,7 @@
````json
//[doc-params]
{
"UI": ["MVC", "Blazor", "BlazorServer", "NG"],
"UI": ["MVC", "Blazor", "BlazorServer", "BlazorWebApp", "NG"],
"DB": ["EF", "Mongo"],
"Tiered": ["Yes", "No"]
}
@ -9,17 +9,26 @@
## Step 2: Customizing the Configuration of the ABP Application
- To customize the configuration of your ABP application, modify the `ConnectionString` values in every location throughout your project. The `ConnectionString` values are stored in the `appsettings.json` files.
#### To customize the configuration of your ABP application
This includes the following files:
{{ if UI == "MVC" && Tiered == "No" }}
**./src/yourapp.DbMigrator/appsettings.json** and **./src/yourapp.Web/appsettings.json**
{{else}}
**./src/yourapp.DbMigrator/appsettings.json** and **./src/yourapp.HttpApi.Host/appsettings.json**
{{end}}
{{if Tiered == "Yes"}}
- Modify the `ConnectionString` values in every location throughout your project. The `ConnectionString` values are stored in the `appsettings.json` files.
* This includes the following files:
**./src/yourapp.DbMigrator/appsettings.json**
{{ if Tiered == "No" }}
{{ if UI == "MVC" }}
**./src/yourapp.Web/appsettings.json**
{{ else if UI == "Blazor" || UI == "BlazorServer" || UI == "BlazorWebApp" }}
and **./src/yourapp.Blazor/appsettings.json**
{{ end }}
{{ if UI == "Blazor"|| UI == "NG" }}
**./src/yourapp.HttpApi.Host/appsettings.json**
{{ end }}
{{ else }}
**./src/yourapp.HttpApi.Host/appsettings.json**
**./src/yourapp.AuthServer/appsettings.json**
{{end}}
{{ end }}
```json
"ConnectionStrings": {
@ -27,35 +36,42 @@
}
```
{{ if UI == "MVC" }}
{{if Tiered == "No"}}
- Modify the **yourapp.Web** URL in every location throughout your project, especially within the **./src/yourapp.Web/appsettings.json** and **./src/yourapp.DbMigrator/appsettings.json** files, to match your Azure Web App Service URL.
* This includes the following files:
**./src/yourapp.DbMigrator/appsettings.json**
{{ if Tiered == "No" }}
{{ if UI == "MVC" }}
**./src/yourapp.Web/appsettings.json**
{{ else if UI == "Blazor" || UI == "BlazorServer" || UI == "BlazorWebApp" }}
and **./src/yourapp.Blazor/appsettings.json**
{{ else }}
Modify the **`localhost:4200`** in every location throughout your project.
**./angular/src/environments/environment.prod.ts**
{{ end }}
{{ if UI == "Blazor"|| UI == "NG" }}
**./src/yourapp.HttpApi.Host/appsettings.json**
{{ end }}
{{ else }}
{{ if UI == "MVC" }}
**./src/yourapp.Web/appsettings.json**
{{ else if UI == "Blazor" || UI == "BlazorServer" || UI == "BlazorWebApp" }}
**./src/yourapp.Blazor/appsettings.json**
{{ else }}
Modify the **`localhost:4200`** in every location throughout your project.
**./angular/src/environments/environment.prod.ts**
{{ end }}
**./src/yourapp.AuthServer/appsettings.json**
```json
"App": {
"SelfUrl": "https://yourapp.azurewebsites.net"
}
```
{{else}}
- Modify the **yourapp.Web** URL in every location throughout your project.
This includes the following files:
**./src/yourapp.Web/appsettings.json** , **./src/yourapp.DbMigrator/appsettings.json** , **./src/yourapp.HttpApi.Host/appsettings.json** and **./src/yourapp.AuthServer/appsettings.json**
```json
"App": {
"SelfUrl": "https://yourapp.azurewebsites.net"
}
```
- Modify the **yourapp.ApiHost** URL in every location throughout your project.
This includes the following files:
* This includes the following files:
**./src/yourapp.HttpApi.Host/appsettings.json** , **./src/yourapp.Web/appsettings.json** , **./src/yourapp.DbMigrator/appsettings.json** and **./src/yourapp.AuthServer/appsettings.json**
@ -67,7 +83,7 @@
- Modify the **yourapp.AuthServer** URL in every location throughout your project.
This includes the following files:
* This includes the following files:
**./src/yourapp.Web/appsettings.json** , **./src/yourapp.AuthServer/appsettings.json** , **./src/yourapp.DbMigrator/appsettings.json** and **./src/yourapp.HttpApi.Host/appsettings.json**
@ -79,139 +95,7 @@
- Modify the **Redis__Configuration** URL in every location throughout your project.
This includes the following files:
**./src/yourapp.Web/appsettings.json** , **./src/yourapp.AuthServer/appsettings.json** , **./src/yourapp.DbMigrator/appsettings.json** and **./src/yourapp.HttpApi.Host/appsettings.json**
```json
"Redis": {
"Configuration": "redis-abpdemo.redis.cache.windows.net:6380,password={yourpassword},ssl=true,abortConnect=False"
},
```
{{end}}
{{ else if UI == "NG" }}
- Modify the **`localhost:4200`** in every location throughout your project.
This includes the following files:
**./angular/src/environments/environment.prod.ts** , **./aspnet-core/src/yourapp.DbMigrator/appsettings.json** and **./aspnet-core/src/yourapp.HttpApi.Host/appsettings.json**
```typescript
application: {
baseUrl: 'https://yourapp.azurestaticapps.net'
}
```
- Modify the **yourapp.HttpApi.Host** URL in every location throughout your project.
This includes the following files:
**./angular/src/environments/environment.prod.ts** , **./aspnet-core/src/yourapp.DbMigrator/appsettings.json** and **./aspnet-core/src/yourapp.HttpApi.Host/appsettings.json**
```json
"App": {
"SelfUrl": "https://yourApiHost.azurewebsites.net"
}
```
{{ else if UI == "Blazor" }}
- Modify the **yourapp.Blazor** URL in every location throughout your project.
This includes the following files:
**./src/yourapp.Blazor/appsettings.json** , **./src/yourapp.DbMigrator/appsettings.json** and **./src/yourapp.HttpApi.Host/appsettings.json**
```json
"App": {
"SelfUrl": "https://yourapp.azurewebsites.net"
}
```
- Modify the **yourapp.HttpApi.Host** URL in every location throughout your project.
This includes the following files:
**./src/yourapp.Blazor/appsettings.json** , **./src/yourapp.DbMigrator/appsettings.json** and **./src/yourapp.HttpApi.Host/appsettings.json**
```json
"App": {
"SelfUrl": "https://yourApiHost.azurewebsites.net"
}
```
{{ else }}
{{if Tiered == "No"}}
- Modify the **yourapp.Web** URL in every location throughout your project.
This includes the following files:
**./src/yourapp.Blazor/appsettings.json** , **./src/yourapp.DbMigrator/appsettings.json** and **./src/yourapp.HttpApi.Host/appsettings.json**
```json
"App": {
"SelfUrl": "https://yourapp.azurewebsites.net"
}
```
- Modify the **yourapp.ApiHost** URL in every location throughout your project.
This includes the following files:
**./src/yourapp.HttpApi.Host/appsettings.json** , **./src/yourapp.Blazor/appsettings.json** and **./src/yourapp.DbMigrator/appsettings.json**
```json
"App": {
"SelfUrl": "https://yourapp-apihost.azurewebsites.net"
}
```
{{else}}
- Modify the **yourapp.Web** URL in every location throughout your project.
This includes the following files:
**./src/yourapp.Blazor/appsettings.json** , **./src/yourapp.DbMigrator/appsettings.json** , **./src/yourapp.HttpApi.Host/appsettings.json** and **./src/yourapp.AuthServer/appsettings.json**
```json
"App": {
"SelfUrl": "https://yourapp.azurewebsites.net"
}
```
- Modify the **yourapp.ApiHost** URL in every location throughout your project.
This includes the following files:
**./src/yourapp.HttpApi.Host/appsettings.json** , **./src/yourapp.Blazor/appsettings.json** , **./src/yourapp.DbMigrator/appsettings.json** and **./src/yourapp.AuthServer/appsettings.json**
```json
"App": {
"SelfUrl": "https://yourapp-apihost.azurewebsites.net"
}
```
- Modify the **yourapp.AuthServer** URL in every location throughout your project.
This includes the following files:
**./src/yourapp.Blazor/appsettings.json** , **./src/yourapp.AuthServer/appsettings.json** , **./src/yourapp.DbMigrator/appsettings.json** and **./src/yourapp.HttpApi.Host/appsettings.json**
```json
"App": {
"SelfUrl": "https://yourapp-authserver.azurewebsites.net"
}
```
- Modify the **Redis__Configuration** URL in every location throughout your project.
This includes the following files:
* This includes the following files:
**./src/yourapp.Blazor/appsettings.json** , **./src/yourapp.AuthServer/appsettings.json** , **./src/yourapp.DbMigrator/appsettings.json** and **./src/yourapp.HttpApi.Host/appsettings.json**
@ -220,11 +104,7 @@
"Configuration": "redis-abpdemo.redis.cache.windows.net:6380,password={yourpassword},ssl=true,abortConnect=False"
},
```
{{end}}
{{end}}
{{ end }}
## What's next?

263
docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step3-deployment-github-action.md

@ -1,7 +1,7 @@
````json
//[doc-params]
{
"UI": ["MVC", "Blazor", "BlazorServer", "NG"],
"UI": ["MVC", "Blazor", "BlazorServer", "BlazorWebApp", "NG"],
"DB": ["EF", "Mongo"],
"Tiered": ["Yes", "No"]
}
@ -70,8 +70,8 @@ jobs:
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/apihost
working-directory: ./aspnet-core/src/Demo.AzureAppsAngular.HttpApi.Host # Replace with your project name
- name: Generate authserver.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/apihost/authserver.pfx -p 2D7AA457-5D33-48D6-936F-C48E5EF468ED # Replace with your password
- name: Generate openiddict.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/apihost/openiddict.pfx -p 2D7AA457-5D33-48D6-936F-C48E5EF468ED # Replace with your password
- name: Upload artifact for apihost
uses: actions/upload-artifact@v4
@ -170,8 +170,8 @@ jobs:
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/apihost
working-directory: ./src/demo.BlazorNonTierEfCore.HttpApi.Host # Replace with your project name
- name: Generate authserver.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/apihost/authserver.pfx -p 2D7AA457-5D33-48D6-936F-C48E5EF468ED # Replace with your password
- name: Generate openiddict.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/apihost/openiddict.pfx -p 2D7AA457-5D33-48D6-936F-C48E5EF468ED # Replace with your password
- name: Upload artifact for apihost
uses: actions/upload-artifact@v4
@ -234,6 +234,96 @@ jobs:
name: Build and deploy ASP.Net Core with BlazorServer to Azure Web App
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read #This is required for actions/checkout
steps:
- uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'
- name: Install ABP CLI
run: |
dotnet tool install -g Volo.Abp.Cli
abp install-libs
shell: bash
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Run migrations
run: dotnet run
working-directory: ./src/BlazorServer.NonTiered.DbMigrator
- name: dotnet publish
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
working-directory: './src/BlazorServer.NonTiered.Blazor'
- name: Generate openiddict.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/myapp/openiddict.pfx -p 7015b85e-89fc-4346-bfd0-a67d81de824e # Replace with your password
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: .net-app
path: ${{env.DOTNET_ROOT}}/myapp
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT
contents: read #This is required for actions/checkout
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: .net-app
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_E74C791E153A4F38A50107C6B5341809 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_7EC2684BA1FB43F1B563AD3832D0A5AC }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_81FB702F1C8F43388B145043765CC189 }}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'abp-blazor-webapp-layered'
slot-name: 'Production'
package: .
```
}%}
{{ else }}
{%{
```yaml
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy ASP.Net Core with BlazorServer to Azure Web App
on:
push:
branches:
@ -266,17 +356,27 @@ jobs:
run: dotnet run -- "${{ secrets.CONNECTION_STRING }}" # Set your connection string as a secret in your repository settings
working-directory: ./src/blazorservertierdemo.DbMigrator # Replace with your project name
- name: dotnet publish authserver
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/authserver
working-directory: ./src/blazorservertierdemo.AuthServer # Replace with your project name
- name: Generate openiddict.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/authserver/openiddict.pfx -p 2D7AA457-5D33-48D6-936F-C48E5EF468ED # Replace with your password
- name: dotnet publish apihost
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/apihost
working-directory: ./src/blazorservertierdemo.HttpApi.Host # Replace with your project name
- name: Generate authserver.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/apihost/authserver.pfx -p 2D7AA457-5D33-48D6-936F-C48E5EF468ED # Replace with your password
- name: dotnet publish webapp
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/webapp
working-directory: ./src/blazorservertierdemo.Blazor # Replace with your project name
- name: Upload artifact for authserver
uses: actions/upload-artifact@v4
with:
name: .net-authserver
path: ${{env.DOTNET_ROOT}}/authserver
- name: Upload artifact for apihost
uses: actions/upload-artifact@v4
with:
@ -295,7 +395,23 @@ jobs:
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp-3.outputs.webapp-url }}
steps:
- name: Download artifact from authserver
uses: actions/download-artifact@v4
with:
name: .net-authserver
path: ./authserver
- name: Deploy authserver
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'authserver-blazorserver' # Replace with your app name
slot-name: 'Production'
publish-profile: ${{ secrets.authserverblazorserverPublishSettings }} # Set your Azure Web App to publish your profile as a secret in your repository settings
package: ./authserver
- name: Download artifact from apihost
uses: actions/download-artifact@v4
with:
@ -323,8 +439,101 @@ jobs:
with:
app-name: 'webapp-blazorserver' # Replace with your app name
slot-name: 'Production'
publish-profile: ${{ secrets.webappblazorserverPublishSettings }} # Set your Azure Web App to publish your profile as a secret in your repository settings
package: ./webapp
publish-profile: ${{ secrets.webappblazorserverPublishSettings }} # Set your Azure Web App publish your profile as a secret in your repository settings
```
}%}
{{end}}
{{ else if UI == "BlazorWebApp" }}
{{ if Tiered == "No" }}
{%{
```yaml
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy ASP.Net Core app to Azure Web App - abp-blazor-webapp-layered
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read #This is required for actions/checkout
steps:
- uses: actions/checkout@v4
- name: Set up .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.x'
- name: Install ABP CLI
run: |
dotnet tool install -g Volo.Abp.Cli
abp install-libs
shell: bash
- name: Build with dotnet
run: dotnet build --configuration Release
- name: Run migrations
run: dotnet run
working-directory: ./src/BlzWapp.NonTiered.DbMigrator
- name: dotnet publish
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
working-directory: './src/BlzWapp.NonTiered.Blazor'
- name: Generate openiddict.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/myapp/openiddict.pfx -p 7015b85e-89fc-4346-bfd0-a67d81de824e # Replace with your password
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: .net-app
path: ${{env.DOTNET_ROOT}}/myapp
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: 'Production'
url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
permissions:
id-token: write #This is required for requesting the JWT
contents: read #This is required for actions/checkout
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: .net-app
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_E74C791E153A4F38A50107C6B5341809 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_7EC2684BA1FB43F1B563AD3832D0A5AC }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_81FB702F1C8F43388B145043765CC189 }}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'abp-blazor-webapp-layered'
slot-name: 'Production'
package: .
```
}%}
@ -337,7 +546,7 @@ jobs:
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy ASP.Net Core with BlazorServer to Azure Web App
name: Build and deploy ASP.Net Core with BlazorWebApp to Azure Web App
on:
push:
@ -369,22 +578,22 @@ jobs:
- name: Run migrations
run: dotnet run -- "${{ secrets.CONNECTION_STRING }}" # Set your connection string as a secret in your repository settings
working-directory: ./src/blazorservertierdemo.DbMigrator # Replace with your project name
working-directory: ./src/BlzWapp.DbMigrator # Replace with your project name
- name: dotnet publish authserver
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/authserver
working-directory: ./src/blazorservertierdemo.AuthServer # Replace with your project name
working-directory: ./src/BlzWapp.AuthServer # Replace with your project name
- name: Generate authserver.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/authserver/authserver.pfx -p 2D7AA457-5D33-48D6-936F-C48E5EF468ED # Replace with your password
- name: Generate openiddict.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/authserver/openiddict.pfx -p 2D7AA457-5D33-48D6-936F-C48E5EF468ED # Replace with your password
- name: dotnet publish apihost
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/apihost
working-directory: ./src/blazorservertierdemo.HttpApi.Host # Replace with your project name
working-directory: ./src/BlzWapp.HttpApi.Host # Replace with your project name
- name: dotnet publish webapp
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/webapp
working-directory: ./src/blazorservertierdemo.Blazor # Replace with your project name
working-directory: ./src/BlzWapp.Blazor # Replace with your project name
- name: Upload artifact for authserver
uses: actions/upload-artifact@v4
@ -422,9 +631,9 @@ jobs:
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'authserver-blazorserver' # Replace with your app name
app-name: 'authserver-blazorwebapp' # Replace with your app name
slot-name: 'Production'
publish-profile: ${{ secrets.authserverblazorserverPublishSettings }} # Set your Azure Web App to publish your profile as a secret in your repository settings
publish-profile: ${{ secrets.authserverblazorwebappPublishSettings }} # Set your Azure Web App to publish your profile as a secret in your repository settings
package: ./authserver
- name: Download artifact from apihost
@ -437,9 +646,9 @@ jobs:
id: deploy-to-webapp-2
uses: azure/webapps-deploy@v3
with:
app-name: 'apihost-blazorserver' # Replace with your app name
app-name: 'apihost-blazorwebapp' # Replace with your app name
slot-name: 'Production'
publish-profile: ${{ secrets.apihostblazorserverPublishSettings }} # Set your Azure Web App to publish your profile as a secret in your repository settings
publish-profile: ${{ secrets.apihostblazorwebappPublishSettings }} # Set your Azure Web App to publish your profile as a secret in your repository settings
package: ./apihost
- name: Download artifact from webapp
@ -452,9 +661,9 @@ jobs:
id: deploy-to-webapp-3
uses: azure/webapps-deploy@v3
with:
app-name: 'webapp-blazorserver' # Replace with your app name
app-name: 'webapp-blazorwebapp' # Replace with your app name
slot-name: 'Production'
publish-profile: ${{ secrets.webappblazorserverPublishSettings }} # Set your Azure Web App publish your profile as a secret in your repository settings
publish-profile: ${{ secrets.webappblazorwebappPublishSettings }} # Set your Azure Web App publish your profile as a secret in your repository settings
```
}%}
@ -509,8 +718,8 @@ jobs:
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp
working-directory: ./src/yourapp.Web # Replace with your project name
- name: Generate authserver.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/myapp/authserver.pfx -p 2D7AA457-5D33-48D6-936F-C48E5EF468ED # Replace with your password
- name: Generate openiddict.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/myapp/openiddict.pfx -p 2D7AA457-5D33-48D6-936F-C48E5EF468ED # Replace with your password
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
@ -589,8 +798,8 @@ jobs:
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/authserver
working-directory: ./src/mvctierdemo.AuthServer # Replace with your project name
- name: Generate authserver.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/authserver/authserver.pfx -p 2D7AA457-5D33-48D6-936F-C48E5EF468ED # Replace with your password
- name: Generate openiddict.pfx
run: dotnet dev-certs https -v -ep ${{env.DOTNET_ROOT}}/authserver/openiddict.pfx -p 2D7AA457-5D33-48D6-936F-C48E5EF468ED # Replace with your password
- name: dotnet publish apihost
run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/apihost

138
docs/en/solution-templates/layered-web-application/deployment/azure-deployment/terraform-web-app-service.md

@ -3,7 +3,7 @@
````json
//[doc-params]
{
"UI": ["MVC", "Blazor", "BlazorServer", "NG"],
"UI": ["MVC", "Blazor", "BlazorServer", "BlazorWebApp", "NG"],
"DB": ["EF", "Mongo"],
"Tiered": ["Yes", "No"]
}
@ -224,6 +224,53 @@ resource "azurerm_service_plan" "appserviceplan" {
sku_name = "B3"
}
resource "azurerm_linux_web_app" "webapp" {
name = "webapp-blazorserver"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
service_plan_id = azurerm_service_plan.appserviceplan.id
https_only = true
site_config {
application_stack {
dotnet_version = "6.0"
}
minimum_tls_version = "1.2"
}
}
```
{{ else }}
```terraform
# Configure the Azure provider
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0.0"
}
}
required_version = ">= 0.14.9"
}
provider "azurerm" {
features {}
}
# Create the resource group
resource "azurerm_resource_group" "rg" {
name = "blazorserver-app-tier-rg"
location = "westeurope"
}
# Create the Linux App Service Plan
resource "azurerm_service_plan" "appserviceplan" {
name = "blazorserver-app-tier-plan"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
os_type = "Linux"
sku_name = "B3"
}
# Create the web app, pass in the App Service Plan ID
resource "azurerm_linux_web_app" "authserver" {
name = "authserver-blazorserver"
@ -237,6 +284,9 @@ resource "azurerm_linux_web_app" "authserver" {
}
minimum_tls_version = "1.2"
}
app_settings = {
"Redis__Configuration" = azurerm_redis_cache.redis.primary_connection_string
}
}
resource "azurerm_linux_web_app" "apihost" {
name = "apihost-blazorserver"
@ -250,6 +300,9 @@ resource "azurerm_linux_web_app" "apihost" {
}
minimum_tls_version = "1.2"
}
app_settings = {
"Redis__Configuration" = azurerm_redis_cache.redis.primary_connection_string
}
}
resource "azurerm_linux_web_app" "webapp" {
name = "webapp-blazorserver"
@ -263,6 +316,77 @@ resource "azurerm_linux_web_app" "webapp" {
}
minimum_tls_version = "1.2"
}
app_settings = {
"Redis__Configuration" = azurerm_redis_cache.redis.primary_connection_string
}
}
resource "azurerm_redis_cache" "redis" {
name = "redis-blazorserver"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
capacity = 0
family = "C"
sku_name = "Basic"
enable_non_ssl_port = false
minimum_tls_version = "1.2"
redis_configuration {
maxmemory_reserved = 2
maxmemory_delta = 2
maxmemory_policy = "volatile-lru"
}
}
```
{{end}}
{{ else if UI == "BlazorWebApp" }}
{{if Tiered == "No"}}
```terraform
# Configure the Azure provider
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0.0"
}
}
required_version = ">= 0.14.9"
}
provider "azurerm" {
features {}
}
# Create the resource group
resource "azurerm_resource_group" "rg" {
name = "blazorwebapp-app-nontier-rg"
location = "westeurope"
}
# Create the Linux App Service Plan
resource "azurerm_service_plan" "appserviceplan" {
name = "blazorwebapp-app-nontier-plan"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
os_type = "Linux"
sku_name = "B3"
}
resource "azurerm_linux_web_app" "webapp" {
name = "webapp-blazorwebapp"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
service_plan_id = azurerm_service_plan.appserviceplan.id
https_only = true
site_config {
application_stack {
dotnet_version = "6.0"
}
minimum_tls_version = "1.2"
}
}
```
@ -285,13 +409,13 @@ provider "azurerm" {
# Create the resource group
resource "azurerm_resource_group" "rg" {
name = "blazorserver-app-tier-rg"
name = "blazorwebapp-app-tier-rg"
location = "westeurope"
}
# Create the Linux App Service Plan
resource "azurerm_service_plan" "appserviceplan" {
name = "blazorserver-app-tier-plan"
name = "blazorwebapp-app-tier-plan"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
os_type = "Linux"
@ -300,7 +424,7 @@ resource "azurerm_service_plan" "appserviceplan" {
# Create the web app, pass in the App Service Plan ID
resource "azurerm_linux_web_app" "authserver" {
name = "authserver-blazorserver"
name = "authserver-blazorwebapp"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
service_plan_id = azurerm_service_plan.appserviceplan.id
@ -316,7 +440,7 @@ resource "azurerm_linux_web_app" "authserver" {
}
}
resource "azurerm_linux_web_app" "apihost" {
name = "apihost-blazorserver"
name = "apihost-blazorwebapp"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
service_plan_id = azurerm_service_plan.appserviceplan.id
@ -332,7 +456,7 @@ resource "azurerm_linux_web_app" "apihost" {
}
}
resource "azurerm_linux_web_app" "webapp" {
name = "webapp-blazorserver"
name = "webapp-blazorwebapp"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
service_plan_id = azurerm_service_plan.appserviceplan.id
@ -349,7 +473,7 @@ resource "azurerm_linux_web_app" "webapp" {
}
resource "azurerm_redis_cache" "redis" {
name = "redis-blazorserver"
name = "redis-blazorwebapp"
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
capacity = 0

Loading…
Cancel
Save