[feature] different exec according to environment #10

florentvaldelievre opened this Issue Mar 12, 2015 · 7 comments


None yet

2 participants


Hi Mark,

At the moment, we only have one endpoint to exec something inside our container: common.yaml.
It would be nice to externalize this logic to have it per environment based.

Use case:

For production environment we need to launch td-agent to collect stats. It is not necessary to have it for development environment.
Currently, the only way to do it, is to have a script called launch.sh and to put the logic inside it.

Maybe it would be more versatile if we move the 'exec:' from common.yaml to environments/{env}.yaml.

Let me know what you think.

Cheers and keep up your good work


Code comitted to develop branch; this will be in the upcoming 0.5.0 release. You can override any of the settings in common.yaml by adding a common: block in your environment file, e.g.

  api_enable: true
  exec: foo -n

and so on...


Amazing, good job !


Release 0.5.0 pushed. Note that this version now requires ruby >= 1.9.2. Let me know how it works out for you, if it's all good just close this issue :)


I must do something wrong, but it does not seem to take my environment sent as environment variable into account. Any idea ?

Update: It works by sending a plain environment variable docker run -it -e environment=development api-test but does not work using tiller_json


exec: echo "common exec"
  - file
  - environment_json
  - file
default_environment: default


  target: /var/lib/tomcat7/conf/server.xml
  config: {}
  target: /root/.grails/hibe-webapp-config.groovy
  config: {}
  target: /etc/td-agent/td-agent.conf
  config: {}


  exec: echo "overrided from dev"
docker run -it -e tiller_json='{"environment":"development"}' api-test


[shopmedia@staging3:/tmp/api] $docker run -it -e tiller_json='{"environment":"development"}' api-test
tiller v0.5.0 (https://github.com/markround/tiller) <github@markround.com>
Using configuration from /app/tiller
Using plugins from /var/lib/gems/2.1.0/gems/tiller-0.5.0/lib/tiller
Using environment default
Template sources loaded [FileTemplateSource]
Data sources loaded [FileDataSource, EnvironmentJsonDataSource]
Templates to build ["server.xml.erb", "hibe-webapp-config.groovy.erb", "td-agent.conf.erb"]
Warning, merging duplicate global values.
environment => 'default' being replaced by : 'development' from EnvironmentJsonDataSource
Building template server.xml.erb
Setting ownership/permissions on /var/lib/tomcat7/conf/server.xml
Building template hibe-webapp-config.groovy.erb
Setting ownership/permissions on /root/.grails/hibe-webapp-config.groovy
Building template td-agent.conf.erb
Setting ownership/permissions on /etc/td-agent/td-agent.conf
Template generation completed
Executing echo "common exec"...
Child process forked with PID 8.
common exec
Child process finished, Tiller is stopping.


It actually make sense we have to use -e environment={env} and not tiller_json. I close the issue, and thanks again!


Cool. Oh, and one other thing - as you're running a recent Tiller, you don't need the empty

config: {}

lines. You can just omit them, and it'll still work...


brillant thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment