我在本地安装了 Strapi 和 Mongodb。 我需要将其部署到 Azure。 Strapi 已在 Azure Git 存储库上提交。 我在 Azure 上使用 Ubuntu 创建了一个应用服务。
如何将我的 Strapi 部署到此? 我可以使用管道吗? 我找不到任何好的文档/示例如何做到这一点。救命!
*************
UPDATE
*************
尝试此处描述的方法后我的结果:
https://github.com/youkou2/Strapi-On-Azure-WebApp
- 构建管道工作正常,没有任何错误
- 部署管道工作正常,没有任何错误
- 已部署的网站为空。
我可以描述我所做的事情,也许有人可以帮助我找出我做错了什么。
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/
*** It is empty, why? ***
enter code 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部署也是一个选择。)
关于azure - 如何将 Strapi 部署到 Azure?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61763170/