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

... 61  62  63  64  65  66  67  68  69  70  71  [72]  73  74  75  ...
NoWriterDateCnt.TitleFile(s)
11841정성태3/13/201910195VS.NET IDE: 132. Visual Studio 2019 - CMake의 컴파일러를 기본 g++에서 clang++로 변경
11840정성태3/13/201911292오류 유형: 526. 윈도우 10 Ubuntu App 환경에서는 USB 외장 하드 접근 불가
11839정성태3/12/201914022디버깅 기술: 124. .NET Core 웹 앱을 호스팅하는 Azure App Services의 프로세스 메모리 덤프 및 windbg 분석 개요 [3]
11838정성태3/7/201916809.NET Framework: 811. (번역글) .NET Internals Cookbook Part 1 - Exceptions, filters and corrupted processes [1]파일 다운로드1
11837정성태3/6/201926409기타: 74. 도서: 시작하세요! C# 7.3 프로그래밍 [10]
11836정성태3/5/201914346오류 유형: 525. Visual Studio 2019 Preview 4/RC - C# 8.0 Missing compiler required member 'System.Range..ctor' [1]
11835정성태3/5/201914110.NET Framework: 810. C# 8.0의 Index/Range 연산자를 .NET Framework에서 사용하는 방법 및 비동기 스트림의 컴파일 방법 [3]파일 다운로드1
11834정성태3/4/201913017개발 환경 구성: 432. Visual Studio 없이 최신 C# (8.0) 컴파일러를 사용하는 방법
11833정성태3/4/201913757개발 환경 구성: 431. Visual Studio 2019 - CMake를 이용한 공유/실행(so/out) 리눅스 프로젝트 설정파일 다운로드1
11832정성태3/4/201910805오류 유형: 524. Visual Studio CMake - rsync: connection unexpectedly closed
11831정성태3/4/201910398오류 유형: 523. Visual Studio 2019 - 새 창으로 뜬 윈도우를 닫을 때 비정상 종료
11830정성태2/26/201910196오류 유형: 522. 이벤트 로그 - Error opening event log file State. Log will not be processed. Return code from OpenEventLog is 87.
11829정성태2/26/201912105개발 환경 구성: 430. 마이크로소프트의 CoreCLR 프로파일러 예제 빌드 방법 - 리눅스 환경 [1]
11828정성태2/26/201918486개발 환경 구성: 429. Component Services 관리자의 RuntimeBroker 설정이 2개 있는 경우 [8]
11827정성태2/26/201912392오류 유형: 521. Visual Studio - Could not start the 'rsync' command on the remote host, please install it using your system package manager.
11826정성태2/26/201912275오류 유형: 520. 우분투에 .NET Core SDK 설치 시 패키지 의존성 오류
11825정성태2/25/201917142개발 환경 구성: 428. Visual Studio 2019 - CMake를 이용한 리눅스 빌드 환경 설정 [1]
11824정성태2/25/201911939오류 유형: 519. The SNMP Service encountered an error while accessing the registry key SYSTEM\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration. [1]
11823정성태2/21/201913402오류 유형: 518. IIS 관리 콘솔이 뜨지 않는 문제
11822정성태2/20/201911550오류 유형: 517. docker에 설치한 MongoDB 서버로 연결이 안 되는 경우
11821정성태2/20/201912019오류 유형: 516. Visual Studio 2019 - This extension uses deprecated APIs and is at risk of not functioning in a future VS update. [1]
11820정성태2/20/201915151오류 유형: 515. 윈도우 10 1809 업데이트 후 "User Profiles Service" 1534 경고 발생
11819정성태2/20/201913811Windows: 158. 컴퓨터와 사용자의 SID(security identifier) 확인 방법
11818정성태2/20/201912729VS.NET IDE: 131. Visual Studio 2019 Preview의 닷넷 프로젝트 빌드가 20초 이상 걸리는 경우 [2]
11817정성태2/17/20199910오류 유형: 514. WinDbg Preview 실행 오류 - Error : DbgX.dll : WindowsDebugger.WindowsDebuggerException: Could not load dbgeng.dll
11816정성태2/17/201912413Windows: 157. 윈도우 스토어 앱(Microsoft Store App)을 명령행에서 직접 실행하는 방법
... 61  62  63  64  65  66  67  68  69  70  71  [72]  73  74  75  ...