abp icon indicating copy to clipboard operation
abp copied to clipboard

Add Blazor Web App option to Azure Deployment documentation

Open berkansasmaz opened this issue 10 months ago • 8 comments

Related docs: https://abp.io/docs/latest/solution-templates/layered-web-application/deployment

We currently have deployment documents for Blazor Server and Blazor Wasm, can we also add Blazor Web App to them?

berkansasmaz avatar Apr 15 '25 10:04 berkansasmaz

@skoc10 any news about progress? I'm getting ready for the deployment of my app and would greatly appreciate this document. I will be glad to test the docs and give feedback while deploying my app. Thanks in advance for the help

jacekmichalski avatar Jun 06 '25 20:06 jacekmichalski

@berkansasmaz @skoc10 any way I can help? Any eta?

jacekmichalski avatar Jun 09 '25 09:06 jacekmichalski

I'm contacting @skoc10, and we'll update here.

berkansasmaz avatar Jun 10 '25 07:06 berkansasmaz

@skoc10 any news about progress? I'm getting ready for the deployment of my app and would greatly appreciate this document. I will be glad to test the docs and give feedback while deploying my app. Thanks in advance for the help

I plan to finish it this week.

skoc10 avatar Jun 10 '25 10:06 skoc10

@skoc10 do you happen to have written github actions workflow? Isn't it the same for the webapp as for the blazor server?

`# 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: - main workflow_dispatch:

jobs: build: runs-on: ubuntu-latest

steps:
  - uses: actions/checkout@v4

  - name: Set up .NET Core
    uses: actions/setup-dotnet@v4
    with:
      dotnet-version: '9.x'
      include-prerelease: true

  - 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 -- "${{ 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 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 apihost
    uses: actions/upload-artifact@v4
    with:
      name: .net-apihost
      path: ${{env.DOTNET_ROOT}}/apihost

  - name: Upload artifact for webapp
    uses: actions/upload-artifact@v4
    with:
      name: .net-webapp
      path: ${{env.DOTNET_ROOT}}/webapp

deploy: runs-on: ubuntu-latest needs: build environment: name: 'Production' url: ${{ steps.deploy-to-webapp-3.outputs.webapp-url }} steps: - name: Download artifact from apihost uses: actions/download-artifact@v4 with: name: .net-apihost path: ./apihost

  - name: Deploy apihost
    id: deploy-to-webapp-2
    uses: azure/webapps-deploy@v3
    with:
      app-name: 'apihost-blazorserver' # 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
      package: ./apihost

  - name: Download artifact from webapp
    uses: actions/download-artifact@v4
    with:
      name: .net-webapp
      path: ./webapp

  - name: Deploy webapp
    id: deploy-to-webapp-3
    uses: azure/webapps-deploy@v3
    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

`

jacekmichalski avatar Jun 10 '25 10:06 jacekmichalski

@jacekmichalski yes, like blazor server deployment, You can use the following similar github action

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: .

skoc10 avatar Jun 10 '25 14:06 skoc10

@skoc10 I've deployed the blazor webapp to azure using your hints but I have a problem that now when navigating to /Account/Login page there is a 500 error. In logs there is only information about missing global-scripts.js Can I add you to my repo so you can take a look at it?

jacekmichalski avatar Jun 11 '25 13:06 jacekmichalski

@skoc10 I've deployed the blazor webapp to azure using your hints but I have a problem that now when navigating to /Account/Login page there is a 500 error. In logs there is only information about missing global-scripts.js Can I add you to my repo so you can take a look at it?

Can you check that db-migrator is working and databases are created and that the openiddict.pfx file is created with your project's CertificatePassPhrase?

skoc10 avatar Jun 12 '25 05:06 skoc10

https://abp.io/docs/latest/solution-templates/layered-web-application/deployment/azure-deployment/step3-deployment-github-action?UI=BlazorWebApp&DB=EF&Tiered=No

skoc10 avatar Jun 17 '25 11:06 skoc10