【Azure 应用服务】App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot。 这个是因为什么?
问题描述
App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot。 这个是因为什么? 并且通过Git发布静态文件的时候不成功。出现“Could not detect any platform in the source directory.” 和 "Error: Couldn't detect a version for the platform 'php' in the repo."错误
查看日志
遇见发布时候的错误,除了在发布时候本地可以查看外,还可以在App Service的Kudu中查看。通过下列步骤来查看部署日志:
一:进入Kudu
二:进入发布日志(D:\home\site\deployments\temp-xxxx)
三:查看日志内容
- 2021-03-16T03:20:50 Updating branch 'master'.
- 2021-03-16T03:21:00 Updating submodules.
- 2021-03-16T03:21:00 Preparing deployment for commit id '208129ed8c'.
- 2021-03-16T03:21:00 Repository path is /home/site/repository
- 2021-03-16T03:21:00 Running oryx build...
- 2021-03-16T03:21:00 Command: oryx build /home/site/repository -o /home/site/wwwroot --platform php --platform-version 7.4 -i /tmp/8d8e82a85ff94d0 --log-file /tmp/build-debug.log
- 2021-03-16T03:21:04 Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
- 2021-03-16T03:21:04 You can report issues at https://github.com/Microsoft/Oryx/issues
- 2021-03-16T03:21:04
- 2021-03-16T03:21:04 Oryx Version: 0.2.20201105.1, Commit: 127d6a3c61a6c0eb67bcfeee0600c3fe71251839, ReleaseTagName: 20201105.1
- 2021-03-16T03:21:04
- 2021-03-16T03:21:04 Build Operation ID: |wb65mFzxGQU=.83c35c89_
- 2021-03-16T03:21:04 Repository Commit : 208129ed8c6e3b88ee890d958000b1cd72b9bacc
- 2021-03-16T03:21:04
- 2021-03-16T03:21:04 Detecting platforms...
- 2021-03-16T03:21:05 Could not detect any platform in the source directory.
- 2021-03-16T03:21:05 Error: Couldn't detect a version for the platform 'php' in the repo.
- 2021-03-16T03:21:08 Error: Couldn't detect a version for the platform 'php' in the repo.
- /opt/Kudu/KuduConsole/Scripts/starter.sh oryx build /home/site/repository -o /home/site/wwwroot --platform php --platform-version 7.4 -i /tmp/8d8e82a85ff94d0 --log-file /tmp/build-debug.log
- 2021-03-16T03:21:08
问题分析
根据日志总的错误消息,发现有这样两段日志:
|
错误原因是由于执行命令 oryx build /home/site/repository -o /home/site/wwwroot --platform php xxxxxx 时发现build目录中并没有php相关文件导致的。由于使用local git部署需要使用Orxy进行build,如果成功后才会将repository文件夹中的内容输出到wwwroot下,所以最初的问题为什么wwwroot中没有内容。
由于目前orxy不支持纯静态文件的部署,在Github中也有相对应的Issue存在:https://github.com/microsoft/Oryx/issues/623
Support for static files? #623
Hi,
I have an existing static site (just .html files) which is currently deployed to netlify.
What configuration do you have to use to just deploy these files? At the moment the build is failing with the error
Error: Could not detect the language from repo.
Many thanks!
Howard
@HowardvanRooijen I was able to get a site that was 100% static html, css, and javascript to deploy. It was definitely a workaround style approach but it did work:
- remove everything from my repository except
- git related files (.gitignore)
- .github directory
- directory (i called mines 'pregen') containing html, css, js, gifs, etc
- in the .github/azure-static-web-apps-*.yml file set the app_location to your html directory (I called mines 'pregen')
This worked for deploying truly static web site with no real build process to Azure Static Web Apps
@kichalla I think the main thing that is confusing here is that Oryx emits an error about detection. As discussed we probably want to have an option to not emit that error and just use the custom status code for saying detection failed. Static Web Apps assumes static content when we see that error code.
解决办法
可以在提交时,保证git仓储里面有一个php文件,这样可以保证orxy正常运行build。如增加一个简单的test.php,里面就放入非常简单的一句代码即可:
- <?php
- phpinfo();
- ?>
参考资料
从本地 Git 部署到 Azure 应用服务:https://docs.azure.cn/zh-cn/app-service/deploy-local-git
oryx build:https://github.com/Microsoft/Oryx#oryx-build
Support for static files? #623 : https://github.com/microsoft/Oryx/issues/623
【Azure 应用服务】App Service 在使用GIt本地部署,上传代码的路径为/home/site/repository,而不是站点的根目录/home/site/wwwroot。 这个是因为什么?的更多相关文章
- 【Azure 应用服务】PHP应用部署在App Service for Linux环境中,上传文件大于1MB时,遇见了413 Request Entity Too Large 错误的解决方法
问题描述 在PHP项目部署在App Service后,上传文件如果大于1MB就会遇见 413 Request Entity Too Large 的问题. 问题解决 目前这个问题,首先需要分析应用所在的 ...
- git本地项目上传远程
Git的安装就不说了. 原文:https://blog.csdn.net/zamamiro/article/details/70172900 github官网说明: …or create a new ...
- git——本地项目上传到git
1.对于github相信大家写自动化代码的人都不陌生,而且这也可以说是你进军自动化的一项必须解锁的技能,今天抽空开始整理笔记,顺便整理下github的基本使用,从本地上传代码托管: 一.从无到有:先注 ...
- Git安装与上传代码至Github
转载请注明出处:http://www.cnblogs.com/cnwutianhao/p/6642887.html 这篇文章应该是全网最新,最全,最靠谱的Github安装到上传代码的流程. 1.Git ...
- Git 本地项目上传至托管平台(OsChina/GitHub)
为了方便自己的代码管理,通常是把自己的写的一些小项目分享到GitHub 或者git.oschina上面! 区别: GitHub 只能创建公开的项目,国外的,速度慢! git.oschina 开源中国的 ...
- Git本地项目上传 & SourceTree & GitHub 简单使用
Git(分布式版本控制系统) Git是一款免费.开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目. Git是一个开源的分布式版本控制系统,用以有效.高速的处理从很小到非常大的项目版本管理 ...
- git本地项目上传至码云gitee
如果你的本机是安装成功第一次使用,先配置一下一些基本的信息 $ git config--global user.name "Your Name" $ git config --gl ...
- git ——本地项目上传到git
1.(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库 git init 2.把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点 ...
- 使用GIt向github上传代码
github是一个基于git的代码托管平台,付费用户可以建私人仓库,我们一般的免费用户只能使用公共仓库,也就是代码要公开.这对于一般人来说公共仓库就已经足够了. 1.注册账户以及创建仓库 要想 ...
随机推荐
- Python对excel的基本操作
Python对excel的基本操作 目录 1. 前言 2. 实验环境 3. 基本操作 3.1 安装openpyxl第三方库 3.2 新建工作簿 3.2.1 新创建工作簿 3.2.2 缺省工作表 3.2 ...
- frontends tools
frontends tools figma free online UI 可视化埋点 https://www.figma.com/files/recent cypress testing $ npm ...
- Node.js & ES modules & .mjs
Node.js & ES modules & .mjs Node.js v13.9.0 https://nodejs.org/api/esm.html https://nodejs.o ...
- 200万枚SPC空投来袭,这样的薅羊毛活动你确定不参加吗?
在过去的2020年,币圈真的是很火爆,很多人在参与数字货币交易或DeFi挖矿中赚到了大钱.但是转眼到了2021年,DeFi进入了下半场,区块链市场也进入了新的阶段,那么区块链的下一个爆点是什么呢?很多 ...
- 微软YARP初体验
本文讨论了微软的反向代理--YARP.YARP是一个可以创建高性能.高度可定制的反向代理服务器的类库.那么什么是反向代理呢?反向代理是位于用户与目标服务器之间的中间连接点.它接收初始的HTTP连接请求 ...
- 【Azure 应用服务】App Service与APIM同时集成到同一个虚拟网络后,如何通过内网访问内部VNET的APIM呢?
问题描述 App Service访问的APIM已配置内部虚拟网络(Internal VNet)并拥有内网IP地址.App Service与APIM都在相同的虚拟网络(VNET)中.App Servic ...
- Jump Server在docker中安装部署
安装部署: 1.准备机器: 官方环境要求: 硬件配置: 2个CPU核心, 4G 内存, 50G 硬盘(最低) 操作系统: Linux 发行版 x86_64 Python = 3.6.x Mysql S ...
- 基于vue3+electron11实现QQ登录切换|自定义导航栏|托盘|打包
上一篇有给大家分享过使用vue3和electron快速搭建项目.创建多窗口/父子modal窗口的一些方法.今天继续给大家分享一些vue3.x+electron11项目开发中的一些知识点/踩坑记录,希望 ...
- JAVA基础(零)—— 踩坑与错误(常更)
JAVA基础(零)-- 踩坑与错误(常更) 1 坑 考虑输入为null的情况 自动转换 x/Math.pow(10,i)*Math.pow(10,i) //由于math.pow()返回double类型 ...
- 企业安全_DNS流量监控的技术选型
方案1 Windows server n ---> packbeat ---> logstash ---> kafka | ┗ ---------> elasticsearch ...