开发者

Azure Detect Staging vs Production

开发者 https://www.devze.com 2023-03-10 17:42 出处:网络
Is there a way to detect if a worker role is in staging or production. I want to do this to supress functionality in the staged environment until it is swapped to production and then suppress the sam

Is there a way to detect if a worker role is in staging or production.

I want to do this to supress functionality in the staged environment until it is swapped to production and then suppress the same functionality in the "de-productioned" version.

The stagged environemnt only exists so that the new version can be pre uploaded to开发者_如何学运维 ensure that the swap over is ontime and with zero downtime, the previous version is then stopped while additional QA is performened and then deleted.

Thanks

Wayne


You can do so by using Service Management REST API calls. What you can do is get the properties of the hosted service (http://msdn.microsoft.com/en-us/library/ee460806.aspx) with embed-details=true query parameter. This will give you details about the hosted service deployments. What you're interested in is "" node under deployment which will give you your deployment id. You can compare this with the deployment id you get from RoleEnvironment class (http://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleenvironment_members.aspx) and using both of them you can find out if your deployment is running in staging or production slot.

Hope this helps.


The windows azure sdk for node will give you the information you are looking for - https://github.com/WindowsAzure/azure-sdk-for-node

Specifically - azure.RoleEnvironment.getCurrentRoleInstance or azure.RoleEnvironment.getRoles should give you the information necessary to trigger functionality.

And in case anyone needs to distinguish between Azure Cloud / Azure Emulator, the emulator configures an EMULATED environment variable accessible from process.env when run under the azure emulator. Which is also helpful if you are trying to distinguish between the emulator and the built-in node server.

0

精彩评论

暂无评论...
验证码 换一张
取 消