Sign inSign up

coder95/tiller

By coder95

•Updated almost 9 years ago

Tiller is a tool that generates configuration files

Image
1

380

coder95/tiller repository overview

⁠Tiller

Tiller is a tool that generates configuration files

⁠Quick reference

visit these links for the full documentation, arguments, and guides.

⁠Usage

A simple way to get started is with the Docker image.

To see the list of command line options run:

docker run --rm -v $PWD:/opt <image-name>

Starting the container without arguments will returns the boomcatch help

docker run --rm -v $PWD:/opt coder95/tiller

This can be made simpler with a shell alias:

alias tiller='docker run --rm -v $PWD:/opt tiller'

Output:

tiller v1.2.0 (https://github.com/markround/tiller) <[email protected]>
Usage: tiller [options]
    -n, --no-exec                    Do not execute a replacement process
    -v, --verbose                    Display verbose output
    -d, --debug                      Display debug output
    -a, --api                        Enable HTTP API
    -p, --api-port [API_PORT]        HTTP API port
    -b, --base-dir [BASE_DIR]        Override the tiller_base environment variable
    -l, --lib-dir [LIB_DIR]          Override the tiller_lib environment variable
    -e, --environment [ENV]          Override the 'environment' environment variable
    -x, --exec [EXEC]                Override the 'exec' variable from common.yaml
        --md5sum                     Only write templates if MD5 checksum for content has changed
        --md5sum-noexec              Do not execute a process if no templates were written or changed
    -h, --help                       Display this screen
Tiller also uses the environment variables tiller_base, environment
and tiller_lib (or they can be provided using the arguments shown above).
See https://github.com/markround/tiller for documentation and usage.

⁠Example

Create the necessary work directories:

$ mkdir quickstart
$ mkdir quickstart/templates

Create a simple template file and save it as quickstart/templates/db.erb - this is your example database configuration file. It should have the following content:

db_hostname: <%= db_hostname %> 

⁠Example 1 : Provide value from environment

Create a file named quickstart/common.yaml with the following content:

---
data_sources: [ "file" , "environment" ]
template_sources: [ "file" ]
environments:
  development:
    db.erb:
      target: db.ini

The common.yaml configuration loads the File plugin so Tiller can parse the rest of the configuration, and also enables the Environment plugin. This by default makes all environment variables available to templates, and prefixes them with env_ and converts them to lower-case.

Now, set the environment variable and run Tiller, pointing it to your quickstart directory for loading its configuration files :

$ docker run --rm -v $PWD:/opt -e DB_HOSTNAME=mydb.example.com coder95/tiller --base-dir=./quickstart -v

Now, your template file has been written to db.ini (specified by the target: parameter in the main configuration file) and has the content set from your environment variable:

db_hostname: mydb.example.com

⁠Example 2 : Provide a default value

Modify your common.yaml so it now has the following content:

---
data_sources: [ "file" , "defaults", "environment" ]
template_sources: [ "file" ]
defaults:
  global:
    env_db_hostname: localhost
environments:
  development:
    db.erb:
      target: db.ini

This now enables the Defaults plugin and configures it to provide a default value if one is not set. Try unsetting the environment variable you set earlier and re-running Tiller :

$ docker run --rm -v $PWD:/opt coder95/tiller --base-dir=./quickstart -v

or

$ alias tiller='docker run --rm -v $PWD:/opt coder95/tiller'
$ tiller --base-dir=./quickstart -v

Now your generated file "db.ini" should contain:

db_hostname: localhost

Tag summary

Content type

Image

Digest

Size

27 MB

Last updated

almost 9 years ago

docker pull coder95/tiller