4 This cookbook sets up a Jenkins service.
8 - [Requirements](#requirements)
9 - [platforms](#platforms)
10 - [packages](#packages)
11 - [Attributes](#attributes)
14 - [jenkins-grid::default](#jenkins-griddefault)
15 - [jenkins-grid::docker-compose](#jenkins-griddocker-compose)
16 - [Role Examples](#role-examples)
17 - [SSL server keys and certificates management by ssl_cert cookbook](#ssl-server-keys-and-certificates-management-by-ssl_cert-cookbook)
18 - [License and Authors](#license-and-authors)
33 |Key|Type|Description, example|Default|
35 |`['jenkins-grid']['with_ssl_cert_cookbook']`|Boolean|If this attribute is true, `node['jenkins-grid']['docker-compose']['config']` are are overridden by the following `common_name` attributes.|`false`|
36 |`['jenkins-grid']['ssl_cert']['common_name']`|String|Jenkins server common name for TLS|`node['fqdn']`|
37 |`['jenkins-grid']['num_executors']`|Integer|Number of executors.|`2`|
38 |`['jenkins-grid']['log.properties']`|Hash|java.util.logging configurations.|See `attributes/default.rb`|
39 |`['jenkins-grid']['docker-compose']['app_dir']`|String||`"#{node['docker-grid']['compose']['app_dir']}/jenkins"`|
40 |`['jenkins-grid']['docker-compose']['jenkins_home']['path']`|String|Path string or nil (unset).|`'/var/lib/jenkins_home'`|
41 |`['jenkins-grid']['docker-compose']['jenkins_home']['owner']`|String, Integer|Jenkins owner uid (read only). |`1000`|
42 |`['jenkins-grid']['docker-compose']['config']`|Hash|`docker-compose.yml` configurations.|See `attributes/default.rb`|
48 #### jenkins-grid::default
50 This recipe does nothing.
52 #### jenkins-grid::docker-compose
54 This recipe generates a docker-compose.yml for the Jenkins CI service.
66 'recipe[jenkins-grid::docker-compose]',
77 # Version 2 docker-compose format
81 'restart' => 'always',
82 'image' => 'jenkins:latest',
90 # # set automatically, if the node['jenkins-grid']['docker-compose']['jenkins_home']['path'] is not nil.
91 # "#{node['jenkins-grid']['docker-compose']['jenkins_home']['path']}:/var/jenkins_home",
101 - `roles/jenkins-with-ssl-cert.rb`
104 name 'jenkins-with-ssl-cert'
105 description 'Jenkins setup with ssl_cert cookbook'
108 #'recipe[ssl_cert::server_key_pairs]', # jenkins-grid <= 0.2.3
110 'recipe[jenkins-grid::docker-compose]',
115 #default_attributes()
117 jenkins_cn = 'jenkins.io.example.com'
121 'with_ssl_cert_cookbook' => true,
123 'common_name' => jenkins_cn,
125 'docker-compose' => {
127 # Version 2 docker-compose format
131 'restart' => 'always',
132 'image' => 'jenkins:latest',
142 '--httpPort=-1 --httpsPort=8083',
143 # These options will be set by the jenkins-grid::docker-compose recipe automatically.
144 #'--httpsCertificate=/var/lib/jenkins/server.crt',
145 #'--httpsPrivateKey=/var/lib/jenkins/server.key',
148 # These volumes will be set by the jenkins-grid::docker-compose recipe automatically.
150 # "#{node['jenkins-grid']['docker-compose']['jenkins_home']['path']}:/var/jenkins_home",
151 # "#{server_cert_path(node['jenkins-grid']['ssl_cert']['common_name'])}:/var/lib/jenkins/server.crt:ro",
152 # "#{node['jenkins-grid']['docker-compose']['app_dir']}/certs/server.key:/var/lib/jenkins/server.key:ro",
167 ### SSL server keys and certificates management by `ssl_cert` cookbook
169 - create vault items.
172 $ ruby -rjson -e 'puts JSON.generate({"private" => File.read("jenkins.io.example.com.prod.key")})' \
173 > > ~/tmp/jenkins.io.example.com.prod.key.json
175 $ ruby -rjson -e 'puts JSON.generate({"public" => File.read("jenkins.io.example.com.prod.crt")})' \
176 > > ~/tmp/jenkins.io.example.com.prod.crt.json
180 $ knife vault create ssl_server_keys jenkins.io.example.com.prod \
181 > --json ~/tmp/jenkins.io.example.com.prod.key.json
183 $ knife vault create ssl_server_certs jenkins.io.example.com.prod \
184 > --json ~/tmp/jenkins.io.example.com.prod.crt.json
187 - grant reference permission to the Jenkins host
190 $ knife vault update ssl_server_keys jenkins.io.example.com.prod -S 'name:jenkins-host.example.com'
191 $ knife vault update ssl_server_certs jenkins.io.example.com.prod -S 'name:jenkins-host.example.com'
194 - modify run_list and attributes
198 #'recipe[ssl_cert::server_key_pairs]', # jenkins-grid <= 0.2.3
199 'recipe[jenkins-grid::docker-compose]',
205 'jenkins.io.example.com',
209 'with_ssl_cert_cookbook' => true,
211 'common_name' => 'jenkins.io.example.com',
218 ## License and Authors
220 - Author:: whitestar at osdn.jp
223 Copyright 2016-2017, whitestar
225 Licensed under the Apache License, Version 2.0 (the "License");
226 you may not use this file except in compliance with the License.
227 You may obtain a copy of the License at
229 http://www.apache.org/licenses/LICENSE-2.0
231 Unless required by applicable law or agreed to in writing, software
232 distributed under the License is distributed on an "AS IS" BASIS,
233 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
234 See the License for the specific language governing permissions and
235 limitations under the License.