Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 380. Azure Web App 확장 배포 방법 [링크 복사], [링크+제목 복사]
조회: 11246
글쓴 사람
정성태 (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
정성태

... [31]  32  33  34  35  36  37  38  39  40  41  42  43  44  45  ...
NoWriterDateCnt.TitleFile(s)
12853정성태11/10/20216136오류 유형: 766. Azure App Service - JBoss 호스팅 생성 시 "This region has quota of 0 PremiumV3 instances for your subscription. Try selecting different region or SKU."
12851정성태11/1/20217517스크립트: 34. 파이썬 - MySQLdb 기본 예제 코드
12850정성태10/27/20218672오류 유형: 765. 우분투에서 pip install mysqlclient 실행 시 "OSError: mysql_config not found" 오류
12849정성태10/17/20217778스크립트: 33. JavaScript와 C#의 시간 변환 [1]
12848정성태10/17/20218765스크립트: 32. 파이썬 - sqlite3 기본 예제 코드 [1]
12847정성태10/14/20218628스크립트: 31. 파이썬 gunicorn - WORKER TIMEOUT 오류 발생
12846정성태10/7/20218381스크립트: 30. 파이썬 __debug__ 플래그 변수에 따른 코드 실행 제어
12845정성태10/6/20218213.NET Framework: 1120. C# - BufferBlock<T> 사용 예제 [5]파일 다운로드1
12844정성태10/3/20216227오류 유형: 764. MSI 설치 시 "... is accessible and not read-only." 오류 메시지
12843정성태10/3/20216673스크립트: 29. 파이썬 - fork 시 기존 클라이언트 소켓 및 스레드의 동작파일 다운로드1
12842정성태10/1/202125002오류 유형: 763. 파이썬 오류 - AttributeError: type object '...' has no attribute '...'
12841정성태10/1/20218490스크립트: 28. 모든 파이썬 프로세스에 올라오는 특별한 파일 - sitecustomize.py
12840정성태9/30/20218591.NET Framework: 1119. Entity Framework의 Join 사용 시 다중 칼럼에 대한 OR 조건 쿼리파일 다운로드1
12839정성태9/15/20219644.NET Framework: 1118. C# 11 - 제네릭 타입의 특성 적용파일 다운로드1
12838정성태9/13/20219289.NET Framework: 1117. C# - Task에 전달한 Action, Func 유형에 따라 달라지는 async/await 비동기 처리 [2]파일 다운로드1
12837정성태9/11/20218202VC++: 151. Golang - fmt.Errorf, errors.Is, errors.As 설명
12836정성태9/10/20217804Linux: 45. 리눅스 - 실행 중인 다른 프로그램의 출력을 확인하는 방법
12835정성태9/7/20219054.NET Framework: 1116. C# 10 - (15) CallerArgumentExpression 특성 추가 [2]파일 다운로드1
12834정성태9/7/20217434오류 유형: 762. Visual Studio 2019 Build Tools - 'C:\Program' is not recognized as an internal or external command, operable program or batch file.
12833정성태9/6/20216895VC++: 150. Golang - TCP client/server echo 예제 코드파일 다운로드1
12832정성태9/6/20217750VC++: 149. Golang - 인터페이스 포인터가 의미 있을까요?
12831정성태9/6/20216285VC++: 148. Golang - 채널에 따른 다중 작업 처리파일 다운로드1
12830정성태9/6/20218542오류 유형: 761. Internet Explorer에서 파일 다운로드 시 "Your current security settings do not allow this file to be downloaded." 오류
12829정성태9/5/202110185.NET Framework: 1115. C# 10 - (14) 구조체 타입에 기본 생성자 정의 가능파일 다운로드1
12828정성태9/4/20218312.NET Framework: 1114. C# 10 - (13) 단일 파일 내에 적용되는 namespace 선언파일 다운로드1
12827정성태9/4/20218286스크립트: 27. 파이썬 - 웹 페이지 데이터 수집을 위한 scrapy Crawler 사용법 요약
... [31]  32  33  34  35  36  37  38  39  40  41  42  43  44  45  ...