cantino/huginn — pull request #377 by CloCkWeRX (2014-06-09 03:32:52+00:00)
Title: Refactor deployment

This should fix #373

* Use rbenv
* Fixes for Centos

I didn't overly test the development deploy.

Wiki documentation would need to be updated slightly.

```
{

"name" : "huginn_production",

"chef_type" : "role",

"json_class" : "Chef::Role",

"description" : "Huginn Production Environment",

"default_attributes" : {
"mysql": {
"server_root_password": "password",
"server_repl_password": "",
"server_debian_password": ""
},
"nginx" : {
"init_style" : "upstart"
}
},

"run_list":[
"recipe[git]",
"recipe[apt]",
"recipe[mysql::server]",
"recipe[nodejs::install_from_binary]",
"recipe[nginx]",
"recipe[ruby_build]",
"recipe[rbenv]",
"recipe[huginn::ruby]",
"recipe[huginn::user]",
"recipe[huginn::production]"
]
}
```

The roles now share most of the code for setup, with only the ```huginn::production``` and ```huginn::development``` recipes differing.

You can now pick your own attributes, like ruby version, git repo, etc:

```
default['rbenv']['ruby_version'] = "2.1.2"
default['rbenv']['plugins'] = [{
'name' => 'rbenv-sudo',
'git_url' => 'git://github.com/dcarley/rbenv-sudo.git'
}]

default['huginn']['repo'] = "https://github.com/cantino/huginn.git"
default['huginn']['branch'] = "master"
default['huginn']['rails_env'] = "production"
default['huginn']['keep_releases'] = 5
default['huginn']['user'] = "huginn"
default['huginn']['group'] = "huginn"
default['huginn']['deploy_path'] = "/home/#{node['huginn']['user']}"
default['huginn']['env']['invitation_code'] = "try-huginn-secretly"
```

Mail details still probably need refactoring.