A Build Engineering Team’s Journey of Infrastructure as Code - the challenges that we’ve faced and the practices that we implemented as we went along our journey.
4. Build Engineering today @
Atlassian
• Build platform & services used internally within the company
• 60k builds per month
• 35k automated tests for JIRA
Monday, 10 February 14
15. Confidence of Change
initial
+ Code review
HIGH
NONE
Dev
Code review
Rollout
Lifecycle of an infra change
Monday, 10 February 14
Soak in Prod
16. Using Staging for Development
puppetmaster
• Coding on Puppet Master
• Culture of manually modifying
production - Configuration Drift
• Impact on Builds
staging puppet environment
build agents
Monday, 10 February 14
17. Vagrant
http://www.vagrantup.com/
Mitchell Hashimoto
@mitchellh
• Easily spin up Infrastructure locally on your laptop
• Disposable / reproducible environments
• Machine provisioning via Virtual Box / VMWare / AWS
• Configuration applied via Shell Scripts / Puppet / Chef
• Develop and test infrastructure changes locally
Monday, 10 February 14
20. Confidence of Change
initial
+ Code review
+ Vagrant
HIGH
NONE
Dev
Code review
Rollout
Lifecycle of an infra change
Monday, 10 February 14
Soak in Prod
21. Vagrant != Production
• Vagrant basebox differences with production machines
• Originally using publicly available vagrant baseboxes
• Installed packages biggest differences
• Generating a basebox manually was a painful process
Monday, 10 February 14
28. Confidence in Change
initial
+ Code review
+ Vagrant
+ Veewee
HIGH
NONE
Dev
Code review
Rollout
Lifecycle of an infra change
Monday, 10 February 14
Soak in Prod
32. Disadvantages
• Requires cucumber dependencies to be installed on
tested VM
• Tests run within the VM making testing firewall rules
harder
Monday, 10 February 14
33. Confidence in Change
initial
+ Code review
+ Vagrant
+ Veewee
+ Cukes
HIGH
NONE
Dev
Code review
Rollout
Lifecycle of an infra change
Monday, 10 February 14
Soak in Prod
35. Continuous Integration
• ‘From scratch’ provisioning
• Confidence that you can rebuild in disaster
Monday, 10 February 14
36. “
The Pets: you give nice names,
you stroke them, and when they get ill,
you nurse them back to health,
taking a long time over it
The Cattle: you give them numbers.
When they get ill, you shoot them
”
– Tim Bell, CERN
Monday, 10 February 14
37. Confidence in Change
initial
+ Code review
+ Vagrant
+ Veewee
+ Cukes
+ CI
HIGH
NONE
Dev
Code review
CI & Rollout
Lifecycle of an infra change
Monday, 10 February 14
Soak in Prod
39. Spread out CI
provision VM1
provision VM2
provision VM3
provision VM4
Monday, 10 February 14
provision VM1
provision VM2
Moved from sequential
to parallel provisioning
provision VM3
provision VM4
40. There are so many
MacPros you can steal
Monday, 10 February 14
42. Profiling Puppet Runs
Add “--evaltrace” to puppet apply
+
Collect and show the
longest occurrences of:
“Evaluated in ([d.]+) seconds”
Monday, 10 February 14
=
44. Delta Provisioning
• Provision locally & for CI
• Faster & different class of problems found
• Matches production state
‘from scratch’ provision
delta provision
provision VM1
import VM1 box
on success
export VM1
Monday, 10 February 14
fileshare
provision VM1
45. Confidence in Change
initial
+ CI
+ Code review
+ Delta CI
+ Vagrant
+ Veewee
+ Cukes
HIGH
NONE
Dev
Code review
CI & Rollout
Lifecycle of an infra change
Monday, 10 February 14
Soak in Prod
47. Painful Puppet Rollouts
• Puppet runs impacted running builds
• Disabling all the build agents
• Performing the roll out
•
•
git clone / librarian-puppet / symlink update on puppetmaster
Manually kick off puppet on all the build agents
• Enabling all the build agents
• Set of Puppet environments for every bamboo server
Monday, 10 February 14
48. Graceful Service restarts
+
Bamboo Agent JVM process watches
for touch file & shutdowns when Idle
(written as a Bamboo Plugin)
Monday, 10 February 14
49. Puppet Environments
• BEFORE - Multiple puppet envs for each Bamboo Server
• jbac_staging
• jbac_production
• cbac_staging
• cbac_production
• etc
• AFTER - Changed to use ‘staging’ & ‘production’ only
Monday, 10 February 14
50. Updates on Puppetmaster
• BEFORE: Manually on puppetmaster
• git clone the puppet tree
• run librarian-puppet to pull external modules
• Update staging / production symlink
• AFTER: Bamboo build which performs the above steps
automatically
Monday, 10 February 14
53. Confidence in Change
initial
+ Cukes
+ Code review
+ CI
+ Vagrant
+ Delta CI
+ Veewee
+ Frequent releases
HIGH
NONE
Dev
Code review
CI & Rollout
Lifecycle of an infra change
Monday, 10 February 14
Soak in Prod
54. “
I’m scared!
“
”
– Peter Leschev, 3 years ago
”
Should I be scared?
Monday, 10 February 14
– Peter Leschev, 3 months ago
56. Confidence in Change
initial
+ Cukes
+ Notification
+ Code review
+ CI
+ Vagrant
+ Delta CI
+ Veewee
+ Frequent releases
HIGH
NONE
Dev
Code review
CI & Rollout
Lifecycle of an infra change
Monday, 10 February 14
Soak in Prod