To use Tiller, in Dockerfile, we specify:

ADD deploy/tiller/*.yaml /etc/tiller/
ADD deploy/tiller/environments/dev /etc/tiller/environments/
ADD deploy/tiller/templates/* /etc/tiller/templates/

Tiller folder comprises of the following:

  • environments

This is where the yaml for environment specific variables are written:

#These are the variables to overwrite service.conf.erb template

service.conf.erb:
target: /etc/appleapi/application.ini
config:
environment_name: “prod”

#These are the variables to overwrite template.conf.erb template

template.conf.erb:
target: /etc/appleapi/application.conf

#database
appleapi_database_url: jdbc:postgresql://appledb:5432/appleapi
deliveryapi_database_user: apple
deliveryapi_database_password: apple

  • templates

There are the files in the server to be overwritten:

# PostgreSQL configuration (default datasource)
db.default.driver=org.postgresql.Driver
db.default.url=”<%=appleapi_database_url%>”
db.default.username=”<%=appleapi_database_user%>”
db.default.password=”<%=appleapi_database_password%>”

  • common.yaml

data_sources: [ “defaults” , “file” , “environment” ]
template_sources: [ file ]
deep_merge: true

Load the defaults, file and then environment data source to overwrite the templates

  • default.yaml

global:
application_name: “appleapi”
application_port: 9001

Default variables that are shared regardless of environment

Run it in Dockerfile:

RUN tiller -b /etc/tiller -n -v -e production