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

... 76  77  78  79  80  81  82  83  84  85  86  [87]  88  89  90  ...
NoWriterDateCnt.TitleFile(s)
11476정성태4/8/201812543디버깅 기술: 114. windbg - !threads 출력 결과로부터 닷넷 관리 스레드(System.Threading.Thread) 객체를 구하는 방법
11475정성태3/28/201814194디버깅 기술: 113. windbg - Thread.Suspend 호출 시 응용 프로그램 hang 현상에 대한 덤프 분석
11474정성태3/27/201812405오류 유형: 459. xperf: error: TEST.Event: Invalid flags. (0x3ec).
11473정성태3/22/201816220.NET Framework: 734. C# - Thread.Suspend 호출 시 응용 프로그램 hang 현상파일 다운로드2
11472정성태3/22/201812371개발 환경 구성: 356. GTX 1070, GTX 960, GT 640M의 cudaGetDeviceProperties 출력 결과
11471정성태3/20/201814997VC++: 125. CUDA로 작성한 RGB2RGBA 성능 [1]파일 다운로드1
11470정성태3/20/201816621오류 유형: 458. Visual Studio - CUDA 프로젝트 빌드 시 오류 C1189, expression must have a constant value
11469정성태3/19/201810459오류 유형: 457. error MSB3103: Invalid Resx file. Could not load file or assembly 'System.Windows.Forms, ...' or one of its dependencies.
11468정성태3/19/201810345오류 유형: 456. 닷넷 응용 프로그램 실행 시 0x80131401 예외 발생
11467정성태3/19/20189659오류 유형: 455. Visual Studio Installer - 업데이트 실패
11466정성태3/18/201811139개발 환경 구성: 355. 한 대의 PC에서 2개 이상의 DirectX 게임을 실행하는 방법
11463정성태3/15/201812825.NET Framework: 733. 스레드 간의 read/write 시에도 lock이 필요 없는 경우파일 다운로드1
11462정성태3/14/201814717개발 환경 구성: 354. HTTPS 호출에 대한 TLS 설정 확인하는 방법 [1]
11461정성태3/13/201817849오류 유형: 454. 윈도우 업데이트 설치 오류 - 0x800705b4 [1]
11460정성태3/13/201811416디버깅 기술: 112. windbg - 닷넷 메모리 덤프에서 전역 객체의 내용을 조사하는 방법
11459정성태3/13/201811145오류 유형: 453. Debug Diagnostic Tool에서 mscordacwks.dll을 찾지 못하는 문제
11458정성태2/21/201812691오류 유형: 452. This share requires the obsolete SMB1 protocol, which is unsafe and could expose your system to attack. [1]
11457정성태2/17/201817531.NET Framework: 732. C# - Task.ContinueWith 설명 [1]파일 다운로드1
11456정성태2/17/201822282.NET Framework: 731. C# - await을 Task 타입이 아닌 사용자 정의 타입에 적용하는 방법 [7]파일 다운로드1
11455정성태2/17/201812636오류 유형: 451. ASP.NET Core - An error occurred during the compilation of a resource required to process this request.
11454정성태2/12/201820966기타: 71. 만료된 Office 제품 키를 변경하는 방법
11453정성태1/31/201812511오류 유형: 450. Azure Cloud Services(classic) 배포 시 "Certificate with thumbprint ... doesn't exist." 오류 발생
11452정성태1/31/201817870기타: 70. 재현 가능한 최소한의 예제 프로젝트란? [3]파일 다운로드1
11451정성태1/24/201812726디버깅 기술: 111. x86 메모리 덤프 분석 시 닷넷 메서드의 호출 인자 값 확인
11450정성태1/24/201826315Windows: 146. PowerShell로 원격 프로세스(EXE, BAT) 실행하는 방법 [1]
11449정성태1/23/201815205오류 유형: 449. 단위 테스트 - Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.VideoRecorderEngine' or one of its dependencies. [1]
... 76  77  78  79  80  81  82  83  84  85  86  [87]  88  89  90  ...