azure - 如何将 Strapi 部署到 Azure?

标签 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

最佳答案

您可以尝试使用zip部署,步骤是npm install、创建zip包、发布zip包、发布zip包。欲了解更多信息,请查看官方文档:

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

顺便说一句,似乎将 Strapi 部署到 Azure Web 应用程序不是推荐的方法。

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

这是一篇关于部署strapi到azure web app的文章,介绍比较详细,也是使用zip部署:(唯一不同的是部署到windows操作系统。如果你可以使用ftp,ftp部署也是一个选择。)

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

关于azure - 如何将 Strapi 部署到 Azure?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61763170/

相关文章:

php - Azure 表存储 Rest API

c# - 使用托管标识运行 EF Core 迁移的 Azure DevOps 管道

azure - Insights 响应时间和应用服务响应时间之间的差异

node.js - Azure webapp node.js 应用程序未启动

asp.net - 使用调试配置的 Azure 持续部署

azure - 如何在具有多个控制台应用程序项目的Web作业中定义默认exe?

azure - 如何在Azure函数中的数据表上使用 "AsEnumerable()"?

azure - 如何在ARM模板中多次运行相同的脚本?

azure - 针对具有特定源分支的 master 的拉取请求不会触发 Azure 管道

azure - Azure 中的 API 应用程序未反射(reflect)持续集成部署后的更改