class {{.PuppetModuleName}}::install inherits {{.PuppetModuleName}} {
  if str2bool($is_canary) {
    $consul_tags = [$deploy_env, "${deploy_env}-canary"]
  } else {
    $consul_tags = [$deploy_env]
  }

  consul::service { 'deploy-target-{{.Name}}':
    consul_tags => $consul_tags,
  }

  courier::install { '{{.Name}}':
    env     => $deploy_env,
    repo    => "{{.FullName}}",
    require => Consul::Service['deploy-target-{{.Name}}'],
  }

  daemontools::supervise { '{{.Name}}':
    daemon_dir     => '/var/lib/service',
    user           => 'nobody',
    syslog         => 'local3',
    enable_cgroups => true,
    wd             => '/opt/twitch/{{.Name}}/current',
    daemon         => 'bundle exec ruby bin/main.go 2>&1',
    predaemon      => [
      "export ENVIRONMENT=${deploy_env}",
      "export ROLLBAR_TOKEN=${rollbar_token}",
      "export STATSD_HOST_PORT=localhost:8125",
    ]
  }
}