Service fabric. Deploy multiple applications with different configurations - azure

Im trying get three or more applications running with Service Fabric. They would all use same api services, only difference would be that each of them would get configurations from different storages. What would be the right way to pass the correct connection string without using environment variables?

Add your configuration parameters for each SF application under the application's ApplicationPackageRoot/ApplicationManifest.xml file, then specify the parameters in the "ApplicationParameters" folder for your publish profiles. More info on this approach can be found here: https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-manage-multiple-environment-app-configuration

Related

Setting application insights instrumentation key while deploying

Our company is having multiple web services deployed each having three environments- Dev, Staging, and Production. Each environment has separate resource groups which contain application insights for the service. It's a tedious task to fetch the instrumentation key for each environment and set in the appsettings file. Instead, we want to automate this process in a way.
We are thinking in the direction- we will provide the application insight name as a placeholder which will get replaced to the actual instrumentation key at the deployment time after fetching it from the respective resource group.
I have gone through some articles but I'm unable to achieve same.
Please suggest me some approaches for the same.
TLDR:
Add an output to your ARM template
Pick that up in the release as an variable
Use it to change your configuration
Details:
When you are using an ARM template for deploying Application Insights, you can specify the template to return the key as an output variable (https://learn.microsoft.com/en-us/azure/azure-resource-manager/resource-manager-templates-outputs). The ARM template deployment task can pick these outputs up and make it available as a variable with an JSON object. A more easy approach is the ARM Outputs extension (https://marketplace.visualstudio.com/items?itemName=keesschollaart.arm-outputs) where you can directly make each individual output available as an variable.
After that, the 'Deploy Service Fabric Application' task allows you to override application parameters if names match (not very self-documenting) or you can use the tokenized approach you mentioned earlier. There are numerous extensions that can do that, including: https://marketplace.visualstudio.com/items?itemName=qetza.replacetokens (haven't tried it myself)

Appsettings in Service Fabric (ASP.NET Core)

Is it possible to update appsettings and connection strings at runtime in Service Fabric like it is possible in Azure App Services?
The only similar solution I can find involves updating the VM Scale Set (VMSS), which sets environment variables to each VM in the scale set as far as I understand, and I am not interested in applications sharing these variables.
An alternative solution could be to update appsettings.json and deploy a new version, but I would prefer being able to do this.
There is no way to do a global config change. Configuration for a service should be included in the service's configuration package and changed as a versioned, rolling upgrade.

Endpoint name in project deployed on Azure Service Fabric

I'm using Service Fabric as a container for deploying existing executables.
I intend to spawn a listener on the endpoint configured at deployment time, is it possible to get the endpoint settings somehow from the context? I know that using the Stateful/stateless/actor boilerplate type of projects allow the retrieval of CodePackageActivationContext, but how about a basic console project deployed as an exe?
Thanks
You should be able to retrieve the activation context using FabricRuntime.GetActivationContext()

How can I determine which deployment I am in at runtime in an Azure-hosted Node cloud service?

I have a NodeJS Azure cloud service. I would like to make another instance for testing which would connect to a different database than the production site. I also want to avoid maintaining two separate configurations just to accomplish this. Is there any way I can get enough information about which deployment is currently running into my Node app in order to change the database connection based on that?
Just looking at the Azure management portal, it looks like I could use the Deployment Name, Deployment Label, Public Virtual IP Address, or Deployment ID. There may be other methods I have missed. The problem is I'm not sure how to get any of these for the current app into Node.

Test Azure application in Dev Fabric

I have a created a sample web role application using cloud service. Before hosting my application in cloud, i want to test the application in Dev Fabric. I am sure that when we run the application from VS, it creates an environment that simulates the cloud.
But, if I want to give my application for testing to QA, do I still need to give my source to them and run the application from VS under Dev Fabric or is there any other ways in running my deployed package under Dev Fabric.
In a line, my question is: How do i run my packaged Azure application under Dev Fabric before hosting in Cloud?
Can anyone having an idea, please share me some information?
Thanks for your quick response. CSRun command helped in accoomplishing my requirement. But i can see that it is taking an IP Address, http://127.0.0.1:80/ by default.
Also i am trying to find it out that, is there a way we can change this to a proper name instead of using like an IP?
for ex: http://localhost/ or
with deployed machine name like http://applicationserver/webrole1/ - so that we can access this from any machine in the netwrok.
I went through the Dev Fabric UI, where we can see the curent instances running, but i didnt find any options for these.
Please share me some information on this.
When you run your application locally, a different kind of package gets created (actually a directory) with a .csx extension.
As long as you have that .csx directory and your configuration file (.cscfg), you can run the package by using the "csrun" command. (So no, you don't need Visual Studio.)
You can use this blog post to access azure services running in DevFabric (DF) from other boxes -
http://blog.ehuna.org/2009/10/an_easier_way_to_access_the_wi.html

Resources