Using Configurations from Configuration Management Services

You can use configurations from the configuration management services such as Consul and Spring-Cloud-Config, by defining a token such as #<property name># in the application properties, where <property name> is the name of the configuration parameter.

For example, #BACKEND_URL#.

Follow these steps to use configurations from Consul:
  1. Set the environment variable CONSUL_SERVER_URL. For more information, see Environment Variables
  2. In your Consul service define the keys using the format <BWCE_APP_NAME>/<PROFILE NAME>/<KEY Name>.

    For example, AccountService/Dev/BACKEND_URL

    AccountService/Prod/BACKEND_URL

Follow these steps to use configurations from Spring Cloud Config:

  1. Set the environment variable SPRING_CLOUD_CONFIG_SERVER_URL. For more information, see Environment Variables
  2. Create a .properties file and add the application properties and their values as key-value pairs in the file. The filename for application specific properties should be <APPLICATION_NAME>-<PROFILE_NAME>.properties.

    For example, jms.application-Docker.properties

    For common properties, the filename should be application.properties.

  3. Add the .properties files to the Spring Cloud Config Server backend.
Note: Using the methods from the new ProfileResolverHelper class, users can write their own integration for config management servers
  • getKeysForConfig()- This method returns the list of all the tokens that are required to fetch from the config management server.
  • replaceProfileValues()- This method replaces values of their corresponding keys in the pcf.substvar file.
Integration with custom config management server
  • Create a new package and inside the new package create a main class.
  • Write the custom config management code in the new package with the help of the methods written in ProfileResolverHelper class inside com.tibco.bwce.profile.resolver package.
  • Create a JAR for the newly created package
  • Update the setup.sh script by including the name of the new JAR in the classpath and replace the name of the previous package and main class with the new ones. For example, if previously the <package_name>.<main_class_name> was com.tibco.bwce.profile.resolver.Resolver then replace it with the newly created package and main class.

  • Unzip the runtime zip folder and navigate to tibco.home/bwce/bwce_version/system/shared. In the shared folder, paste the newly created JAR with the custom config code and zip the files.

Using Kubernetes ConfigMap for Configuration Management with TIBCO BusinessWorks™ Container Edition.

Follow the steps to use configuration management with ConfigMaps
  1. Export the application properties file for the profile containing the module properties. For more information, see Tokenizing Application Properties for exporting in the Properties file.
  2. Add a profile name to the exported properties file. For example, BW_PROFILE=Prod.
  3. Create a Kubernetes ConfigMap using the following command:
    kubectl create configmap <Name-of-config-map> --from-env-file=<name-of-exported-file>.properties
    
  4. Add the created ConfigMap to the Kubernetes pod specification as follows:
    apiVersion: v1
    kind: Pod
    metadata:
      name: bookstore-demo
      labels:
        app: bookstore-demo
    spec:
      containers:
      - name: bookstore-demo
        image: bookstore-demo:2.4.4
        imagePullPolicy: Never
        envFrom:
        - configMapRef:
          name: <Name-of-config-map>
  5. When a pod is created using above specification, the application will pick values of the tokenized module properties in the application from ConfigMap.