This cookbook deploys and manages an instance of Hubot. It is assumed that the Hubot
instance lives in its own repository and that it needs to be deployed as an application with the opportunity to overlay
things like environmental variables via Chef, much like the default Heroku-based deployment. This differs from Seth
Chisamore's hubot cookbook, which generates the Hubot instance,
configuring many aspects via Chef attributes. Both are valid approaches. The reason why modcloth-hubot
was created
was to play nicely with tools that want to manage deployments via git such as
Dreadnot so that Hubot deployments could be done dogfood-style.
Both git and nodejs should be installed, which is done automatically via the modcloth-hubot::prereqs
cookbook. See
the attributes section below for how to opt out of this.
Ubuntu > 10.04
(with Upstart) and SmartOS are supported.
node['modcloth_hubot']['user']
- user to create for the Hubot instance (defaulthubot
)node['modcloth_hubot']['group']
- group to create for the Hubot instance (defaulthubot
)node['modcloth_hubot']['gid']
- group id for the Hubot group (default1499
)node['modcloth_hubot']['home']
- home directorynode['modcloth_hubot']['id_rsa']
- private rsa ssh key stringnode['modcloth_hubot']['id_rsa_pub']
- public rsa ssh key stringnode['modcloth_hubot']['name']
- Hubot instance name (personality!)node['modcloth_hubot']['adapter']
- adapter to use (e.g.campfire
,hipchat
,irc
, etc.)node['modcloth_hubot']['http_port']
- default HTTP portnode['modcloth_hubot']['repo']
- repository URL for Hubot instancenode['modcloth_hubot']['revision']
- revision of Hubot instance reponode['modcloth_hubot']['deploy_action']
- passed todeploy_revision
, e.g.deploy
,nothing
.node['modcloth_hubot']['rollback_on_error']
- passed todeploy_revison
node['modcloth_hubot']['service_name']
- name of upstart/smf servicenode['modcloth_hubot']['environment']
-Hash
of environment variables written to an/etc/default
file which is sourced by the Hubot service. This is the rough equivalent of configuring multiple env vars via the Heroku tool. Environmental variables may also be set via file(s) that live in the Hubot instance repository. See theenv_cascade
attribute below.node['modcloth_hubot']['env_cascade']
-Array
of file names to source to prepare the Hubot environmental variable soup. The working directory when the files are sourced is the clone of the Hubot instance repo. The bashset -a
option is set prior to sourcing so thatexport VAR
is not necessary. If a given file does not exist, it will be silently skipped. (default%w(.env /etc/default/hubot)
)
node['modcloth_hubot']['nginx']['enabled']
- whether to include themodcloth-hubot::nginx
recipe from within themodcloth-hubot::default
recipe (defaulttrue
).node['modcloth_hubot']['nginx']['install_nginx']
- whether to include thenginx::default
recipe to install nginxnode['modcloth_hubot']['nginx']['listen_port']
- used in the Hubot-specific nginx configserver
sectionnode['modcloth_hubot']['nginx']['server_name_aliases']
- additional server names to set inserver_name
node['modcloth_hubot']['nginx']['site_name']
- the file basename to use insites-available/
node['modcloth_hubot']['nginx']['auth_basic']['enabled']
- whether to addauth_basic
configuration to nginx site (defaultfalse
).node['modcloth_hubot']['nginx']['auth_basic']['realm']
- string realm for basic auth (defaultHubot
).node['modcloth_hubot']['nginx']['auth_basic']['users']
-Hash
of user + credentials to use for writing thehtpasswd
file. If the credentials strings begin with{(PLAIN|SHA|SSHA)}
, they are written unaltered, else the strings will beSSHA
-encoded. (default{}
).node['modcloth_hubot']['nginx']['auth_basic']['user_file']
- file path forhtpasswd
(default$nginx_dir/hubot.htpasswd
).node['modcloth_hubot']['nginx']['ssl']['enabled']
- whether to enable ssl on the Hubot siteserver
(defaultfalse
)node['modcloth_hubot']['nginx']['ssl']['crt_file']
-crt
file to use asssl_certificate
node['modcloth_hubot']['nginx']['ssl']['key_file']
-key
file to use asssl_certificate_key
.
node['modcloth_hubot']['redis']['enabled']
- whether or not to include redis, such as when the redis Hubot brain is used.node['modcloth_hubot']['redis']['packages']
- the platform-dependant packages to install in order to get redis running
node['modcloth_hubot']['install_git']
- includes thegit::default
recipenode['modcloth_hubot']['install_nodejs']
- includes thenodejs::default
recipe
The following attributes allow injection of custom templates via wrapper cookbooks:
node['modcloth_hubot']['upstart_conf_template_file']
node['modcloth_hubot']['upstart_conf_cookbook']
node['modcloth_hubot']['etc_default_hubot_template_file']
node['modcloth_hubot']['etc_default_hubot_cookbook']
node['modcloth_hubot']['bash_profile_template_file']
node['modcloth_hubot']['bash_profile_template_cookbook']
node['modcloth_hubot']['bashrc_template_file']
node['modcloth_hubot']['bashrc_template_cookbook']
node['modcloth_hubot']['ssh_wrapper_template_file']
node['modcloth_hubot']['ssh_wrapper_template_cookbook']
node['modcloth_hubot']['runner_template_file']
node['modcloth_hubot']['runner_template_cookbook']
node['modcloth_hubot']['nginx']['site_template_file']
node['modcloth_hubot']['nginx']['site_template_cookbook']
node['modcloth_hubot']['nginx']['auth_basic']['user_file_template']
node['modcloth_hubot']['nginx']['auth_basic']['user_file_cookbook']
Include recipe[modcloth-hubot]
in your run_list
. Set some attributes however you prefer so that at least the
following is present:
node['modcloth_hubot']['repo']
If the repository includes a .env
file at the top level that contains whatever environmental variables are needed by
your Hubot instance, no further configuration is necessary. Alternatively, environmental variables may be injected into
the instance environment via the modcloth_hubot.environment
attribute, e.g.:
default_attributes(
'modcloth_hubot' => {
'environment' => {
'HUBOT_CAMPFIRE_ACCOUNT' => 'foobar',
'HUBOT_CAMPFIRE_TOKEN' => 'abcdefabcdefabcdefabcdefabcdefabcdef',
'HUBOT_CAMPFIRE_ROOMS' => '123,456',
}
}
)
If you'd like your Hubot to live behind nginx with some niceties like SSL and basic auth, you might configure
your modcloth_hubot.nginx.*
attributes like so:
default_attributes(
'modcloth_hubot' => {
# ...
'nginx' => {
'auth_basic' => {
'enabled' => true,
'users' => {
'foo' => '{SSHA}eYiG23Clo7VBTNz3GSO5VarX5exrUnNiSFVzOXRDd1N0SG94VjdxZENUK00wOGFNV2J2MA==',
'less-paranoid' => 'aoeu'
}
},
'ssl' => {
'enabled' => true,
'crt_file' => '/etc/nginx/ssl/wildcard.example.com.crt',
'key_file' => '/etc/nginx/ssl/wildcard.example.com.key'
}
}
}
)