Code Monkey home page Code Monkey logo

go-cookbook's Introduction

GoCD Cookbook

This cookbook is no longer maintained. Please log a GitHub issue if you're looking to maintain it.

This cookbook is here to help you setup GoCD servers and agents in an automated way.

Scope

  • This cookbook can be used for installing and configuring a GoCD server and multiple GoCD agents.
  • On linux machines, the recipes used for installing the GoCD server and agents use the yum and apt repositories to install from. Zip installations are not supported.

Requirements

  • chef >= 12.6

Certain resource properties are broken in Chef 13. Check the deprecations in the changelog for more details.

Dependencies

  • apt
  • java
  • yum
  • windows (requires chef >= 12.6; for chef < 12.6 please use these additional dependency version constraints for compatibility with Chef 11: cookbook 'windows', '< 2.0')

Supported Platforms

This cookbook has been tested on the following platforms:

  • Ubuntu >= 12.04
  • Debian
  • CentOS >= 6
  • RedHat >= 6
  • Windows - no support yet, but PRs welcome :)

Usage

  1. Add this cookbook to your Chef Server, either by installing with knife or by adding it to your Berksfile: cookbook 'gocd', '~>1.3.2'

  2. Change the default configuration [attributes](# Go Server attributes) by overriding the node attributes:

  • via a role, or
  • by declaring it in another cookbook at a higher precedence levels
  1. Run the recipes on the specific nodes as:
  • chef-client --runlist 'recipe[gocd]' - This will install the GoCD server and agent on the same machine
  • chef-client --runlist 'recipe[gocd::server]' - This will install the GoCD server with specified configuration
  • chef-client --runlist 'recipe[gocd::agent]' - This will install the GoCD agent with specified configuration.

OR

Associate the recipes with the desired roles. Here's an example role with default recipes:

  name 'demo'
  description 'Sample role for using the go-cookbook'

  default_attributes(
    'gocd' => {
      'version' => '17.3.0-4669',
      'use_experimental' => true
    }
  )

  run_list %w(
    recipe[gocd]
  )

1.0 release notes

This cookbook has undergone a major rewrite and has little to do with pre-1.0 versions. If you have been using go-cookbook previously then please note that:

  • cookbook has been renamed to gocd, just like root namespace of attributes.
  • Windows support in on best-effort basis

Java

Please note that java 8 is recommended to run Go server and agents. This cookbook sets node['java']['jdk_version'] at force_default level but it may not work properly when you include java in node run_list before gocd cookbook. The safest approach is to set java version in node attributes (in a role or environment).

Install method

Repository

By default installation source is done from apt or yum repositories from official sources at https://www.gocd.org/download/.

The apt repository can be overridden by changing any these attributes:

  • node['gocd']['repository']['apt']['uri'] = 'https://download.gocd.org/'
  • node['gocd']['repository']['apt']['components'] = [ '/' ]
  • node['gocd']['repository']['apt']['distribution'] = ''
  • node['gocd']['repository']['apt']['keyserver'] = 'pgp.mit.edu'
  • node['gocd']['repository']['apt']['key'] = 'https://download.gocd.org/GOCD-GPG-KEY.asc'

The yum repository can be overridden by changing any these attributes:

  • node['gocd']['repository']['yum']['baseurl'] = 'https://download.gocd.org'
  • node['gocd']['repository']['yum']['gpgcheck'] = true
  • node['gocd']['repository']['yum']['gpgkey'] = 'https://download.gocd.org/GOCD-GPG-KEY.asc'

Experimental channel

By default the GoCD cookbook installs latest stable version. You can install gocd from the experimental channel by setting the node['gocd']['use_experimental'] attribute to true

From remote file

The cookbook can skip adding a package repository and instead install a GoCD server or agent by downloading a remote file and installing it directly via dpkg or rpm. To use this method, set node['gocd']['install_method'] to 'package_file' and set node['gocd']['package_file']['baseurl'] to point to the remote file (e.g. 'http://my/custom/url')

The final download URL of file is built based on platform and node['gocd']['version'] (e.g. using the example baseurl above, http://my/custom/url/go-agent-15.2.0-2520.deb)

GoCD Server

gocd::server will install and start a GoCD server.

Go Server attributes

The cookbook provides the following attributes to configure the GoCD server:

  • node['gocd']['server']['http_port'] - The server HTTP port. Defaults to 8153.
  • node['gocd']['server']['https_port'] - The server HTTPS port. Defaults to 8154.
  • node['gocd']['server']['max_mem'] - The server maximum JVM heap space. Defaults to 2048m.
  • node['gocd']['server']['min_mem'] - The server mimimum JVM heap space. Defaults to 1024m.
  • node['gocd']['server']['max_perm_gen'] - The server maximum JVM permgen space. Defaults to 400m.
  • node['gocd']['server']['work_dir'] - The server working directory. Defaults to /var/lib/go-server on linux, C:\GoServer on Windows.

Chef cookbook waits for the server to become responsive after restarting the service. These attributes can be used to tune it:

  • node['gocd']['server']['wait_up']['retry_delay'] - pause in seconds between failed attempts.
  • node['gocd']['server']['wait_up']['retries'] - number of attempts before giving up. Set 0 to disable waiting at all. Defaults to 10

GoCD Agent

gocd::agent will install and start a GoCD agent. You can change the number of agents in node['gocd']['agent']['count']. The first agent is called go-agent, next ones are go-agent-#.

gocd::agent recipe uses the GoCD agent LWRP internally.

Go Agent attributes

The cookbook provides the following attributes to configure the GoCD agent:

  • node['gocd']['agent']['go_server_url'] - URL of Go server that agent should connect to. It must start with https:// and end with /go. For example https://localhost:8154/go.
  • node['gocd']['agent']['daemon'] - Whether the agent should be daemonized. Defaults to true.
  • node['gocd']['agent']['vnc']['enabled'] - Whether the agent should start with VNC. (Uses DISPLAY=:3). Defaults to false.
  • node['gocd']['agent']['autoregister']['key'] - The agent autoregister key. If left alone, will be auto-detected. Defaults to nil.
  • node['gocd']['agent']['autoregister']['environments'] - The environments for the agent. Defaults to [].
  • node['gocd']['agent']['autoregister']['resources'] - The resources for the agent. Defaults to [].
  • node['gocd']['agent']['autoregister']['hostname'] - The agent autoregister hostname. Defaults to node['fqdn'].
  • node['gocd']['agent']['server_search_query'] - The chef search query to find a server node. Defaults to chef_environment:#{node.chef_environment} AND recipes:gocd\\:\\:server.

Custom Resources

  1. gocd_agent
  • Actions:

    • :create
    • :delete
  • Attributes:

Attribute Name Default Description
agent_name create Name of the resource to be created or deleted.
service_action enable, start The GoCD agent service supports :status, :enable, :start, :restart, :stop
user go The user that can start and configure the GoCD agents.
group go The group of users that can configure the GoCD agents.
go_server_url nil The url of the GoCD server that the agent has to connect to. It should begin with https, should connect to the GO_SERVER_SSL_PORT, and end with /go. If this isn't set, then the go server ip is detected (provided go server is also installed using chef). The fallback option is https://localhost:8154/go
daemon true Whether to start the GoCD agent as a daemon process.
autoregister_key nil The autoregister key can be used to directly register the agent with the GoCD server without manual intervention.
autoregister_hostname nil The name by which the agent will be known to the GoCD server
autoregister_environments nil The GoCD environments to which the agent must belong to.
environments nil The GoCD environments to which the agent must belong to. This is DEPRECATED.
autoregister_resources nil The resources available on the gocd agent node which can be used with specific pipeline(s).
resources nil The resources available on the gocd agent node which can be used with specific pipeline(s). This is DEPRECATED.
elastic_agent_id nil The elastic agent id used to set the autoregister property agent.auto.register.elasticAgent.agentId.
elastic_agent_plugin_id nil The elastic agent plugin id. This is used to set the autoregister property agent.auto.register.elasticAgent.pluginId

Note: All of the above attributes are optional.

  1. gocd_agent_autoregister_file

This resource will create a file called autoregister.properties in the gocd agent's config directory. This is done so that the agent can directly register with the gocd server without manual intervention.

  • Actions

    • :create
    • :delete
  • Attributes

Attribute Name Default Description
owner go owner of the autoregister.properties file
group go group for the autoregister.properties file
autoregister_key nil The autogregister key from the go server config that can be used to register the agent
autoregister_hostname nil The name by which the agent will be known to the GoCD server
autoregister_environments nil The GoCD environments to which the agent must belong to.
environments nil The GoCD environments to which the agent must belong to. This is DEPRECATED.
autoregister_resources nil The resources available on the gocd agent node which can be used with specific pipeline(s).
resources nil The resources available on the gocd agent node which can be used with specific pipeline(s). This is DEPRECATED.
elastic_agent_id nil The elastic agent id used to set the autoregister property agent.auto.register.elasticAgent.agentId.
elastic_agent_plugin_id nil The elastic agent plugin id. This is used to set the autoregister property agent.auto.register.elasticAgent.pluginId
  1. gocd_plugin
Attribute Name Default Required Description
plugin_name nil true Name of the plugin
plugin_uri nil true Location of the plugin jar on the workstation.
server_work_dir /var/lib/go-server false The working directory of the go server to where the plguin jar needs to be copied to.

Beta

Attributes for elastic agents:

  • node['gocd']['agent']['elastic']['plugin_id'] - The elastic agent plugin id. This is used to set the autoregister property agent.auto.register.elasticAgent.pluginId
  • node['gocd']['agent']['elastic']['agent_id'] - The elastic agent id used to set the autoregister property agent.auto.register.elasticAgent.agentId.

Deprecated

Please use node['gocd']['agent']['go_server_url'] instead of the following deprecated attributes:

  • node['gocd']['agent']['go_server_host'] - The hostname of the go server (if left alone, will be auto-detected). Defaults to nil.
  • node['gocd']['agent']['go_server_port'] - The port of the go server. Defaults to 8153.

GoCD Agent LWRP (currently only works on linux)

If the agent recipe + attributes is not flexible enough or if you prefer chef resources then you can add go-agent services with the gocd_agent LWRP.

Example agents

All resource attributes fall back to node attributes so agent can be defined in just one line:

gocd_agent 'my-agent'

It would create my-agent service and if all node values are correct then it would also autoregister.

A custom agent may look like this:

gocd_agent 'my-go-agent' do
  go_server_host 'go.example.com'
  go_server_port 80
  daemon true
  vnc    true
  autoregister_key 'bla-key'
  autoregister_hostname 'my-lwrp-agent'
  autoregister_environments 'production'
  autoregister_resources     ['java-8','ruby-2.2']
  workspace     '/mnt/big_drive'
end

GoCD autoregister file resource

If you want to set up agents your-way then this resource is helpful to only generate a valid autoregister.properties file:

Example use:

gocd_agent_autoregister_file '/var/mygo/autoregister.properties' do
  autoregister_key 'bla-key'
  autoregister_hostname 'mygo-agent'
  autoregister_environments 'stage'
  autoregister_resources     ['java-8','ruby']
end

Can be used to prepare elastic agents too:

gocd_agent_autoregister_file '/var/elastic/autoregister.properties' do
  autoregister_key 'some-key'
  autoregister_hostname 'elastic-agent'
  autoregister_environments 'testing'
  autoregister_resources     ['java-8']
  elastic_agent_id 'agent-id'
  elastic_agent_plugin_id 'elastic-agent-plugin-id'
end

GoCD plugin LWRP

You can install Go server plugins with the gocd_plugin LWRP like this

include_recipe 'gocd::server'

gocd_plugin 'github-pr-status' do
  plugin_uri 'https://github.com/gocd-contrib/gocd-build-status-notifier/releases/download/1.1/github-pr-status-1.1.jar'
end

Server Specification

When using the cookbook please refer to the server specification section of the GoCD documentation.

License

Apache License, Version 2.0

go-cookbook's People

Contributors

academy-jtran avatar arvindsv avatar ashmere avatar barrowkwan avatar brettcave avatar chriskozak avatar codechaotic avatar donaldguy avatar dustinvanbuskirk avatar eugeneromero avatar heathsnow avatar jblaine avatar justinredd avatar kemra102 avatar ketan avatar kimtore avatar linusruth avatar mjuszczak avatar pdunnavant avatar scottmuc avatar seanedwards avatar sneal avatar swade1987 avatar tomzo avatar tpbrown avatar varshavaradarajan avatar watsonlu avatar webframp avatar willejs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-cookbook's Issues

Update template notification settings and add a way to install plugins

Suggestions:

  1. Change :immediately to :delayed
template "/etc/default/go-server" do
  source   "go-server-default.erb"
  mode     "0644"
  owner    "root"
  group    "root"
  notifies :restart, "service[go-server]", :immediately
end
  1. Add something along the lines of this:

Where plugins is a hash map:

"github-pr-status": "https://github.com/gocd-contrib/gocd-build-status-notifier/releases/download/1.1/github-pr-status-1.1.jar"

node['gocd']['server']['plugins'].each do |pluginName, pluginURI|
  remote_file "#{node['gocd']['server']['work_dir']}/plugins/external/#{pluginName}.jar" do
    source pluginURI
    owner 'go'
    group 'go'
    mode 0770
    retries 5
    notifies :restart, 'service[go-server]', :delayed
  end
end

URL for Windows agent download (possibly server too) gets resolved wrong

What I did:
Included the gocd::agent recipe in my wrapper cookbook, with no overridden attributes:

include_recipe 'gocd::agent'

Then, ran a Windows 2012 R2 Kitchen suite to test agent install.

What I expected to happen:
Gocd cookbook downloads the correct gocd agent package and installs it.

What actually happened:
The remote_file[go-agent-latest-setup.exe] resource in gocd::agent_windows_install fails with a 404:

Recipe: gocd::agent_windows_install
  * remote_file[go-agent-latest-setup.exe] action create[2017-07-05T21:40:19+00:00] WARN:
    remote_file[go-agent-latest-setup.exe] cannot be downloaded from
    https://download.gocd.org/binaries/17.7.0-5147/win/go-agent-17.7.0-5147-setup.exe:
    404 "Not Found"

Cause:
The URL for the Windows agent is wrong. Going to the GoCD download page, you can see the correct address is https://download.gocd.org/binaries/17.7.0-5147/win/go-agent-17.7.0-5147-jre-64bit-setup.exe (notice the -jre-64bit in the file name, there is also a 32bit version).

Looking at the recipe, I see a source property, which uses the go_agent_package_url helper.

This helper in turn, uses the go_agent_remote_package_name helper. I believe this is the helper that needs to be modified to properly set the correct package names for Windows.

I would imagine this also happens with the GoCD server package, but have not tested it.

Possible Solution:
By means of Ohai, check if Windows is 32 or 64 bit, and create the Windows download URL as needed.

Versioning of Cookbook

More a comment than a issue.

When releasing new versions of the cookbook it would be nice if you could provide a mechanism to resolve older cookbook versions.

The release pushed to master today broke all our server provisioning because of the change for the apt-repo and version 13 is not available at the new loation

Chef supermarket metadata

Seems that cookbook in Supermarket missing maintainer and email, but version is the same.
Please push stable build to supermarket! thx.

ERROR: cookbooks failed to write: HTTP error writing: 400 "Bad Request" cause: {"error":["Field 'metadata.maintainer_email' invalid"]}
ERROR: cookbooks failed to write: HTTP error writing: 400 "Bad Request" cause: {"error":["Field 'metadata.maintainer' invalid"]}

"maintainer":null,"maintainer_email":null,

Issue with apt repository + binary.com

It seems that a recent 301 redirect for the debian repository broke the server package installation. Ended up having to resolve with something like this to force the bintray.com URL. Anyone else experiencing this? If so, I can resolve and open a PR.

chef_gem 'chef-rewind'
require 'chef/rewind'

rewind 'apt_repository[thoughtworks]' do
  uri 'http://dl.bintray.com/gocd/gocd-deb/'
  key 'https://bintray.com/user/downloadSubjectPublicKey?username=gocd'
  only_if { node['platform_family'] == 'debian' }
end

Broken with Chef 13

with this error

Property resources of resource gocd_agent overwrites an existing method.

(Local) Agent autoregistering with specified environment

Hi,

When I use the LWRP the creation of local Go agents, the environments parameter doesn't seem to do anything.

By local, I mean on the same machine as the Go CD Server.

Here's an example of my LWRP implementation:

for i in 0..(node['wrapper_gocd']['agents'] -1)
  name = "go-agent-#{i}"
  gocd_agent name do
    go_server_host 'localhost'
    go_server_port 8153
    daemon true
    vnc    true
    autoregister_key
    autoregister_hostname name
    environments "Alpha"
  end
end

I've tried a few different inputs besides a string, such as an array, or referencing an attribute like #{node['wrapper_gocd']['go_env']}.

I haven't tried with remote agents, but I don't see any issues raised for that, so could this be an issue exclusive to remote agent creation or am I missing something (most likely)?

Thanks,
Raid

Windows Go Agent Install Path problem

In the recipe agent_windows, the following 'opts' is specified in the following way:

opts = ""
opts << "/SERVERIP=#{server_ip}" if node['go']['agent']['server_host']
opts << "/D=#{install_path}" if node['go']['agent']['install_path']

The problem is, if both the ['go']['agent']['server_host'] and ['go']['agent']['install_path'] are specified, the /D option gets mangled because there is no space between the two options.

Support installation from other sources

Currently source of Go installation is hard-coded to official thoughtworks repository.

It could be possible to install from alternative repository (e.g. mirror) or from raw package files.

Question: apt-get install error

I am encountering some issues today with or chef provisioning running, when apt-get install is run it is failing with the following error. I have tried various versions and it is always the same.

Google doesn't really tell me much either, have ruled out our local proxy and apt mirror.

Anybody else seen this? Maybe it is aptitude is having one of its tantrums and I should try again tomorrow?

Failed to fetch http://dl.bintray.com/gocd/gocd-deb/go-agent-14.3.0-1186.deb  Got a single header line over 360 chars
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Redundant init.d file for golang go-agent

Installing golang Go-agent from Debian package provides /etc/init.d/gocd-golang-agent file. Gocd cookbook also provides init.d file for golang go-agent. When using Gocd cookbook and 2 golang Go-agents, there are such files available after provisioning:

  • /etc/init.d/gocd-golang-agent
  • /etc/init.d/go-agent
  • /etc/init.d/go-agent-1

and /etc/init.d/gocd-golang-agent is redundant.

This issue is well resolved for java Go-agents: Go-agent Debian package provides /etc/init.d/go-agent file and then Gocd cookbook does this: https://github.com/gocd-contrib/go-cookbook/blob/bf4cfe2e1a5d870af0e6f26c11b249fbc8fd89c3/resources/agent.rb#L68 . I suggest the same way for golang Go-agents.

Improve windows support

  1. Definitely add LWRP code for installing windows agents.
  2. There might be an issue about server service not being installed/enabled in chef run. So it would be nice to test if service is running after reboot.

Chef search for server node has syntax errors

The attribute default['go']['agent']['server_search_query'] throws Net::HTTPServerException: 400 "Bad Request", it contains syntax errors.

The query should be corrected to "chef_environment:#{node.chef_environment} AND recipes:go\\:\\:server".

Server is only started when the package is installed

The service definition for the server has actions :enable and :nothing

This is notified by the package resource, which means that the server is started when the package is installed, but never again. It is configured to start on boot, but if the server goes down or is stopped manually, chef-client runs will never bring it up again.

Install latest version of Go by default

Rather than hard-coding the Go version in the cookbook, have it query the apt/yum repo and install whatever is latest by default.

Allow users to specify a specific version via attribute.

No GPG key for the Apt repo

The apt repo appears to be signed but the recipe to set up the repo doesn't add a key. I can't seem to find where to retrieve the key for it to allow me to fix & PR. For yum it looks like you are disabling the gpgcheck...

As a result every time apt updates its package repos I get the expected error:

W: GPG error: http://dl.bintray.com Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 9149B0A6173454C7

Error executing action `enable` on resource 'windows_service[Go Server]'

Running a go cookbook on windows server 2012R2, throws this exception below:

Recipe: gocd::server

      ================================================================================
      Error executing action `enable` on resource 'windows_service[Go Server]'
      ================================================================================

      SystemCallError
      ---------------
      The specified service does not exist as an installed service. - OpenService: The specified service does not exist as an installed service.

      Resource Declaration:
      ---------------------
      # In C:\Users\vagrant\AppData\Local\Temp\kitchen\cookbooks\gocd\recipes\server.rb

        8: service (platform?('windows') ? 'Go Server' : 'go-server') do
        9:   supports :status => true, :restart => true, :start => true, :stop => true
       10:   action [:enable, :start]
       11:   if node['gocd']['server']['wait_up']['retries'] != 0
       12:     notifies :get, 'http_request[verify_go-server_comes_up]', :immediately
       13:   end
       14: end

      Compiled Resource:
      ------------------
      # Declared in C:\Users\vagrant\AppData\Local\Temp\kitchen\cookbooks\gocd\recipes\server.rb:8:in `from_file'

      windows_service("Go Server") do
        action [:enable, :start]
        supports {:status=>true, :restart=>true, :start=>true, :stop=>true}
        retries 0
        retry_delay 2
        default_guard_interpreter :default
        service_name "Go Server"
        pattern "Go Server"
        startup_type :automatic
        declared_type :service
        cookbook_name :gocd
        recipe_name "server"
      end


  Running handlers:
  [2016-03-17T06:56:47-07:00] ERROR: Running exception handlers
  Running handlers complete
  [2016-03-17T06:56:47-07:00] ERROR: Exception handlers complete
  Chef Client failed. 0 resources updated in 24 seconds
  [2016-03-17T06:56:47-07:00] FATAL: Stacktrace dumped to C:/Users/vagrant/AppData/Local/Temp/kitchen/cache/chef-stacktrace.out
  [2016-03-17T06:56:47-07:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
  [2016-03-17T06:56:47-07:00] FATAL: SystemCallError: windows_service[Go Server] (gocd::server line :sunglasses: had an error: SystemCallError: The specified service does not exist as an installed service. - OpenService: The specified service does not exist as an installed service.

Will a Rubocop PR get merged if created?

I would like to do a rubocop PR but I don't want to waste my time if it isn't going to get merged. I don't know the proper place for this request so I'm just creating an issue :P Let me know in the comments please.

Thx

P.S. - follow up PRs can then start to have tests (tailor, rubocop, foodcritic) and I think rubocop is a low barrier to entry for the tests. Thoughts?

make agent autoregister properties into separate resource

I often find myself copy-pasting parts of this cookbook to fit specific end use cases.

I think many users would benefit if we provided gocd_autoregister resource. It would render the template to user-specified path.
It might be especially useful in customized installation scenarios when user is not interested in using our/official install packages. But he might still want some helper to get all registration properties in proper format to proper file.

Additional agents don't get started on boot

go-agents setup with LWRP are created like here

The extra init.d scripts are created as symlinks /etc/init.d/go-agent-1 -> /etc/init.d/go-agent

The service is not enabled in /etc/rc2.d/ and trying to enable will fail:

sudo insserv /etc/init.d/go-agent-1
insserv: script go-agent-1: service go-agent already provided!
insserv: exiting now!

Reason is that go-agent is provided now by every go-agent-* instance.

# Provides: go-agent
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Start the Go Agent
### END INIT INFO

When copied cp /etc/init.d/go-agent /etc/init.d/go-agent-1 and replaced Provides: go-agent with Provides: go-agent-1 then it works.

Probably cookbook should do copy and then replace service name instead of just creating links.

go_agent LWRP

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:

  • It would need at least 2 implementations of provider - windows and linux. Probably one per platform_family
  • go-agents have native support for multiple agents on same host

missing maintainer and maintainer_email metadata

I can't upload this cookbook with berks upload to a new chef server.

The server responds with: {"error":["Field 'metadata.maintainer' invalid"]}

This is an issue currently affecting many community cookbooks at present.

Please add maintainer and maintainer_email entries to metadata.rb to resolve this issue.

Maintenace and cleanup

I have marked a few points which could be improved 867088c
Issues I am planning to fix:

  • test compatibility with chef 11 and 12
  • attempt to make node['go']['version'] = 'stable' by default (#26). Is there an URL that would return what is stable currently?
  • refactor and document the backup and restore functionality which apparently works, but has no tests or readme
  • add more detailed integration tests (test auto-registration of agents in particular that they are added and enabled)
  • add chefspec tests
  • extend readme on how to use the cookbook on various platforms
  • I'd also like to assume that chefdk is now the primary development toolset
  • setup snap-ci to run stylechecks, chefspec and kitchen integration tests in docker (as @ketan already did). If this will not be possible in long-term then I will be running integration tests on openstack locally.

I think it would also be nice to have LWRP for go agents. I will describe in separate issue.
I'd also like to split recipes into just installing Go packages and actually managing services. Default would be still to do both.
Probably I will write more tests before I add or refactor anything so that I will see if I break anything.

I will not do this all at once, but in time I should cover all of it.

Recommended server setup?

What is the recommended way to setup GoCD server and agents? It seems like the agent cookbook here sets up 16? agents by default, which seems like a fair amount for a typical server. Should agents and server run on the same box, or seperate boxes.

For context, we're setting this up on an Openstack cloud, with 4 CPU, 8-GB RAM VMs as standard. Would it be best to have 1 VM for the server and 2-4 VMs for the agents, or would it make sense to install them all on the same VM. And how many agents per CPU?

Allow static definition of server in agent config

This cookbook appears to assume that there would be only one Go server. If more than one server is found in the search, then it uses the first one found. If I want to allocate a go cd cluster per team, this would be problematic.

Perhaps provide an attribute called node['gocd']['server'] and set to nil, consequently allowing users to set this value. If they don't, then have logic that falls back on existing search logic.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.