Azure Spring Apps Enterprise Tier Configuration Service - App cannot see configuration values - spring-boot

I am working on Azure Spring Apps Enterprise Tier Configuration Service and following the instructions here:
https://learn.microsoft.com/en-us/azure/spring-apps/how-to-enterprise-application-configuration-service
I can create a "Application Configuration Service" and also setup a pattern to read YML file configuration. I can also do an "App binding" to the configuration.
However, the "App" itself is failing because it cannot read these configuration values at start up. How can I debug this or resolve this?

Related

SpringBoot - Application is failed to run, since config file references variable thats configued in azure vault

In my springboot application I have my azure vault related configuration in my application-< env >.yml file, and I reference azure vault variables in my config class. The gradle build file has azure-vault-secret starter and related dependencies. my env properties are loaded in cloud config server and my application refers from there. When I deploy my application, application fails to initialize as the variables (those are configured in azure vault) referenced in Config class are not resolved. The same setup is working if I move azure vault connection configuration directly to application.yml.
I feel, to resolve the issue - the azure connection to be established first before config class is initialized. Can somebody help on how to do that.

Configuration or link required to connect cluster of Pivotal Coud Cache in Spring boot microservices

I am setting up the Spring-boot microservices with the cluster bi-direction Pivotal cloud cache.
I have set up the bi-directional cluster in Pivotal Cloud, I have a list of locators with ports.
I have already some online docs.
https://github.com/pivotal-cf/PCC-Sample-App-PizzaStore
But couldn't understand the on which configuration the spring boot app will know to connect.
I am looking for some tutorial or some reference where I can have spring boot app linked up with the PCC(gemfire)
The way you configure a app running in PCF (Pivotal Cloud Foundry) to talk to a PCC (Pivotal Cloud Cache) service instance is by binding the app to that service instance. You can bind it either by running the cf bind command or by adding the service name in the app`s manifest.yml, something like the below
path: build/libs/cloudcache-pizza-store-1.0.0-SNAPSHOT.jar
services:
- dev-service-instance
I hope you are using Spring Boot for Apache Geode & Pivotal GemFire (SBDG) in your app, if not I recommend you to use it as it makes connecting to PCC service instance extremely easy. SBDG has the logic to extract credentials, hostname:ports needed to connect to a service instance.
You as a app developer just need to
Create the service instance.
Bind your app to the service instance.
The boilerplate code for configuring credentials, hostnames, ips are handled by SBDG.
When you deploy an application in Cloud Foundry, (or Pivotal Cloud), you need to bind it to one or more services. Service details are then automatically exposed to the app via the VCAP_SERVICES environment variable. In the case of PCC this will include the name and port of the locator. By adding the spring-geode-starter (or spring-gemfire-starter) jar to the application it will automatically process the VCAP_SERVICES value and extract the necessary endpoint information in order to connect to the cluster.
Furthermore, if security is enabled on your PCC instance, you will also need to have created a service key. As with the locator details, the necessary credentials will be exposed via VCAP_SERVICES and the starter jar will automatically process and configure them.

Deploy my spring boot application into google cloud computer engine

I got a query to ask you all. I am looking for guides that help me deploy my spring boot application on google cloud computer engine, I type in my instance IP address when I test my spring boot application I unable to access it in REST API.
May I know do you have any guides or steps for me to follow to deploy successfully in google cloud computing engine. Why do I need to deploy in computer engine is because I deployed my angular at it and I deploy it both it seems that my angular project being replaced by my spring boot application.
Codelabs GCP / Spring series has deployment tutorials:
https://codelabs.developers.google.com/spring/
GCP has some "Getting Started" tutorials you can use here:
https://cloud.google.com/java/docs/
where the specific one for deploying a java app to GCE is here:
https://cloud.google.com/java/docs/tutorials/bookshelf-on-compute-engine
But the basic steps are as follows:
Write your Spring app
Build your Spring app
Run / test your jar locally
Push your jar to a location in Storage
Create a startup script for your GCE instance
Create a new GCE VM which uses your startup script using Console, Deployment API, or gcloud tool
After that, you need to ensure you have the proper network rules in place to be able to access your API publicly. If you do not wish to learn how to use GCE, I would suggest you look into using App Engine instead because then you do not need to learn how to deploy and instead can concentrate on your api. Here is a guide to do that

Microservices Config and eureka service which one to start first?

I am creating a simple project in microservices using spring boot and netflix OSS to get my hands dirty. I have created two services
config service which has to register itself in discovery(eureka)
service.
discovery service which requires config service to be running to get its configuration.
Now when I am starting these services, both services fails due to inter dependency. What are the best practices resolve this issue and which one to start first.
PS:- I know I am creating circular dependency, But what is the way to deal with situation like this where I want to keep eureka configuration also with the config server
Thanks
I believe that you can find the answer for your question in the official spring cloud config server documentation:
Here: http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_spring_cloud_config_client
Basically you have to choose between a "Config First Bootstrap" or "Discovery First Bootstrap".
From the docs:
"If you are using a `DiscoveryClient implementation, such as Spring Cloud Netflix and Eureka Service Discovery or Spring Cloud Consul (Spring Cloud Zookeeper does not support this yet), then you can have the Config Server register with the Discovery Service if you want to, but in the default "Config First" mode, clients won’t be able to take advantage of the registration.
If you prefer to use DiscoveryClient to locate the Config Server, you can do that by setting spring.cloud.config.discovery.enabled=true (default "false"). The net result of that is that client apps all need a bootstrap.yml (or an environment variable) with the appropriate discovery configuration. (...)"

Deploy web role in Windows Azure project to web site

I've created a Windows Azure project in Visual Studio 2012 that contains both a web role (an MVC 4 project) and a worker role. I've also created a cloud service and a web site in the Windows Azure management portal. When I deploy the project it deploys both to the cloud service and creates an instance for both the web and worker roles.
I was wondering if it were possible that when I select to deploy the project that it deploys the web role to the website and the worker role to the cloud service?
Any advice would be greatly appreciated. Thank you
In order to accomplish what you're trying to do, first you would need to remove the WebRole project from your Cloud Services Project. To do that, click on cloud service project, then expand Roles node and remove the WebRole project from there. Now when you deploy this cloud project, only worker role will get deployed. Since the web role is now no longer a part of your cloud services project, you will have to deploy it separately. In order to do that, you just right click on the web project and then publish that project.
Another thing you would need to keep in mind is that your web role is now a standard web application thus it won't be able to read from service configuration file or do any thing (like diagnostcs etc.) which you would normally do when a web role is part of a cloud service. All settings in your service configuration file should go under appSettings section in web.config file.

Resources