dev to delivery with puppet, vagrant and aws

35
DEV TO DELIVERY WITH PUPPET, VAGRANT AND AWS SAM BASHTON, BASHTON LTD

Upload: puppet-labs

Post on 08-May-2015

2.521 views

Category:

Technology


3 download

DESCRIPTION

"Dev to Delivery with Puppet, Vagrant and AWS" by Sam Bashton of Bashton Ltd. at Puppet Camp London 2013. Find the video here: http://puppetlabs.com/community/puppet-camp

TRANSCRIPT

Page 1: Dev to Delivery with Puppet, Vagrant and AWS

DEV TO DELIVERY WITHPUPPET, VAGRANT AND AWS

SAM BASHTON, BASHTON LTD

Page 2: Dev to Delivery with Puppet, Vagrant and AWS
Page 3: Dev to Delivery with Puppet, Vagrant and AWS

ABOUT MELinux guy since Slackware, floppy disks and root + bootUsing Puppet since 2007Run a company in Manchester, North West EnglandWe provide outsourced ops for other companies

Page 4: Dev to Delivery with Puppet, Vagrant and AWS

TOOLS FOR THE DAY

Page 5: Dev to Delivery with Puppet, Vagrant and AWS

WHAT IS THE POINT OF THISTALK?

Page 6: Dev to Delivery with Puppet, Vagrant and AWS
Page 7: Dev to Delivery with Puppet, Vagrant and AWS

WHAT WE HAVEDevIntegrationQAStageLive

Page 8: Dev to Delivery with Puppet, Vagrant and AWS

WHICH ENVIRONMENTS AREMANAGED BY PUPPET?

DevIntegrationQAStageLive

Page 9: Dev to Delivery with Puppet, Vagrant and AWS

WHAT WE'RE AFTERConfidence that everything will work correctly inproductionConsistency between environments

Page 10: Dev to Delivery with Puppet, Vagrant and AWS

OPS AND DEVS CO-OPERATING

Previously:Devs built stuffLater, Ops came and built production infrastructure

This caused many IT problemsThe solution?

Page 11: Dev to Delivery with Puppet, Vagrant and AWS

OPSVELOPMENT

Page 12: Dev to Delivery with Puppet, Vagrant and AWS

OPS AND DEVS WORKINGTOGETHER

Ops need to be involved in development planning processPuppet modules and manifests should be selected/built aspart of the development process

Page 13: Dev to Delivery with Puppet, Vagrant and AWS

DEVELOP ON PUPPETPROVISIONED

ENVIRONMENTSAs early as possible, all dev should be done on systemsbuilt from PuppetPuppet manifests get tested as part of the developmentprocess

Page 14: Dev to Delivery with Puppet, Vagrant and AWS

VAGRANTBuilds virtual machines, optionally from Puppet manifestsMakes it easy to spin up short-lived dev instancesQuick to get working

Avoid ops being a blocker for dev

Page 15: Dev to Delivery with Puppet, Vagrant and AWS

A WORKFLOWDevelopment happens on Vagrant VM(s)Deployment to all shared environments happens viaJenkins

Page 16: Dev to Delivery with Puppet, Vagrant and AWS

PUPPET CONFIGThere should be only one set of Puppetmanifests/modules

Tested deployed and merged through software testenvironments

Page 17: Dev to Delivery with Puppet, Vagrant and AWS

ONE SET OF MANIFESTS,MANY ENVIRONMENTS

Different environments need different configResource locationsSettings

Page 18: Dev to Delivery with Puppet, Vagrant and AWS

DEALING WITH DIFFERENTENVIRONMENTS

HieraRemoves the need for ugly if/else blocksPut anything that differers by environment in a separatefileCan encrypt with hiera-gpg if data sensitive

Page 19: Dev to Delivery with Puppet, Vagrant and AWS

HIERA.YAML:hierarchy: - %{environment} - common

Page 20: Dev to Delivery with Puppet, Vagrant and AWS

VAGRANTFILEVagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "centos64-lxc" config.vm.hostname = "puppetconf-example" config.vm.provision :puppet do |puppet| puppet.manifests_path = "puppet/manifests" puppet.manifest_file = "site.pp" puppet.module_path = "puppet/modules" puppet.hiera_config_path = 'puppet/hiera.yaml' puppet.options => ["--environment", "localdev"] endend

Page 21: Dev to Delivery with Puppet, Vagrant and AWS

TO DEVELOP:Start of the day, dev runs vagrant up and gets the latestenvironmentCode/objects sit in a shared vagrant volumeEnd of the day, or when new Puppet manifests/modulesare available, vagrant destroy is run

Page 22: Dev to Delivery with Puppet, Vagrant and AWS

VAGRANT PROVISIONERSAvoid VirtualBox wherever possibleSlow, prone to taking down host machineOn Linux, vagrant-lxc is speedyVMWare Fusion for non-free fruit-based Unix

Page 23: Dev to Delivery with Puppet, Vagrant and AWS

VAGRANT AND AWSUse Vagrant to bring up machines in AWS usingvagrant-aws plugin

Makes it easy to share work in progressMeans VirtualBox doesn't crash your laptopHas cost implications

Page 24: Dev to Delivery with Puppet, Vagrant and AWS

QA/STAGINGENVIRONMENTS IN AWS

Merge to appropriate branch in gitJenkins takes over

Page 25: Dev to Delivery with Puppet, Vagrant and AWS

ADVANTAGE OF AWSGreat thing about AWS - we don't need to run our testenvironments all the timeHave the environments only when you need them

Page 26: Dev to Delivery with Puppet, Vagrant and AWS

TESTING VS LIVEUse the money saved to build better environmentsMinimise differences between testing and liveIn particular, test on environments with relevant HA asearly as possible

Page 27: Dev to Delivery with Puppet, Vagrant and AWS
Page 28: Dev to Delivery with Puppet, Vagrant and AWS
Page 29: Dev to Delivery with Puppet, Vagrant and AWS

SPEEDING UP THE PROCESSSome resources, in particular DBs can be slow to provision(30 mins plus)Could just run 24/7One approach: pilot light provisioning

Page 30: Dev to Delivery with Puppet, Vagrant and AWS
Page 31: Dev to Delivery with Puppet, Vagrant and AWS
Page 32: Dev to Delivery with Puppet, Vagrant and AWS

PILOT LIGHT PROVISIONINGTiers built using autoscaling groupsMinimum instance count is 0Jenkins sets desired capacity appropriately on deployReset to 0 via a recurring scheduled operation on ASGand/or Jenkins job

Page 33: Dev to Delivery with Puppet, Vagrant and AWS

CONCLUSIONSInfrastructure development should run in parallel tosoftware dev

This means devs + ops must co-operate

Minimise differences from production at all stagesIf a dev can't see the problem in their environment,you're much more likely to get woken up by it

Page 34: Dev to Delivery with Puppet, Vagrant and AWS

QUESTIONS? COMMENTS?Sam Bashton

[email protected]

Twitter: @bashtoni

(Psst.. )http://www.bashton.com/jobs/