gocd / go-cookbook

Cookbook that installs and configures the open-source ThoughtWorks Studios GoCD product
http://www.gocd.org/
Apache License 2.0
45 stars 66 forks source link

go_agent LWRP #56

Closed tomzo closed 8 years ago

tomzo commented 8 years ago

We should have go_agent chef LWRP so that user could define new agents like this:

go_agent "agent-1" do
  user 'go'
  group 'go'
  go_server_host 'go.example.com'
  go_server_port 8153
  daemon true
  vnc false
  environments %w(qa) # array or string
  resources 'ruby-2.1' # array or string
  autoregister_key 'bla'
  autoregister_hostname 'agent-1'
  action :start # probably passthrough to service actions
  workspace '/var/lib/go-agent-1'
  # memory limits?
end

It would still be possible to configure agents using cookbook attributes. gocd::agent recipe would look more or less like:

for i in 0..(node[:gocd][:agent][:count] -1)
  go_agent "agent-#{i}" do
     autoregister_key node['gocd']['agent']['autoregister']['key']
     # ...
  end
end

Notes:

tomzo commented 8 years ago

I have implemented LWRP with good test coverage. Only linux at this point. Obviously thanks to this I also added support for multiple agents on same host.

I'd appreciate if someone tried using it.

Code: https://github.com/tomzo/go-cookbook/tree/develop CI tests: https://preview.snap-ci.com/tomzo/go-cookbook/branch/develop

tomzo commented 8 years ago

This is in master already.