Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Design and Implement Configuration Migration #134

Open
jpdillingham opened this issue Oct 2, 2017 · 3 comments
Open

Design and Implement Configuration Migration #134

jpdillingham opened this issue Oct 2, 2017 · 3 comments
Milestone

Comments

@jpdillingham
Copy link
Member

Presently the ConfigurationManager stores strongly typed configuration models in the configuration file. Should a downstream asset update its model, the ConfigurationManager needs a way to migrate the previous configuration to the new model.

Initial thoughts are to implement a ConfigurationMigration/IConfigurationMigration to be used with the Discoverer. Implementations could have [ToVersion] and [FromVersion] attributes, allowing the ConfigurationManager to determine which migration to apply.

Migrations should be additive in that an upgrade from 1.0 to 3.0 should apply migrations for 1.0 -> 2.0, then from 2.0 -> 3.0. A migration setup for this scenario might look like the following:

[FromVersion(1.0.0.0)]
[ToVersion(2.0.0.0)]
public Migration1to2 : IConfigurationMigration { }

[FromVersion(2.0.0.0)]
[ToVersion(3.0.0.0)]
public Migration2to3 : IConfigurationMigration { }

The ConfigurationManager would need to collect all migrations and examine the versioning attributes to ensure an upgrade path is available. After migration is complete the deprecated configuration would be removed from the config (and probably backed up somewhere).

@jpdillingham
Copy link
Member Author

@adamopan thoughts?

@jpdillingham
Copy link
Member Author

Here's a present configuration section for the WebApiService Type:

  "OpenIIoT.Core.Service.WebApi.WebApiService": {
    "": {
      "Port": 80,
      "Root": "openiiot"
    }
  }

At one point the full Type name was used as the key; in this scenario that would need to return or a composite key for the dictionary would be needed (or maybe just tack the version on to the name and use a string).

Additionally versioned configuration models will need to be retained from version to version for this to work. Perhaps the configuration dictionary should be keyed on the configuration model type, not the asset it belongs to.

@jpdillingham
Copy link
Member Author

I'm also beginning to doubt the need for named instances of the same configuration. I'll create a separate issue for that.

@jpdillingham jpdillingham added this to the 1.0 Beta milestone Oct 2, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant