3 ms·
Trees are awesome, but their usefulness is bounded by the human-friendliness of the UI. For example, a lot of apps use a hierarchical config where you can spec
by lobster_johnson 10y ago
Trees are awesome, but their usefulness is bounded by the human-friendliness of the UI.
For example, a lot of apps use a hierarchical config where you can specify everything as YAML. Elasticsearch comes to mind. This works quite well because any property can be referred to as dotted keypaths, e.g. "discovery.zen.minimum_master_nodes".
Kubernetes also uses YAML/JSON structures as a configuration interface. Kubernetes supports JSON Patch [1], a poor man's patching format for editing keys deep within a document, and it also supports JSONPath [2] for templating.
But what these don't do is treat the entire config as a big tree, and I think that's a good compromise. Kubernetes stores all its config in Etcd, but this config is considered an implementation detail — you're not supposed to edit it directly — and moreover, Etcd is like a file system, not a key/value tree; Kubernetes maps each path to a file, not a single value.
I like this approach, because individual objects can be validated separately by type. Kubernetes has a schema, which each object (YAML file) declares:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: postgresql-master
This maps directly to the version of the API that changes need to go through in order to make the configuration persistent.
If you try to make one huge key/value tree, you're more likely to end up with something like the Windows Registry, a huge ball of spaghetti.
[1] http://jsonpatch.com http://jsonpatch.com
[2] http://goessner.net/articles/JsonPath/ http://goessner.net/articles/JsonPath/
- rixed 10y agoInterestingly, when I first saw this project I thought it would be useful to me for exactly this kind of small configuration files describing jobs. I was not considering merging all config files together though. Maybe calling this a DB is misleading as it suggest having a single big file, which indeed I would not recommend.
- lobster_johnson 10y agoI don't know what your project is, but Etcd is excellent for this sort of thing if your project is distributed and you need resilience, and you can live with the external dependency on its daemons. Etcd is also a hierarchical database, but you can use it like a robust distributed file system. A big benefit you get is liveness; you can respond dynamically to config changes by watching for change events.
- rixed 10y agoWouldn't etcd require to setup several servers?
- lobster_johnson 10y agoYes.