github.com/m3db/m3@v1.5.0/config/README.md (about)

     1  ## WARNING: This documentation is not complete. 
     2  
     3  # Configs
     4  
     5  This directory contains all of the configs needed to run M3 in a variety of modes (local, clustered, etc.)
     6  
     7  ## How-To
     8  
     9  Below are instructions for how to generate a `yaml` file for the clustered M3DB jsonnet file. Other jsonnet files follow a similar pattern.
    10  
    11  1. Navigate to `./m3db/clustered-etcd` directory
    12  2. Add any changes to either the `db` or `coordinator` sections of the config that you want to change from the base file (`m3dbnode.libsonnet`) in `m3dbnode_cmd.libsonnet` using local variables. For example, to change the listen address of the `coordinator` as well as input the hosts and IP addresses of the etcd nodes:
    13  
    14  ```
    15  local lib = import 'm3dbnode.libsonnet';
    16  
    17  local cluster = {
    18    HOST1_ETCD_ID: "host_name1",
    19    HOST1_ETCD_IP_ADDRESS: "host_ip1",
    20    HOST2_ETCD_ID: "host_name2",
    21    HOST2_ETCD_IP_ADDRESS: "host_ip2",
    22    HOST3_ETCD_ID: "host_name3",
    23    HOST3_ETCD_IP_ADDRESS: "host_ip3",
    24  };
    25  
    26  local coordinator = {
    27          "listenAddress": {
    28              "type": "config",
    29              "value": "localhost:7208"
    30      },
    31  };
    32  
    33  std.manifestYamlDoc(lib(cluster, coordinator))
    34  ```
    35  
    36  3. Run the following `jsonnet` command. This will generate a file called `generated.yaml` within the directory.
    37  ```
    38  	make config-gen
    39  ```
    40  
    41  ## Configuration Schemas
    42  
    43  At this time, each service's configuration is defined as a Go struct in a corresponding `config` package. For instance, `m3aggregator`'s config is in [src/cmd/services/m3aggregator/config/config.go](https://github.com/m3db/m3/blob/master/src/cmd/services/m3aggregator/config/config.go).
    44  
    45  Validation is done using [https://godoc.org/gopkg.in/go-playground/validator.v2](https://godoc.org/gopkg.in/go-playground/validator.v2), look for `validate` tags in the structs.
    46  
    47  ## Advanced: Environment Variable Interpolation
    48  M3 uses [go.uber.org/config](https://godoc.org/go.uber.org/config) to load its configuration. This means that we support environment variable interpolation of configs. For example:
    49  
    50  Given the following config: 
    51  
    52  ```
    53  foo: ${MY_ENV_VAR}
    54  ```
    55  
    56  and an environment of `MY_ENV_VAR=bar`, the interpolated YAML will be:
    57  
    58  ```
    59  foo: bar
    60  ```
    61  
    62  This can be useful for further tweaking your configuration without generating different files for every config permutation.