jeudi 5 août 2021

How to properly deploy Ember.js App to Azure App Service using Azure CI/CD Pipeline?

I have a simple Ember.js single page web application that was created using this Ember.js tutorial (finished part 1 & 2):

Ember.js Tutorial

I am now trying to get familiar with Azure CI/CD pipelines by first creating an Azure DevOps Git Repo for the application, then a Build pipeline that is triggered by a push to the Git Repo, and finally a Release pipeline to publish the site to an Azure App Service after the build has succeeded.

The build and release pipelines both succeed, but when I visit the site, it shows a blank node.js page:

Blank node.js page

Can someone help me figure out where I went wrong here? My guess is it has to do with something in the configuration of the build and/or the release pipeline. Just can't seem to find what specific part is not correct. Any help is much appreciated. I can provide more information if needed :)

Here are my configurations for the build pipeline

  1. YAML code for build pipeline
    # Build a general Node.js project with npm.
    # Add steps that analyze code, save build artifacts, deploy, and more:
    # https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
    
    trigger:
    - master
    
    pool:
      vmImage: ubuntu-latest
    
    steps:
    - task: NodeTool@0
      inputs:
        versionSpec: '6.x'
        checkLatest: true
    
    - task: Npm@1
      inputs:
        command: 'install'
        workingDir: 'app/'
    
    - task: ArchiveFiles@2
      inputs:
        rootFolderOrFile: '$(System.DefaultWorkingDirectory)'
        includeRootFolder: true
        archiveType: 'zip'
        archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
        replaceExistingArchive: true
    
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'drop'
        publishLocation: 'Container'

Here is the configuration in the Release Pipeline

  1. Artifact Configuration

artifact configuration

  1. Continuous deployment configuration

continuous deployment configuration

  1. Stage 1: Deployment Process

enter image description here

  1. Agent Job

enter image description here enter image description here

  1. YAML for Deploying to Azure App Service
steps:
- task: AzureRmWebAppDeployment@4
  displayName: 'Deploy Azure App Service'
  inputs:
    azureSubscription: '$(Parameters.ConnectedServiceName)'
    appType: '$(Parameters.WebAppKind)'
    WebAppName: '$(Parameters.WebAppName)'
    RuntimeStack: 'NODE|14-lts'
    StartupCommand: '$(Parameters.StartupCommand)'
    WebConfigParameters: '-Handler iisnode -NodeStartFile server.js -appType node'
    AppSettings: '-WEBSITE_NODE_DEFAULT_VERSION 6.9.1'

I would also like to mention that the Azure App Service stack setting is Node 14 and is running on linux.

Thanks!




Aucun commentaire:

Enregistrer un commentaire