Keep application old version running side-by-side with the newer version in Azure Service Fabric

允我心安 提交于 2019-12-03 13:55:50

问题


I need to keep several versions of a application running at the same time on Service Fabric.

1.0 1.1 ....

Instead of updating and replacing versions, I need to keep them online together.

Is it possible?

Thanks!


回答1:


As Matt Thalman said, is possible to have different versions of same app running in the Service Fabric cluster.

I've tested with the sample app WordCount(http://aka.ms/servicefabric-wordcountapp). To see more details how download the app and deploy it, see https://azure.microsoft.com/en-us/documentation/articles/service-fabric-get-started-with-a-local-cluster/

I've duplicated the WordCount as WordCountV1 and WordCountV2.

Then I've changed the /ApplicationManifest.xml to have different ApplicationTypeVersion on each package. It's necessary for displaying the current version of the App in the Cluster Manager because both apps are shown grouped by the ApplicationTypeName.

V1

<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="WordCount" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">

V2

<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="WordCount" ApplicationTypeVersion="2.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">

Yet I've changed the /WordCountWebServicePkg/Code/wwwroot/index.html file to have different content on both packages.

Is necessary to specify different Endpoints, so I've changed the file /WordCountWebServicePkg/ServiceManifest.xml in both packages to respond on different Ports

V1

<Endpoint Name="ServiceEndpoint" Type="Input" Protocol="http" Port="8081" />

V2

<Endpoint Name="ServiceEndpoint" Type="Input" Protocol="http" Port="8082" />

The last step is to use different a ApplicationName to publish packages:

V1

Publish-NewServiceFabricApplication -ApplicationPackagePath c:\ServiceFabric\WordCountV1.sfpkg -App
licationName "fabric:/WordCountV1"

V2

Publish-NewServiceFabricApplication -ApplicationPackagePath c:\ServiceFabric\WordCountV2.sfpkg -App
licationName "fabric:/WordCountV2"

Both apps are published side-by-side and we can have more control on version update with that.

V1

http://localhost:8081/

V2

http://localhost:8082/

Hope it helps!

PS: Azure Service Fabric documentation team, this subject can be good to be in public docs




回答2:


Yes, you can do this as long as you have different application names. The application name is specified in the application parameters file in your Service Fabric Application (.sfproj) project. That application name value is used when Visual Studio invokes Service Fabric's New-ServiceFabricApplication PowerShell cmdlet. This means you can have two apps running in a cluster with the same application type and version as long as they have different application names. Or you could have different versions of the application type if you wish. As long as they have different application names, it doesn't matter; they're treated as unique applications.



来源:https://stackoverflow.com/questions/38104616/keep-application-old-version-running-side-by-side-with-the-newer-version-in-azur

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!