@@ -178,42 +178,64 @@ hub clone scala/scala-jenkins-infra
178
178
cd scala-jenkins-infra
179
179
ln -sh ~/git/cookbooks $PWD/.chef/
180
180
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 java
190
- knife site install apt
191
- knife site install packagecloud
192
- knife site install runit
193
- knife site install yum
194
- knife site install jenkins
195
- knife site install 7-zip
196
- knife site install ark
197
- knife site install artifactory
198
- knife site install build-essential
199
- knife site install dmg
200
- knife site install yum-epel
201
- knife site install git
202
- knife site install user
203
- knife site install partial_search
204
- knife site install ssh_known_hosts
205
- knife site install git_user
206
- knife site install chef-sbt
207
- knife site install sbt-extras
208
- ```
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
206
+ ```
207
+
208
+ ### Current cookbooks
209
+ - 7-zip == 1.0.2
210
+ - apt == 2.7.0
211
+ - ark == 0.9.0
212
+ - artifactory == 0.1.1
213
+ - aws == 2.7.0
214
+ - build-essential == 2.2.3
215
+ - chef-client == 4.3.0
216
+ - chef_handler == 1.1.6
217
+ - cron == 1.6.1
218
+ - delayed_evaluator == 0.2.0
219
+ - dmg == 2.2.2
220
+ - ebs == 0.3.6
221
+ - git == 4.2.2
222
+ - git_user == 0.3.1
223
+ - logrotate == 1.9.1
224
+ - packagecloud == 0.0.17
225
+ - partial_search == 1.0.8
226
+ - runit == 1.6.0
227
+ - sbt == 0.1.0
228
+ - sbt-extras == 0.4.0
229
+ - ssh_known_hosts == 2.0.0
230
+ - user == 0.4.2
231
+ - windows == 1.36.6
232
+ - yum == 3.6.0
233
+ - yum-epel == 0.6.0
209
234
210
235
### Switch to unreleased versions from github
211
236
```
212
- //fixed: knife cookbook github install opscode-cookbooks/windows # fix nosuchmethoderror (#150)
213
- //knife cookbook github install adriaanm/jenkins/fix305 # ssl fail on windows -- fix pending: https://github.com/opscode-cookbooks/jenkins/pull/313
214
- knife cookbook github install b-dean/jenkins/http_ca_fixes # pending fix for above ^^^
215
-
216
- knife cookbook github install adriaanm/java/windows-jdk1.6 # jdk 1.6 installer barfs on re-install -- wipe its INSTALLDIR
237
+ knife cookbook github install adriaanm/jenkins/fix305 # custom fixes + https://github.com/opscode-cookbooks/jenkins/pull/313 (b-dean/jenkins/http_ca_fixes)
238
+ knife cookbook github install adriaanm/java/windows-jdk1.6 # jdk 1.6 installer barfs on re-install -- wipe its INSTALLDIR
217
239
knife cookbook github install adriaanm/chef-sbt
218
240
knife cookbook github install gildegoma/chef-sbt-extras
219
241
knife cookbook github install adriaanm/artifactory
@@ -338,19 +360,19 @@ Note that the IPs are stable by allocating elastic IPs and associating them to n
338
360
## ~ /.ssh/config
339
361
```
340
362
Host jenkins-worker-ubuntu-publish
341
- IdentityFile $PWD/.chef/config/chef .pem
363
+ IdentityFile ~/.ssh/typesafe-scala-aws-$AWS_USER .pem
342
364
User ubuntu
343
365
344
366
Host jenkins-worker-behemoth-1
345
- IdentityFile $PWD/.chef/config/chef .pem
367
+ IdentityFile ~/.ssh/typesafe-scala-aws-$AWS_USER .pem
346
368
User ec2-user
347
369
348
370
Host jenkins-worker-behemoth-2
349
- IdentityFile $PWD/.chef/config/chef .pem
371
+ IdentityFile ~/.ssh/typesafe-scala-aws-$AWS_USER .pem
350
372
User ec2-user
351
373
352
374
Host jenkins-master
353
- IdentityFile $PWD/.chef/config/chef .pem
375
+ IdentityFile ~/.ssh/typesafe-scala-aws-$AWS_USER .pem
354
376
User ec2-user
355
377
356
378
Host scabot
@@ -359,29 +381,30 @@ Host scabot
359
381
User scabot
360
382
361
383
Host jenkins-worker-windows-publish
362
- IdentityFile $PWD/.chef/config/chef .pem
384
+ IdentityFile ~/.ssh/typesafe-scala-aws-$AWS_USER .pem
363
385
User jenkins
364
386
```
365
387
366
388
367
389
# Launch instance on EC2
368
390
## Create (ssh) key pair
369
391
392
+ TODO: I don't think the name matters as long as it's used consistently, ultimately your access key and secret credentials are used by aws-cli to generate the keys etc
393
+
370
394
If your username on AWS does not match the local username on your machine, define
371
395
```
372
396
export AWS_USER="[username]"
373
397
```
374
398
399
+ Create a keypair and store locally to authenticate with instances over ssh/winrm:
375
400
```
376
401
echo $(aws ec2 create-key-pair --key-name $AWS_USER | jq .KeyMaterial) | perl -pe 's/"//g' > ~/.ssh/typesafe-scala-aws-$AWS_USER.pem
377
402
chmod 0600 ~/.ssh/typesafe-scala-aws-$AWS_USER.pem
378
403
```
379
404
380
- In ` knife.rb ` , make sure ` knife[:aws_ssh_key_id] ` points to the pem file.
381
-
382
-
383
405
## Selected AMIs
384
406
407
+ jenkins-master: ami-3b14f27f (Amazon Linux AMI 2015.03 on HVM Instance Store 64-bit for US West N. California)
385
408
amazon linux: ami-4b6f650e (Amazon Linux AMI 2014.09.1 x86_64 HVM EBS)
386
409
windows: ami-cfa5b68a (Windows_Server-2012-R2_RTM-English-64Bit-Base-2014.12.10)
387
410
ubuntu: ami-81afbcc4 (Ubuntu utopic 14.10 from https://cloud-images.ubuntu.com/locator/ec2/ for us-west-1/amd64/hvm: ebs-ssd /20141204)
@@ -396,11 +419,17 @@ NOTE:
396
419
397
420
398
421
```
399
- knife ec2 server create -N jenkins-master \
400
- --region us-west-1 --flavor t2.small -I ami-4b6f650e \
401
- -G Master --ssh-user ec2-user \
402
- --iam-profile JenkinsMaster \
403
- --identity-file $PWD/.chef/config/chef.pem \
422
+ --subnet subnet-4bb3b80d --associate-eip 54.67.111.226 \
423
+ --server-connect-attribute public_ip_address \
424
+
425
+ knife ec2 server create -N jenkins-master \
426
+ --flavor m3.large \
427
+ --region us-west-1 \
428
+ -I ami-3b14f27f \
429
+ -G Master --ssh-user ec2-user \
430
+ --iam-profile JenkinsMaster \
431
+ --security-group-ids sg-7afd2d1f \
432
+ --identity-file ~/.ssh/typesafe-scala-aws-$AWS_USER.pem \
404
433
--run-list "scala-jenkins-infra::master-init"
405
434
406
435
knife ec2 server create -N jenkins-worker-windows-publish \
@@ -412,7 +441,7 @@ knife ec2 server create -N jenkins-worker-windows-publish \
412
441
--security-group-ids sg-1dec3d78 \
413
442
--subnet subnet-4bb3b80d --associate-eip 54.183.156.89 \
414
443
--server-connect-attribute public_ip_address \
415
- --identity-file $PWD/.chef/config/chef .pem \
444
+ --identity-file ~/.ssh/typesafe-scala-aws-$AWS_USER .pem \
416
445
--run-list "scala-jenkins-infra::worker-init"
417
446
418
447
@@ -426,7 +455,7 @@ knife ec2 server create -N jenkins-worker-ubuntu-publish \
426
455
--security-group-ids sg-ecb06389 \
427
456
--subnet subnet-4bb3b80d --associate-eip 54.67.33.167 \
428
457
--server-connect-attribute public_ip_address \
429
- --identity-file $PWD/.chef/config/chef .pem \
458
+ --identity-file ~/.ssh/typesafe-scala-aws-$AWS_USER .pem \
430
459
--run-list "scala-jenkins-infra::worker-init"
431
460
432
461
echo NOTE: Make sure to first remove the ips in $behemothIp from your ~/.ssh/known_hosts. Also remove the corresponding worker from the chef server (can be only one with the same name).
@@ -441,7 +470,7 @@ do knife ec2 server create -N jenkins-worker-behemoth-$behemoth \
441
470
--security-group-ids sg-ecb06389 \
442
471
--subnet subnet-4bb3b80d --associate-eip ${behemothIp[$behemoth]} \
443
472
--server-connect-attribute public_ip_address \
444
- --identity-file $PWD/.chef/config/chef .pem \
473
+ --identity-file ~/.ssh/typesafe-scala-aws-$AWS_USER .pem \
445
474
--run-list "scala-jenkins-infra::worker-init"
446
475
done
447
476
@@ -472,30 +501,67 @@ knife vault update worker-publish gnupg --search 'name:jenkins-worker-ub
472
501
473
502
### Add run-list items that need the vault
474
503
```
475
- knife node run_list set jenkins-master " scala-jenkins-infra::master-init,scala-jenkins-infra::master-config"
504
+ knife node run_list set jenkins-master "recipe[chef-vault], scala-jenkins-infra::master-init,scala-jenkins-infra::master-config,scala-jenkins-infra::master-jenkins"
476
505
477
506
for w in jenkins-worker-windows-publish jenkins-worker-ubuntu-publish jenkins-worker-behemoth-1 jenkins-worker-behemoth-2
478
- do knife node run_list set $w "scala-jenkins-infra::worker-init,scala-jenkins-infra::worker-config"
507
+ do knife node run_list set $w "recipe[chef-vault], scala-jenkins-infra::worker-init,scala-jenkins-infra::worker-config"
479
508
done
480
509
```
481
510
482
511
### Re-run chef manually
483
512
484
513
- windows:
485
514
```
486
- PASS=$(aws ec2 get-password-data --instance-id i-f67c0a35 --priv-launch-key $PWD/.chef/config/chef .pem | jq .PasswordData | xargs echo)
515
+ PASS=$(aws ec2 get-password-data --instance-id i-f67c0a35 --priv-launch-key ~/.ssh/typesafe-scala-aws-$AWS_USER .pem | jq .PasswordData | xargs echo)
487
516
knife winrm jenkins-worker-windows-publish chef-client -m -P $PASS
488
517
```
489
518
490
- - ubuntu: ` ssh jenkins-worker-ubuntu-publish sudo chef-client `
491
- - amazon linux: ` ssh jenkins-worker-behemoth-1 ` , and then ` sudo chef-client `
519
+ - linux
520
+ ```
521
+ ssh jenkins-worker-ubuntu-publish
522
+ sudo su --login # --login needed on ubuntu to set SSL_CERT_FILE (it's done in /etc/profile.d)
523
+ chef-client
524
+ ```
492
525
493
526
### Attach eips
494
527
495
528
```
496
529
aws ec2 associate-address --allocation-id eipalloc-df0b13bd --instance-id i-94adaa5e # jenkins-master
497
530
```
498
531
532
+ # MANUAL STEPS
533
+ ## Scabot access to jenkins
534
+ The jenkins token for scabot has to be configured manually:
535
+ - get the API token from https://scala-ci.typesafe.com/user/scala-jenkins/configure
536
+ - use it create ` scabot-jenkins.json ` as follows
537
+ ```
538
+ {
539
+ "id": "scabot",
540
+ "jenkins": {
541
+ "token": "<TOKEN>"
542
+ }
543
+ }
544
+ ```
545
+ - do ` knife vault update master scabot -J scabot-jenkins.json `
546
+
547
+ # Artifactory
548
+ - Set admin password.
549
+ - create repos (TODO: automate)
550
+ - Create scala-ci user that can push to scala-release-temp and scala-pr-validation-snapshots,
551
+ - coordinate scala-ci credentials with jenkins via
552
+ ```
553
+ knife vault update worker-publish private-repo -J private-repo.json
554
+ ```
555
+
556
+ where ` private-repo.json ` :
557
+ ```
558
+ {
559
+ "id": "private-repo",
560
+ "user": "scala-ci",
561
+ "pass": "???"
562
+ }
563
+ ```
564
+
499
565
500
566
# Misc
501
567
@@ -532,9 +598,11 @@ Incorporate the cert into an ssl chain for nginx:
532
598
533
599
For [ forward secrecy] ( http://axiacore.com/blog/enable-perfect-forward-secrecy-nginx/ ) :
534
600
```
535
- openssl dhparam -out files/default/dhparam.pem 2048
601
+ openssl dhparam -out files/default/dhparam.pem 1024
536
602
```
537
603
604
+ Using 1024 bits (instead of 2048) for DH to be Java 6 compatible... Bye-bye A+ on https://www.ssllabs.com/ssltest/analyze.html?d=scala-ci.typesafe.com
605
+
538
606
Confirm values in the csr using:
539
607
540
608
```
@@ -551,7 +619,7 @@ If it appears stuck at "Waiting for remote response before bootstrap.", the user
551
619
(check C:\Program Files\Amazon\Ec2ConfigService\Logs) we need to enable unencrypted authentication:
552
620
553
621
```
554
- aws ec2 get-password-data --instance-id $INST --priv-launch-key $PWD/.chef/config/chef .pem
622
+ aws ec2 get-password-data --instance-id $INST --priv-launch-key ~/.ssh/typesafe-scala-aws-$AWS_USER .pem
555
623
556
624
cord $IP, log in using password above and open a command line:
557
625
0 commit comments