Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 380. Azure Web App 확장 배포 방법 [링크 복사], [링크+제목 복사],
조회: 11353
글쓴 사람
정성태 (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)
13485정성태12/15/20232101오류 유형: 883. dotnet build/restore - error : Root element is missing
13484정성태12/14/20232179개발 환경 구성: 694. Windows 디렉터리 경로를 WSL의 /mnt 포맷으로 구하는 방법
13483정성태12/14/20232321닷넷: 2184. C# - 하나의 resource 파일을 여러 프로그램에서 (AOT 시에도) 사용하는 방법파일 다운로드1
13482정성태12/13/20232923닷넷: 2183. C# - eFriend Expert OCX 예제를 .NET Core/5+ Console App에서 사용하는 방법 [2]파일 다운로드1
13481정성태12/13/20232297개발 환경 구성: 693. msbuild - .NET Core/5+ 프로젝트에서 resgen을 이용한 리소스 파일 생성 방법파일 다운로드1
13480정성태12/12/20232678개발 환경 구성: 692. Windows WSL 2 + Chrome 웹 브라우저 설치
13479정성태12/11/20232356개발 환경 구성: 691. WSL 2 (Ubuntu) + nginx 환경 설정
13477정성태12/8/20232556닷넷: 2182. C# - .NET 7부터 추가된 Int128, UInt128 [1]파일 다운로드1
13476정성태12/8/20232278닷넷: 2181. C# - .NET 8 JsonStringEnumConverter의 AOT를 위한 개선파일 다운로드1
13475정성태12/7/20232353닷넷: 2180. .NET 8 - 함수 포인터에 대한 Reflection 정보 조회파일 다운로드1
13474정성태12/6/20232203개발 환경 구성: 690. 닷넷 코어/5+ 버전의 ilasm/ildasm 실행 파일 구하는 방법 - 두 번째 이야기
13473정성태12/5/20232419닷넷: 2179. C# - 값 형식(Blittable)을 메모리 복사를 이용해 바이트 배열로 직렬화/역직렬화파일 다운로드1
13472정성태12/4/20232222C/C++: 164. Visual C++ - InterlockedCompareExchange128 사용 방법
13471정성태12/4/20232298Copilot - To enable GitHub Copilot, authorize this extension using GitHub's device flow
13470정성태12/2/20232614닷넷: 2178. C# - .NET 8부터 COM Interop에 대한 자동 소스 코드 생성 도입파일 다운로드1
13469정성태12/1/20232329닷넷: 2177. C# - (Interop DLL 없이) CoClass를 이용한 COM 개체 생성 방법파일 다운로드1
13468정성태12/1/20232276닷넷: 2176. C# - .NET Core/5+부터 달라진 RCW(Runtime Callable Wrapper) 대응 방식파일 다운로드1
13467정성태11/30/20232367오류 유형: 882. C# - Unhandled exception. System.Runtime.InteropServices.COMException (0x800080A5)파일 다운로드1
13466정성태11/29/20232554닷넷: 2175. C# - DllImport 메서드의 AOT 지원을 위한 LibraryImport 옵션
13465정성태11/28/20232309개발 환경 구성: 689. MSBuild - CopyToOutputDirectory가 "dotnet publish" 시에는 적용되지 않는 문제파일 다운로드1
13464정성태11/28/20232434닷넷: 2174. C# - .NET 7부터 UnmanagedCallersOnly 함수 export 기능을 AOT 빌드에 통합파일 다운로드1
13463정성태11/27/20232379오류 유형: 881. Visual Studio - NU1605: Warning As Error: Detected package downgrade
13462정성태11/27/20232394오류 유형: 880. Visual Studio - error CS0246: The type or namespace name '...' could not be found
13461정성태11/26/20232421닷넷: 2173. .NET Core 3/5+ 기반의 COM Server를 registry 등록 없이 사용하는 방법파일 다운로드1
13460정성태11/26/20232367닷넷: 2172. .NET 6+ 기반의 COM Server 내에 Type Library를 내장하는 방법파일 다운로드1
13459정성태11/26/20232345닷넷: 2171. .NET Core 3/5+ 기반의 COM Server를 기존의 regasm처럼 등록하는 방법파일 다운로드1
1  2  3  4  5  [6]  7  8  9  10  11  12  13  14  15  ...