Skip to content

Draft: Add Nickel version of `config.template` file and override examples

This adds a Nickel version of the config.template file and two example overrides with settings for my environments, one locally and one on the cluster. You can generate the config.template-equivalent file from these using a command similar to

./nickel-x86_64-linux export \
  --field out.bash-config config.cluster-override-example.ncl \
  --format raw \
  -- \
  env.PATH=@env:PATH env.SHAREDWORKDIR=@env:SHAREDWORKDIR env.SHAREDSCRATCHDIR=@env:SHAREDSCRATCHDIR \
  > nickel_generated.config

For this, you need a Nickel version >= 1.12.0, you can download the appropriate binary (for Linux) here.

It is structured as follows:

  • a config.ncl file that contains sort of the "schema" for the config.template file, meaning a list of all settings, together with default values, where appropriate, and a couple basic contracts (such as enums 'noop and 'remote for the SWH_LOADER_OBJSTORAGE variable, or a positive natural number for ports),
  • an override example that yields a configuration for local testing on my development machine,
  • an override example that yields a configuration for running on Adastra.

You can extend and change these examples as you like by simply adding new SETTING = value, pairs in the corresponding sections, and again, all permitted settings are in config.ncl.

For syntax explanations etc. please refer to the comments in the files contained in !58 (closed).

How does this help? When you run nickel export [...], it validates the configuration and complains if something is off. For example, I made all _DEPLOYMENT variables to not have a default value. This means you have to set them in your override, else the nickel export [...] command will fail. Most variables do have default values (that match the ones given in the config.template file, whether they make sense is out of scope for this MR), though. So if someone adds a feature, and updates config.ncl correspondingly with a variable without a default value, there is no way you can forgot to set this variable (cc @zz1874). Other than that, the items in the description of !58 (closed) apply regarding safety for enums, and ports, boolean values, ...

Please let me know if you find it useful!

💡 Draft for now because it's just a demo. If we agree we want to merge and have these unintrusive files in the repo, then I can undraft 💡

cc @yannham

Merge request reports

Loading