Configuration template development workflows

This topic is a wiki for tracking all current tools and techniques for streamlining development work on configuration templates. Please edit the top post to add or improve any workflows.

Rebuild the whole package

The simplest technique is to enter a studio and run build after each iteration. You will need to wait for all build and install steps to complete each time though. Loading the built service with --strategy at-once will cause the supervisor to reload the service automatically after each new build finishes locally, but the timing can be sporadic. Use hab svc status and watch for the elapsed column to reset to easily spot when the service has reloaded. Unloading and reloading the service manually can force an immediate update.

Use hab plan render

With hab plan render <config_file> you can immediately render any single configuration template file against manually-provided test values. The command will automatically use ./default.toml for default values if found, so it is best to run this command from the same directory where that lives. Additionally, --mock-data can be used to provide values for template data outside cfg. For example:

 hab plan render --mock-data=mocks/one-bind.json config/nginx.conf

mocks/one-bind.json

{
    "bind": {
        "backend": {
            "members": [
                {
                    "alive": true,
                    "pkg": {
                        "origin": "myorigin",
                        "name": "myapp",
                        "version": "1.0",
                        "release": "20191126160200"
                    },
                    "sys": {
                        "ip": "172.17.0.2"
                    },
                    "cfg": {
                        "port": 1234
                    }
                }
            ]
        }
    }
}

Use bio-sdk's bio-plan-rendercheck

With bio:

bio pkg install -fb ya/bio-sdk
bio-plan-rendercheck PLAN_CONTEXT
ls results/tests/render

Or, with hab:

hab pkg install -fb ya/bio-sdk
bio-plan-rendercheck --bio-cli hab PLAN_CONTEXT
ls results/tests/render

See: https://github.com/habitat-plans/bio-sdk#bio-plan-rendercheck