Close menu

Demo OS Connector

Provide configuration files to a Linux or Windows-based machine.

Introduction

The OS Connector is able to provide static or environment-specific configuration files to a linux or windows machine. This demo gives an introduction to the use of the OS Connector.

You will understand, how

  • static configuration files are defined in ConfigSeeder
  • configuration files with templating are defined in ConfigSeeder
  • the OS Connector provides configuration files to a machine

To be able to follow this demo, the following prerequisites must be met:

  • ConfigSeeder is up and running
  • Connectivity from the machine running OS Connector to the ConfigSeeder
  • Licence which supports the use of OS Connector

Prepare configuration groups in ConfigSeeder

  1. Create a configuration group os-connector-quickstart (the name of the configuration group can be chosen as desired). When creating the configuration group, just enable the filter columns Environment and Context and leave the security options on their default values.
  2. Create the two environments TEST and PROD (the name of the Environments can be chosen as desired)
  3. Create two API Keys with permission to access the configuration group os-connector-quickstart. One API Key should have permissions to access the Test-environment, the other one for Production.

Copy the generated API Key to a secure location. ConfigSeeder doesn’t store API Keys so you can’t retrieve it again.

Scenario 1: Static configuration

Prepare configuration values in ConfigSeeder

Open the configuration group os-connector-quickstart, navigate to the Value Assemblies-Tab and create the following Assembly (Type Static file):

Remarks:

  • Adapt the path to a location where you want the file to be created by os-connector.
  • if you are trying out the os-connector on Windows, be sure to enter a valid windows path (c:\temp...)

Setup OS Connector

Download and unpack the OS Connector to your system (depending on os please use linux-connector or windows-connector)

Create the file osConnector.yaml with the follwing content:

osConnector:
   file:
     directoryWhitelist:
       - /tmp                                           (1)
   configSeeder:
     configurationGroupKeys: "os-connector-quickstart"
     tenantKey: "default"                               (2)
     environmentKey: "TEST"                             (3)
     context: "example-static"                          (4)
     serverUrl: "http://url"                            (5)
     apiKey: "eyJraWQiO..."                             (6)
  1. The configuration option directoryWhitelist controls, to which locations the OS Connector is allowed to write files to. If this option isn’t configured, the OS Connector can write everywhere.
  2. Tenant, in which the configuration is stored. The name of the default tenant is default (it is only required to specify the tenant if not the default tenant is used. If no tenant is specified default is used by convention)
  3. Environment, for which the configuration should be read.
  4. The context, for which the configuration should be retrieved. Is normally the name of the os (hostname) but can be any value. If multiple OS Connectors are used, the combination of environment and context should be unique. In this demo, context is used to distinguish the different scenarios.
  5. URL under which the ConfigSeeder Management (or a value provider) is reachable.
  6. Api Key with permissions to access the configured configuration groups and enviroment.

Execute OS Connector

Start the OS Connector by executing ./linux-connector or executing windows-connector.exe

As a result, the OS Connector should log Created file /tmp/quickstart-static.txt for Application quickstart-pplication and the file /tmp/quckstart-static.txt should have been created with the configured content.

If the executable is run again, the OS Connector should log something like LastUpdate matches, no action required for file /tmp/quickstart-static.txt for Application quickstart-application and the file should be unchanged. If the content is changed and the command rerun, the OS Connector will change content of the file so it matches the configured content again.

If the environmentKey value is changed from TEST to PROD in the osConnector.yaml and the command executed again, the content of the file represents the production configuration.

Scenario 2: Configuration with templating

Prepare configuration values in ConfigSeeder

Open the configuration group os-connector-quickstart, navigate to the Value Assemblies-Tab and create the following assembly of type Static file:

Remarks:

  • In this example there is no environment set. The content of the file is controlled by the values which are used for the templating, see next step.

Open the configuration group os-connector-quickstart-values, navigate to the Configurations-Tab and create the following configuration values:

Setup OS Connector

Ensure that the OS Connector is available & change the osConnector.yaml to:

osConnector:
  file:
    directoryWhitelist:
      - /tmp
  configSeeder:
    configurationGroupKeys: "os-connector-quickstart"
    tenantKey: "default"
    environmentKey: "TEST"
    context: "example-templating"                       (1)
    serverUrl: "http://url"
    apiKey: "eyJraWQiO..."
  1. change context to example-templating

Execute OS Connector

Start the OS Connector by executing ./linux-connector or executing windows-connector.exe

As a result, the OS Connector should log Created file /tmp/quickstart-templating.txt for Application quickstart-application and the file /tmp/quckstart-static.txt should have been created with the content configured for test.

If the environmentKey value is changed from TEST to PROD in the osConnector.yaml and the command executed again, the content of the file represents the production configuration.