diff --git a/docs/en/images/azure-deploy-create-web-app-2.png b/docs/en/images/azure-deploy-create-web-app-2.png index bbf8f96c64..1335d6d3ca 100644 Binary files a/docs/en/images/azure-deploy-create-web-app-2.png and b/docs/en/images/azure-deploy-create-web-app-2.png differ diff --git a/docs/en/images/azure-deploy-create-web-app-6.png b/docs/en/images/azure-deploy-create-web-app-6.png index f54a17e095..a95fca873f 100644 Binary files a/docs/en/images/azure-deploy-create-web-app-6.png and b/docs/en/images/azure-deploy-create-web-app-6.png differ diff --git a/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/azure-deployment.md b/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/azure-deployment.md index 49d3750da2..566cf80e32 100644 --- a/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/azure-deployment.md +++ b/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"] } diff --git a/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step1-create-azure-resources.md b/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step1-create-azure-resources.md index 4a4601486c..7c11879015 100644 --- a/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step1-create-azure-resources.md +++ b/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"] } @@ -41,7 +41,7 @@ To create a new Azure Web App Service, choose one of the following options: {{else}} -{{ if UI == "BlazorServer" || UI == "MVC" }} +{{ if UI == "BlazorServer" || UI == "MVC" || UI == "BlazorWebApp" }} ### Create a new Azure Web App service using the Azure Portal @@ -137,7 +137,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) -{{ if Tiered == "Yes" && (UI == "MVC" || UI == "BlazorServer")}} +{{ if Tiered == "Yes" && (UI == "MVC" || UI == "BlazorServer" || UI == "BlazorWebApp") }} ### Create a new Azure Web App Service for AuthServer application diff --git a/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step2-configuration-application.md b/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step2-configuration-application.md index 5f1ba5aafe..5c5daed964 100644 --- a/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step2-configuration-application.md +++ b/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"] } diff --git a/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step3-deployment-github-action.md b/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step3-deployment-github-action.md index a9ec807c64..dc1583fb93 100644 --- a/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/step3-deployment-github-action.md +++ b/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"] } @@ -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 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: 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: 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 ``` }%} diff --git a/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/terraform-web-app-service.md b/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/terraform-web-app-service.md index c1678c4961..7b346d0915 100644 --- a/docs/en/solution-templates/layered-web-application/deployment/azure-deployment/terraform-web-app-service.md +++ b/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