Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 380. Azure Web App 확장 배포 방법 [링크 복사], [링크+제목 복사]
조회: 11244
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

Azure Web App 확장 배포 방법

Azure Web App 확장 예제 제작
; https://www.sysnet.pe.kr/2/0/11540

그런데, 위와 같이 "Deployment Trigger Url(배포 트리거 URL)"로 배포한 경우에는 Kudu 환경에서 설치된 확장 목록에는 나타나지 않습니다.

https://[app_service_name].scm.azurewebsites.net/SiteExtensions/#installed

물론, 해당 App Service의 Azure Portal 메뉴인 "Extensions"의 목록으로도 나오지 않습니다. 이외에 나중에 다루겠지만 Web App 확장에 포함한 설치 스크립트를 실행하는 것도 "배포 트리거 URL"로 배포하면 동작하지 않습니다. 따라서 여러모로 생각했을 때 여러분들의 확장을 Site Extensions gallery를 통해 배포하는 것이 더 좋습니다.

Site Extensions 
; http://www.siteextensions.net/packages

* 2018년 8월에 siteextensions이 nuget.org로 바뀌었습니다.

Site Extensions are moving to nuget.org by August 2018
; https://github.com/Azure/app-service-announcements/issues/87

방법은 다음의 글에서 자세하게 설명하고 있습니다.

Azure Web Sites Extensions
; https://azure.microsoft.com/en-us/blog/azure-web-sites-extensions/

Writing a Site Extension for Azure Websites
; https://azure.microsoft.com/en-us/blog/writing-a-site-extension-for-azure-websites/

위의 글에 따라, ^^ 지난번 만든 MyAppExtension을 gallery에 배포해 보겠습니다.




갤러리 배포를 위해서는 nuget 포맷으로 해당 웹앱을 패키지 파일로 묶어야 합니다. 이를 위해 nuspec 확장자를 가진 파일을 만들어야 합니다.

[MyAppExtension.nuspec]

<?xml version="1.0"?>
<package >
  <metadata>
    <id>MyAppExtension</id>
    <title>Output environment variables</title>
    <version>1.0.1</version>
    <authors>Seongtae Jeong</authors>
    <licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>
    <projectUrl>https://github.com/stjeong/MyAppExtension</projectUrl>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>A sample aspx Site Extension that shows all of the environment variables in the app service</description>
    <iconUrl>https://raw.githubusercontent.com/stjeong/MyAppExtension/master/MyAppExtension50x50.png</iconUrl>

    <tags>AzureSiteExtension</tags>
    <packageTypes>
      <packageType name="AzureSiteExtension" />
    </packageTypes

  </metadata>
  <files>
    <file src="**\*.*" target="content" />
  </files>
</package>

링크를 보면, github를 기반으로 하는 것들만 맞춰주면 됩니다. 이 파일을 WebApp 확장 프로젝트의 (applicationHost.xdt 파일이 놓은) 루트에 추가하고 "Publish"로 배포합니다.

이제, 배포 폴더에 놓인 nuspec 파일을 지정해 패키지를 만들면 됩니다.

D:\MyAppExtension>nuget pack .\myappextension\bin\Release\Publish\SiteExtensions\MyAppExtension\MyAppExtension.nuspec

그러면 다음과 같은 압축 구조를 가진 MyAppExtension.1.0.1.nupkg 파일이 생성됩니다.

deploy_ext_gallery_1.png




자, 그럼 갤러리에 배포를 해야 하는데요, 단순히 MyAppExtension.1.0.1.nupkg 파일을 www.siteextensions.net에 업로드만 하면 됩니다. 그런데, 이게 좀 부담스럽습니다. 왜냐하면, 갤러리에 등록된 확장들이 많지 않은데 예제 성격의 바이너리를 배포하려니 눈에 띌 정도입니다.

물론 업로드 시에 "Listed in Search Results" 항목에 "No"를 설정하면 갤러리에 등록만 되고 소유자한테만 보이긴 합니다. 문제는, 그렇게 등록된 경우 Azure Portal의 Extensions의 목록에도 보이지 않아 설치를 할 수 없다는 것입니다.

이런 문제를 해결하는 방법이 "Publishing to a Private Site Extension Gallery Hosted on MyGet" 글에 나옵니다. 다름 아닌 myget에 등록한 후 그것의 feed url을 Azure의 App Service에 등록해 사용하는 것입니다.

참고로 myget에 nuget의 api key를 이용해 다음과 같이 명령행에서 업로드하는 것이 가능합니다.

nuget.exe push D:\MyGit\MyAppExtension\MyAppExtension.1.0.2.nupkg 8b7da3bb-e2ae-4d60-83a9-891266480276 -source https://www.myget.org/F/kevin13-public/api/v3/index.json

예를 들어, 자신이 만든 Web App Extension을 등록할 "App Service(Web App)"의 "설정(SETTINGS)" / "응용 프로그램 설정(Application settings)" 화면에서 다음과 같이 "SCM_SITEEXTENSIONS_FEED_URL" 키 이름으로 myget의 Feed url을 등록해 줍니다.

deploy_ext_gallery_2.png

키 이름: SCM_SITEEXTENSIONS_FEED_URL
키 값: https://www.myget.org/F/kevin13-public/api/v3/index.json

* feed url은 myget 사이트의 갤러리에서 패키지로 들어가 "our NuGet V3 feed URL (Visual Studio 2015+)" 항목으로 구할 수 있습니다.

그다음, "개발 도구(DEVELOPMENT TOOLS)" / "확장(Extensions)"으로 가 "Add" 버튼을 누르면 다음과 같이 SCM_SITEEXTENSIONS_FEED_URL 키로 등록된 URL로부터 확장 목록을 보여줍니다.

deploy_ext_gallery_3.png

당연히 선택해 설치하고 나면, 다음과 같이 Kudu 화면의 "Site extensions" / "Installed" 화면에 등록된 것을 볼 수 있습니다.

deploy_ext_gallery_4.png

설치 테스트가 되었으면 이후부터는 업그레이드에 대해 갤러리를 경유하지 않고 예전처럼 "Deployment Trigger Url(배포 트리거 URL)"로 배포해도 됩니다. 하지만 어차피 자동화 스크립트로 myget에도 올릴 테니 Kudu에서 업그레이드 버튼을 이용한 테스트도 할 겸 그냥 myget을 통해 배포를 단일화하는 것이 (경험상) 더 권장됩니다.




참고로, "https://[yoursitename].scm.azurewebsites.net/MyAppExtension" 확장 페이지를 방문했을 때 다음과 같은 메시지만 나온다면?

You do not have permission to view this directory or page.

해당 Azure Web App 설정의 Console로 들어가 확인해 보면,

D:\home\siteextensions\MyAppExtension>dir
 Volume in drive D is Windows
 Volume Serial Number is B492-AC54

 Directory of D:\home\siteextensions\MyAppExtension

06/22/2021  04:41 AM    <DIR>          .
06/22/2021  04:41 AM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)     384,532,480 bytes free

이렇게 아무 내용이 없는 경우일 것입니다.




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 6/22/2021]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 



2018-09-17 04시56분
projectkudu/kudu - Configurable settings
; https://github.com/projectkudu/kudu/wiki/Configurable-settings
정성태

1  2  3  4  5  6  7  8  9  10  11  12  [13]  14  15  ...
NoWriterDateCnt.TitleFile(s)
13304정성태3/31/20234387VS.NET IDE: 181. Visual Studio - C/C++ 프로젝트에 application manifest 적용하는 방법
13303정성태3/30/20233728Windows: 241. 환경 변수 %PATH%에 DLL을 찾는 규칙
13302정성태3/30/20234357Windows: 240. RDP 환경에서 바뀌는 %TEMP% 디렉터리 경로
13301정성태3/29/20234452Windows: 239. C/C++ - Windows 10 Version 1607부터 지원하는 /DEPENDENTLOADFLAG 옵션파일 다운로드1
13300정성태3/28/20234089Windows: 238. Win32 - Modal UI 창에 올바른 Owner(HWND)를 설정해야 하는 이유
13299정성태3/27/20233870Windows: 237. Win32 - 모든 메시지 루프를 탈출하는 WM_QUIT 메시지
13298정성태3/27/20233825Windows: 236. Win32 - MessageBeep 소리가 안 들린다면?
13297정성태3/26/20234486Windows: 235. Win32 - Code Modal과 UI Modal
13296정성태3/25/20233821Windows: 234. IsDialogMessage와 협업하는 WM_GETDLGCODE Win32 메시지 [1]파일 다운로드1
13295정성태3/24/20234108Windows: 233. Win32 - modeless 대화창을 modal처럼 동작하게 만드는 방법파일 다운로드1
13294정성태3/22/20234278.NET Framework: 2105. LargeAddressAware 옵션이 적용된 닷넷 32비트 프로세스의 가용 메모리 - 두 번째
13293정성태3/22/20234339오류 유형: 853. dumpbin - warning LNK4048: Invalid format file; ignored
13292정성태3/21/20234451Windows: 232. C/C++ - 일반 창에도 사용 가능한 IsDialogMessage파일 다운로드1
13291정성태3/20/20234825.NET Framework: 2104. C# Windows Forms - WndProc 재정의와 IMessageFilter 사용 시의 차이점
13290정성태3/19/20234323.NET Framework: 2103. C# - 윈도우에서 기본 제공하는 FindText 대화창 사용법파일 다운로드1
13289정성태3/18/20233508Windows: 231. Win32 - 대화창 템플릿의 2진 리소스를 읽어들여 자식 윈도우를 생성하는 방법파일 다운로드1
13288정성태3/17/20233624Windows: 230. Win32 - 대화창의 DLU 단위를 pixel로 변경하는 방법파일 다운로드1
13287정성태3/16/20233786Windows: 229. Win32 - 대화창 템플릿의 2진 리소스를 읽어들여 윈도우를 직접 띄우는 방법파일 다운로드1
13286정성태3/15/20234230Windows: 228. Win32 - 리소스에 포함된 대화창 Template의 2진 코드 해석 방법
13285정성태3/14/20233817Windows: 227. Win32 C/C++ - Dialog Procedure를 재정의하는 방법파일 다운로드1
13284정성태3/13/20234042Windows: 226. Win32 C/C++ - Dialog에서 값을 반환하는 방법파일 다운로드1
13283정성태3/12/20233579오류 유형: 852. 파이썬 - TypeError: coercing to Unicode: need string or buffer, NoneType found
13282정성태3/12/20233913Linux: 58. WSL - nohup 옵션이 필요한 경우
13281정성태3/12/20233837Windows: 225. 윈도우 바탕화면의 아이콘들이 넓게 퍼지는 경우 [2]
13280정성태3/9/20234588개발 환경 구성: 670. WSL 2에서 호스팅 중인 TCP 서버를 외부에서 접근하는 방법
13279정성태3/9/20234112오류 유형: 851. 파이썬 ModuleNotFoundError: No module named '_cffi_backend'
1  2  3  4  5  6  7  8  9  10  11  12  [13]  14  15  ...