Skip to content
This repository has been archived by the owner on Feb 18, 2020. It is now read-only.

Commit

Permalink
parameterize waiting for server to be up
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzo committed Dec 11, 2015
1 parent f99d37a commit 27ad93a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ The cookbook provides the following attributes to configure the GoCD server:
* `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.
Expand Down
3 changes: 3 additions & 0 deletions attributes/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
default['gocd']['server']['work_dir'] = "/var/lib/go-server"

default['gocd']['server']['environments'] = {}

default['gocd']['server']['wait_up']['retry_delay'] = 10
default['gocd']['server']['wait_up']['retries'] = 10
8 changes: 5 additions & 3 deletions recipes/server_linux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
service "go-server" do
supports :status => true, :restart => true, :start => true, :stop => true
action [:enable, :start]
notifies :get, 'http_request[verify_go-server_comes_up]', :immediately
if node['gocd']['server']['wait_up']['retries'] != 0
notifies :get, 'http_request[verify_go-server_comes_up]', :immediately
end
end

http_request 'verify_go-server_comes_up' do
url "http://localhost:#{node['gocd']['server']['http_port']}/go/home"
retry_delay 10
retries 10
retry_delay node['gocd']['server']['wait_up']['retry_delay']
retries node['gocd']['server']['wait_up']['retries']
action :nothing
end

Expand Down

0 comments on commit 27ad93a

Please sign in to comment.