如何将Strapi部署到Azure?

时间:2020-05-12 22:36:34

标签: azure azure-devops azure-web-app-service web-deployment strapi

我在本地安装了Strapi和Mongodb。 我需要将其部署到Azure。 Strapi是Azure Git存储库上的提交文件。 我已经在Azure上使用Ubuntu创建了应用服务。

如何将Strapi部署到此? 我可以使用管道吗? 我找不到任何好的文档/示例该怎么做。救命!

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

尝试这里描述的方法后,我的结果:

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

  1. 构建管道正常运行
  2. 部署管道正常运行
  3. 已部署的网站为空。

我可以描述自己做了什么,也许有人可以帮助我找到我做错了什么。

a)构建管道为

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)部署管道

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)项目已部署到https://oskogencms.azurewebsites.net/

enter image description here

*** It is empty, why? ***
enter code 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

enter image description here

2 个答案:

答案 0 :(得分:1)

您可以尝试使用zip部署,步骤是npm install,创建zip软件包,发布zip软件包,发布zip软件包。有关更多信息,请查看以下官方文档:

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

顺便说一句,似乎不建议将bandi部署到Azure Web应用程序。

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

这是一篇关于将Stradi部署到azure Web应用程序的文章,介绍也更详细,也使用zip部署:(您之间的唯一区别是它已部署到Windows os。如果可以使用ftp,ftp部署也一个选择。)

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

答案 1 :(得分:1)

请在以下链接中检查@ZiedBeta的示例:

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
相关问题