Skip to content

Commit fbde7da

Browse files
committed
bootstrap jenkins from scratch
1 parent f0158f4 commit fbde7da

File tree

6 files changed

+61
-38
lines changed

6 files changed

+61
-38
lines changed

.chef/Vagrantfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66
# centos: vagrant box add chef/centos-7.0
77
Vagrant.configure("2") do |config|
88
config.vm.box = "utopic-daily"
9-
config.vm.provision :chef_solo do |chef|
10-
chef.cookbooks_path = ["~/git/cookbooks"]
9+
config.vm.provision :chef_zero do |chef|
10+
chef.cookbooks_path = "~/git/cookbooks"
11+
# after a long struggle tring to get chef-zero/solo to work with chef-vault, dumped the databags in plain text from admin account using:
12+
# for item in $(knife data bag show master); do knife vault show --format json master $item > .chef/data_bags/master/$item.json; done
13+
chef.data_bags_path = "data_bags"
1114
chef.node_name = "jenkins-master"
15+
# TODO: chef.encrypted_data_bag_secret_key_path
1216
chef.add_recipe("scala-jenkins-infra::master-init")
13-
chef.add_recipe("scala-jenkins-infra::_master-config-proxy")
17+
chef.add_recipe("scala-jenkins-infra::master-config")
1418
end
1519
config.vm.network "public_network"
1620
config.vm.provider "virtualbox" do |v|

README.md

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -178,29 +178,31 @@ hub clone scala/scala-jenkins-infra
178178
cd scala-jenkins-infra
179179
ln -sh ~/git/cookbooks $PWD/.chef/
180180
181-
knife site install cron
182-
knife site install logrotate
183-
knife site install chef_handler
184-
knife site install windows
185-
knife site install chef-client
186-
knife site install aws
187-
knife site install delayed_evaluator
188-
knife site install ebs
189-
knife site install apt
190-
knife site install packagecloud
191-
knife site install runit
192-
knife site install yum
193-
knife site install 7-zip
194-
knife site install ark
195-
knife site install artifactory
196-
knife site install build-essential
197-
knife site install dmg
198-
knife site install yum-epel
199-
knife site install git
200-
knife site install user
201-
knife site install partial_search
202-
knife site install ssh_known_hosts
203-
knife site install git_user
181+
knife cookbook site install cron
182+
knife cookbook site install logrotate
183+
knife cookbook site install chef_handler
184+
knife cookbook site install windows
185+
knife cookbook site install chef-client
186+
knife cookbook site install aws
187+
knife cookbook site install delayed_evaluator
188+
knife cookbook site install ebs
189+
knife cookbook site install apt
190+
knife cookbook site install packagecloud
191+
knife cookbook site install runit
192+
knife cookbook site install yum
193+
knife cookbook site install 7-zip
194+
knife cookbook site install ark
195+
knife cookbook site install artifactory
196+
knife cookbook site install build-essential
197+
knife cookbook site install dmg
198+
knife cookbook site install yum-epel
199+
knife cookbook site install git
200+
knife cookbook site install user
201+
knife cookbook site install partial_search
202+
knife cookbook site install ssh_known_hosts
203+
knife cookbook site install git_user
204+
205+
knife cookbook site install chef-vault
204206
```
205207

206208
### Current cookbooks

attributes/master.rb

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,26 @@
1818
override['jenkins']['master']['listen_address'] = '127.0.0.1' # external traffic must go through nginx
1919
override['jenkins']['master']['user'] = 'jenkins'
2020
override['jenkins']['master']['group'] = 'jenkins'
21-
# WARNING: Caught exception evaluating: request.getParameter('q') in /updateCenter/byId/default/postBack. Reason: java.lang.IllegalStateException: Form too large 870330>500000
22-
23-
override['jenkins']['master']['jvm_options'] = '-server -Xmx4G -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -Dorg.eclipse.jetty.server.Request.maxFormContentSize=1000000' #
21+
22+
# NOTES on override['jenkins']['master']['jvm_options']:
23+
# - org.eclipse.jetty.server.Request.maxFormContentSize is to fix:
24+
# WARNING: Caught exception evaluating: request.getParameter('q') in /updateCenter/byId/default/postBack. Reason: java.lang.IllegalStateException: Form too large 870330>500000
25+
26+
# - hudson.model.User.allowNonExistentUserToLogin resolves issue with installing plugins
27+
# on bootstrapping jenkins (https://github.com/jenkinsci/jenkins/commit/80e9f3f50c3425c9b9b2bfdb58b03a1f1bd10aa3)
28+
# more of the stacktrace:
29+
# java.io.EOFException
30+
# at java.io.DataInputStream.readBoolean(DataInputStream.java:244)
31+
# before that: # ================================================================================
32+
# Error executing action `install` on resource 'jenkins_plugin[notification]'
33+
# ================================================================================
34+
#
35+
# Mixlib::ShellOut::ShellCommandFailed
36+
# ------------------------------------
37+
# Expected process to exit with [0], but received '255'
38+
# ---- Begin output of "/usr/lib/jvm/java-7-openjdk-amd64/bin/java" -jar "/var/chef/cache/jenkins-cli.jar" -s http://localhost:8080 -i "/var/chef/cache/jenkins-key" install-plugin /var/chef/cache/notification-latest.plugin -name notification ----
39+
40+
override['jenkins']['master']['jvm_options'] = '-server -Xmx4G -XX:MaxPermSize=512M -XX:+HeapDumpOnOutOfMemoryError -Dhudson.model.User.allowNonExistentUserToLogin=true -Dorg.eclipse.jetty.server.Request.maxFormContentSize=1000000' #
2441
# -Dfile.encoding=UTF-8
2542

2643
# To pin the jenkins version, must also override override['jenkins']['master']['source'] !!!

recipes/_master-config-scabot.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99

1010
include_recipe "git"
11-
include_recipe "chef-sbt"
11+
include_recipe "sbt-extras"
1212

1313
scabotHome = "/home/scabot"
1414
scabotCheckout = "/home/scabot/scabot"

recipes/_worker-config-rhel.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# All rights reserved - Do Not Redistribute
88
#
99

10+
1011
node["jenkinsHomes"].each do |jenkinsHome, workerConfig|
1112
jenkinsUser=workerConfig["jenkinsUser"]
1213

recipes/master-config.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,22 @@
3939
# doesn't support checksum
4040
end
4141

42-
# restart jenkins (TODO: wait for it to come back up, so we can continue automatically with next recipes; until then, manually)
43-
# Theory for observed failure: github-oauth plugin needs restart
44-
# next steps: add scala-jenkins-infra::master-auth-github, and scala-jenkins-infra::master-workers (once they are up) to run_list
4542
jenkins_plugin "github-oauth" do
46-
# To be sure, do safe restart (see subscribes below), since we're running chef every thirty minutes
4743
end
4844

49-
jenkins_command 'safe-restart' do
50-
action :nothing
51-
subscribes :execute, 'jenkins_plugin[github-oauth]', :delayed
52-
end
45+
# this doesn't work
46+
# jenkins_command 'safe-restart' do
47+
# action :nothing
48+
# subscribes :execute, 'jenkins_plugin[github-oauth]', :delayed
49+
# end
5350

51+
# NEED TO RESTART JENKINS BEFORE YOU CAN CONTINUE BRINGING UP JENKINS THE FIRST TIME
5452
include_recipe 'scala-jenkins-infra::_master-config-auth-github'
5553

5654
include_recipe 'scala-jenkins-infra::_master-config-jobs'
5755

5856
include_recipe 'scala-jenkins-infra::_master-config-workers'
5957

58+
# NEEDS /usr/local/sbt
6059
include_recipe 'scala-jenkins-infra::_master-config-scabot'
6160

0 commit comments

Comments
 (0)