How to deploy Strapi to Azure?

Viewed 2896

I installed Strapi with Mongodb locally. I need to deploy it to Azure. Strapi is commitet on Azure Git-repository. I have created a App Service with Ubuntu on Azure.

How to deploy my Strapi to this? Can I use pipeline? I can't find any good documentaion/example how to do it. Help!

*************
   UPDATE
*************

My results after trying the method described here:

https://github.com/youkou2/Strapi-On-Azure-WebApp

  1. Build pipeline works without any error
  2. Deploy pipeline works without any error
  3. Deployed web site is empty.

I can describe what I have done, may be somebody can help me to find what I did wrong.

a) Build pipeline is

pool:
  name: Azure Pipelines
steps:
- bash: |
   yarn install 
   set NODE_ENV=PRODUCTION     
   yarn build  

   rm -rf .cache
   rm -rf .git
   displayName: Build

- task: ArchiveFiles@2
  displayName: 'Archive ./'
  inputs:
    rootFolderOrFile: ./
    includeRootFolder: false

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: drop'

*** It works ok, no errors ***

b) Deploy pipeline

steps:
- task: AzureRmWebAppDeployment@4
  displayName: 'Deploy Azure App Service'
  inputs:
    azureSubscription: '$(Parameters.ConnectedServiceName)'
    appType: '$(Parameters.WebAppKind)'
    WebAppName: '$(Parameters.WebAppName)'

*** It works ok, no errors ***

c) Project is deployed to https://oskogencms.azurewebsites.net/

enter image description here

*** It is empty, why? ***
enter code here

Here is additional info around the deployment:

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

2 Answers

You can try to use zip deploy, The steps is npm install, create zip package, publish zip package, release zip package. For more information please have a look of this the offcial doc:

https://docs.microsoft.com/en-us/azure/app-service/deploy-zip

By the way, it seems deploy strapi to azure web app is not the recommended method.

https://strapi.io/documentation/3.0.0-beta.x/deployment/azure.html#azure

This is an article on deploying strapi to azure web app, the introduction is more detailed, also using zip deployment:(The only different between you is it is deployed to windows os. If you can use ftp, ftp deploy is also a choice.)

https://github.com/youkou2/Strapi-On-Azure-WebApp

Please check @ZiedBeta's sample in the following link:

https://github.com/strapi/strapi/issues/3580

Build pipeline:

    pool:
      name: Azure Pipelines
    steps:
    - bash: |

       yarn install 

       yarn build

       rm -rf .cache
       rm -rf .git
      displayName: build

    - task: ArchiveFiles@2
      displayName: 'Archive Strapi'
      inputs:
        rootFolderOrFile: ./
        includeRootFolder: false

    - task: PublishBuildArtifacts@1
      displayName: 'Publish Artifact: drop'


Development pipeline:

    steps:
    - task: AzureRmWebAppDeployment@4
      displayName: 'Deploy Azure App Service'
      inputs:
        azureSubscription: '$(Parameters.ConnectedServiceName)'
        appType: '$(Parameters.WebAppKind)'
        WebAppName: '$(Parameters.WebAppName)'
        enableCustomDeployment: true
        DeploymentType: zipDeploy
Related