Giter VIP home page Giter VIP logo

go-cookbook's Introduction

GoCD Cookbook

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

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 :)

1.0 release notes

This cookbook has gone 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 has been dropped temporarily

Java

Please note that java (>= 7) is needed 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 http://www.go.cd/download/.

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

default['gocd']['repository']['apt']['uri'] = 'https://download.go.cd/'
default['gocd']['repository']['apt']['components'] = [ '/' ]
default['gocd']['repository']['apt']['distribution'] = ''
default['gocd']['repository']['apt']['package_options'] = ''
default['gocd']['repository']['apt']['keyserver'] = 'pgp.mit.edu'
default['gocd']['repository']['apt']['key'] = '0xd8843f288816c449'

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

default['gocd']['repository']['yum']['baseurl'] = 'https://download.go.cd'
default['gocd']['repository']['yum']['gpgcheck'] = true
default['gocd']['repository']['yum']['gpgkey'] = 'https://download.go.cd/GOCD-GPG-KEY.asc'

From remote file

Cookbook can skip adding repository and install Go server or agent by downloading a remote file and install it directly via dpkg or rpm.

Change install method to 'package_file':

node['gocd']['install_method'] = 'package_file'

And assign base url where packages are available for download

node['gocd']['package_file']['baseurl'] = 'http://my/custom/url'

The final download URL of file is built based on platform and node['gocd']['version']. E.g. 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.

Chef cookbook waits for server to become responsive after restarting 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'] - first agent is called go-agent, next ones are go-agent-#.

gocd::agent recipe uses GoCD agent LWRP internally.

Go Agent attributes

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

  • 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.
  • 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.

GoCD Agent LWRP (currently only works on linux)

If agent recipe + attributes is not flexible enough or if you prefer chef resources then you can add go-agent services with 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'
  environments 'production'
  resources     ['java-8','ruby-2.2']
  workspace     '/mnt/big_drive'
end

GoCD plugin LWRP

You can install Go server plugins with 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

License

Apache License, Version 2.0

go-cookbook's People

Contributors

tpbrown avatar tomzo avatar scottmuc avatar ketan avatar justinredd avatar codechaotic avatar dustinvanbuskirk avatar seanedwards avatar willejs avatar brettcave avatar sneal avatar pdunnavant avatar academy-jtran avatar chriskozak avatar kimtore avatar linusruth avatar ashmere avatar mjuszczak avatar heathsnow avatar

Watchers

KWJL avatar Corey Hart avatar Ben Harris avatar  avatar James Cloos avatar  avatar Mike Urbach avatar Wei Wu avatar

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.