PCF Application Restart with Config Server update - .net-core

My .NET Core application is using Config Server which is referencing the configuration values which are stored in .yml at Git repo.
Do we need to restart the application once the configuration value updated in Git to get the value to be reflected?
I wanted to understand is this the expected scenario or am I missing something else?

Yes, this is how it works by default. You can configure whether the cofiguration will be fetched from git, or from the cloned config in the config-server's memory with the 'refreshRate' configuration.
See documentation for more informationt:
https://docs.pivotal.io/spring-cloud-services/2-0/common/config-server/configuring-with-git.html

Related

Application Insights requires empty appsettings.json

I've made a new .NET 6 MVC application, installed 'Microsoft.ApplicationInsights.AspNetCore' and added builder.Services.AddApplicationInsightsTelemetry(); to Program.cs
Without an appsettings.json file no application insights information is logged, if I add an empty appsettings.json file logs do appear.
This seems an odd (undocumented?) requirement, is there something simple that I'm missing to avoid this?
We are handling config for app insights elsewhere and don't want to have to add an empty settings file just for this.
Thank you #Tiny Wang for your suggestion that helped lot.
The Application insights SDK for AspNetCore package Microsoft.ApplicationInsights.AspNetCore Package required the appsettings.json file.
When you inject your application insights to your ASP .NET core application the service.AddApplicationInsightsTelemetry() requires the appsettings.json file. The Application starts when the configuration values can be read from appsettings.json file.
Refer here for more information
its better to add the "APPLICATIONINSIGHTS_CONNECTION_STRING" key value pair in your Secrets.json instead of appsettings.json. secrets.json is local to your pc and will not be pushed to github or any scm.
The services.AddApplicationInsightsTelemetry(); will look for the key APPLICATIONINSIGHTS_CONNECTION_STRING at runtime in your configurations
read more about Secrets.json at https://learn.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-6.0&tabs=windows

ASP core config files

In ASP framework I can add
<connectionStrings configSource="ConnectStrings.secrets.config" />
to the Web.config file and have a local development database ConnectStrings.secrets.config file which is in the root folder of the project but not included in the solution, and a deployed ConnectStrings.secrets.config file with my live database details.
Its a great fail safe to only develop with the dev database and publish to staging and live environments without cross pollination.
I don't want to setup predicates etc, so wont use appsettings.development.json etc. Is there a way of working with ASP Core and its appsettings.json file to refer to a separate file as above.
I'm not aware of any binding redirects in the json config of ASP core.
Generally the way we handle something like this (which is not quite as great but helps solve the whoopsies) is to validate config on startup. Inside of each config file such as appSettings.development.json we have the following key
Environment: "Development"
If the environment variable ASPNETCORE_ENVIRONMENT is a mismatch, prevent app from starting.

Elastic Beanstalk deployment of Spring Boot application - where to put the external application.properties

I am deploying a Spring Boot application to AWS Elastic Beanstalk using AWSCLI. I want to put an external application.properties file containing customer specification configurations (database credentials, etc.) in the same directory of the application. The application should pick up this properties file. How can I accomplish that? Are there any alternatives?
Spring Cloud Config
This project allows you to use an external, centralized configuration repository for one or more applications. You don't need to rebuild your application if a property changes. You can simply change the property in your configuration repository and even push the changes to all of your applications.
See this Getting Started Guide.
This above approach is what I would recommend for the scenario you described. I would not bother with having a separate directory on the application server for your configuration files. Spring Cloud Config is a great approach as it solves the problem you described and a few more.
You can alternatively specify them in an application-prod property like
server.port=5000
spring.datasource.url=jdbc:mysql://${RDS_HOSTNAME}:${RDS_PORT}/${RDS_DB_NAME}
spring.datasource.username=${RDS_USERNAME}
spring.datasource.password=${RDS_PASSWORD}
spring.jpa.hibernate.ddl-auto=create
and specify an environment variable called SPRING_PROFILES_ACTIVE with the value prod making the beanstalk smart enough to pick values from out there.

Trying to run meteor up mup setup

It appears mup setup can't run without a mup.json file. But, it appears the mup.json file is primarily used for mup deploy. Reason I ask is I'm trying to execute mup setup on the host server and it fails without the server credentials but considering that I'm already logged onto the server executing the setup I don't understand why the mup.json is being required in the first place? I'm not deploying an application so none of the application-specific settings would apply, right? If I don't have a mup.json on the server then mup setup throws an error that the mup.json file does not exist. It didn't seem really clear on the meteor up web site. Thanks!
You should run Meteor Up from your local machine as that's what it's designed for. I wrote about how to deploy with meteor up a while back and that should help you.
In a nutshell I believe you're thinking about this the wrong way. With mup, meteor deploy and soon galaxy deploy, you no longer need to "upload" your files and then go and manage them from the server. Instead your files stay local, you deploy (which will upload them) and deployment sets up your server and file structure.
Misunderstanding on my part. mup setup is something you run on your remote machine, not the host machine.

IIS7 Replication Configuration Settings

I am trying to set up a web farm where IIS configuration settings are replicated between the 2 servers. I do not want to use a shared configuration as this presents another point of failure. I have both machines (WWW1 and WWW2) set up to use a configuration file on D:\IISConfig. With this done I manually copy the configruation files from WWW1 to WWW2 and WWW2 works just fine. I then took it one step further and added file replication to automatically push any changes on WWW1 to WWW2. Then I added an App Pool to WWW1. At this point I can also browse my website with no issues on WWW1. When I went to IIS7 on WWW2 , I could see the new app pool . . .- GREAT. I tried to browse the website on WWW2 and I get an error that shuts down the DefaultAppPool:
The Module DLL c:\Windows\System32\inetsrv\authsspi.dll failed to load. The data in this error . . .
Any ideas why this might be occuing and how to get arround it?
Thanks
Belongs on Serverfault.com?
I think that when you use the configuation file and path, it is pretty much the same as using a shared configuration.
I would check that you have exactly the same modules loaded as it sounds to me like you have a security module on one web server that is not on the other, the config file is telling it to load which is causing the server to fail.
I would use the shared configuration instead.
In my Windows 2008 cluster, I have IIS set to use the shared configuration where the configuration folder is set to a folder on the local server. Then I have that folder set up as a DFS share. That way the IIS changes are automatically replicated in the cluster and the server's don't have to talk to a remote server to get the config files. This has been working great for years.
I know this is an old question, but the actual issue here is that it failed to load an authentication module.
authsspi.dll is provided by adding 'Basic Authentication' as part of the Web Server role in Windows Server. I can see this being an issue if (like me) you're accidentally using Shared Configuration across 2 or more servers that don't have an identical Role configuration for IIS.

Resources