ASP.NET Core sample app illustrating how to use Config Server for Pivotal Cloud Foundry as a configuration source.
- Installed Pivotal CloudFoundry
- Installed Spring Cloud Services
- .NET Core SDK
Refer to common tasks for detailed instructions on creating a Spring Cloud Config Server instance in Cloud Foundry. This sample expects the config server to be backed by the spring-cloud-samples
repo.
cf target -o myorg -s development
cd src/SimpleCloudFoundry
dotnet restore
- Publish app to a directory selecting the framework and runtime you want to run on:
dotnet publish -f netcoreapp3.1 -r linux-x64
- Push the app using the appropriate manifest:
cf push -f manifest.yml -p bin/Debug/netcoreapp3.1/linux-x64/publish
cf push -f manifest-windows.yml -p bin/Debug/netcoreapp3.1/win10-x64/publish
The cf push
will create an app in the space by the name foo
and will bind the myConfigServer
service instance to the app. You can hit the app @ https://foo.x.y.z/
.
The Config Server should be backed by this Git repository: https://github.com/spring-cloud-samples/config-repo
Use the menus at the top of the app to see various output:
CloudFoundry Settings
- should showVCAP_APPLICATION
andVCAP_SERVICES
configuration data.Config Server Settings
- should show the settings used by the client when communicating to the config server. These have been picked up from the service binding.Config Server Data
- this is the configuration data returned from the Config Servers Git repository. It will be some of the data fromfoo.properties
,foo-development.properties
andapplication.yml
found in the Git repository.Reload
- will cause a reload of the configuration data from the server.