fabrikate icon indicating copy to clipboard operation
fabrikate copied to clipboard

Scaffold environments from component.json file

Open bnookala opened this issue 6 years ago • 1 comments

It's somewhat tedious to have to guess, and often re-guess as to the correct nesting structure of the yaml/json that is consumed by fab generate. If my component.json consumes stacks which are consumed themselves of a number of number of components, then we end up with a deeply nested structure that looks like:

config:
subcomponents:
  my-cool-stack:
    config:
    subcomponents:
      component1:
        config:
           key: value
      component2:
         config:
           foo: bar

proposal: a fab scaffold my-new-environment command that will generate a yaml/json file within the "config" directory, enumerating the subcomponents defined by component.json, and automatically insert an empty subcomponent configuration into the yaml/json file.

  1. start with a component.json
name: "test-stack"
subcomponents:
- name: "elasticsearch-fluentd-kibana"
  source: "https://github.com/timfpark/fabrikate-elasticsearch-fluentd-kibana"
  method: "git"
- name: "prometheus-grafana"
  source: "https://github.com/timfpark/fabrikate-prometheus-grafana"
  method: "git"
  1. user runs fab scaffold cool-stack

  2. fabrikate generates an empty file, cool-stack.yaml in "generated", that contains the subcomponents (OT: should this iterate over subcomponents' subcomponents as well?):

config:
subcomponents:
  elasticsearch-fluentd-kibana:
    config: {}
    subcomponents: {}
  prometheus-grafana:
    config: {}
    subcomponents: {}

bnookala avatar Feb 01 '19 00:02 bnookala

fab add works towards this by automatically scaffolding out components that don't yet exist. We could add a fab init for creating a component but not adding anything to it. What else is necessary for a spanning set of functionality?

timfpark avatar Apr 13 '19 01:04 timfpark