Skip to content

Latest commit

 

History

History

ConfigurationProviders

Steeltoe Configuration Providers Sample App

This is an ASP.NET Core application that shows how to use various IConfiguration providers that are part of the Steeltoe project.

General pre-requisites

  1. Installed .NET 8 SDK
  2. Optional: Tanzu Platform for Cloud Foundry (optionally with Windows support) with Spring Cloud Services for Cloud Foundry and Cloud Foundry CLI
  3. Optional: Tanzu Platform for Kubernetes v1.5 or higher with Application Configuration Service and Tanzu CLI

Running locally

  1. Start a Config Server docker container
  2. Run the sample
    dotnet run
    

Running on Tanzu Platform for Cloud Foundry

Config Server deployment

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.

App deployment

  1. Login to your Cloud Foundry environment and target your org/space
    cf target -o your-org -s your-space
    
  2. Run the cf push command to deploy from source
    • When deploying to Windows, binaries must be built locally before push. Use the following commands instead:
      dotnet publish -r win-x64 --self-contained
      cf push -f manifest-windows.yml -p bin/Release/net8.0/win-x64/publish
      

Running on Tanzu Platform for Kubernetes

Config Server deployment

YAML files for creating the needed resources are included with this project, and their usage is specified below, but you are encouraged to review and/or customize the contents of the files before applying them.

To create configuration objects (ConfigurationSource, ConfigurationSlice, ResourceClaim), run:

kubectl config set-context --current --namespace=your-namespace
kubectl apply -f ./config/application-configuration-service

For complete instructions, follow the documentation.

App deployment

To deploy from local source code:

tanzu app workload apply --local-path . --file ./config/workload.yaml -y

Alternatively, from locally built binaries:

dotnet publish -r linux-x64 --no-self-contained
tanzu app workload apply --local-path ./bin/Release/net8.0/linux-x64/publish --file ./config/workload.yaml -y

See the Tanzu documentation for details.


See the Official Steeltoe Configuration Documentation for more detailed information.