instant lamp stack with vagrant and puppet

22
Instant LAMP Stack with Vagrant and Puppet Patrick Lee Boise Code Camp March 16, 2013

Upload: patrick-lee

Post on 05-Dec-2014

5.086 views

Category:

Technology


3 download

DESCRIPTION

Do you enjoy installing and configuring Apache, PHP, and MySQL every time you reinstall your OS or switch to a new machine? Neither do I. And we never have to do it again. Vagrant can use the VirtualBox API and configuration defined in Puppet to spin up a development VM in a couple of minutes. And it's really easy to do. I'll start with the simplest possible example and work up to a cluster of VM's. Feel free to bring your laptop and follow along.

TRANSCRIPT

Page 1: Instant LAMP Stack with Vagrant and Puppet

Instant LAMP Stack with Vagrant and Puppet

Patrick LeeBoise Code Camp

March 16, 2013

Page 2: Instant LAMP Stack with Vagrant and Puppet

Resources

Code: https://github.com/patrickdlee/vagrant-examples *Slides: http://www.slideshare.net/patrickdleeMe:● @patrickdlee on Twitter● [email protected]

* Use the vagrant1.1 branch.

Page 3: Instant LAMP Stack with Vagrant and Puppet

Who am I?

● Former high school teacher (5 years)● Recovering software developer (10 years)● Brand new release engineer (one week)● Organizer of Boise Web Tech Meetup (4 years)● Incurable techie (38 years and counting)

I have worked at Bodybuilding.com for 4-1/2 years. Yes, we are hiring. Talk to me if you're interested.

Page 4: Instant LAMP Stack with Vagrant and Puppet

Assumptions

I am assuming that you are familiar with the following or at least know of them...

● VirtualBox● Linux● Apache / PHP / MySQL● Software configuration● Cloud computing

But if not, I'll explain them briefly so don't worry.

Page 5: Instant LAMP Stack with Vagrant and Puppet

A brief analogy

Remember the days before source control?What did you do? Zip files named by date?Do you miss doing that?

Here's the analogy...

Vagrant : manual env setup :: Zip files : SCM

Page 6: Instant LAMP Stack with Vagrant and Puppet

Agenda

● What is the problem anyway?● What is Vagrant?● Examples!● What is Puppet?● More examples!● Simulating production architecture?● Even more examples!● Integration with Amazon AWS● One more example!● Related topics● Questions?● Links

Page 7: Instant LAMP Stack with Vagrant and Puppet

What is the problem anyway?

Setting up a development environment is not a fun way to spend an afternoon.

Options:● Using a remote server● Installing everything locally● Creating a virtual machine

Let's take a look at each of these...

Page 8: Instant LAMP Stack with Vagrant and Puppet

Using a remote server

Pros:● It's separate from your machine● No divergence of environments on team● You can rebuild your own machine at will

Cons:● You have to push code to it● You probably have to share it with others● It's just inefficient at best● What if you're out of the office?

Page 9: Instant LAMP Stack with Vagrant and Puppet

Installing everything locally

Pros:● You have complete control over it● Nobody else is breaking using it

Cons:● It's time-consuming and error-prone● It's not easily repeatable● Barrier to rebuilding your machine● No standards among teammates

Page 10: Instant LAMP Stack with Vagrant and Puppet

Creating a virtual machine

Pros:● It keeps your own machine cleaner● VM's can be snapshotted● VM's are (mostly) portable

Cons:● Initial installation is time-consuming● Virtual machine images are big● There's still configuration when copying them

Page 11: Instant LAMP Stack with Vagrant and Puppet

Enter Vagrant!

Pros:● Can be run entirely on your machine● Defines all configuration externally● Consistent, repeatable, and reliable● Can standardize environments for your team● Keeps your own machine cleaner● You can rebuild your own machine at will

Cons:● Expectation of increased productivity?

Page 12: Instant LAMP Stack with Vagrant and Puppet

What is Vagrant?

Vagrant is a tool that allows developers to..."Create and configure lightweight, reproducible, and portable development environments."

● Created by Mitchell Hashimoto● Open source and on GitHub● Available for Linux, Mac, and Windows● Uses Oracle's VirtualBox● Uses Puppet or Chef for provisioning

Page 13: Instant LAMP Stack with Vagrant and Puppet

Examples!

Page 14: Instant LAMP Stack with Vagrant and Puppet

What is Puppet?

"Puppet is IT automation software that helps system administrators manage infrastructure throughout its lifecycle, from provisioning and configuration to patch management and compliance."

● Define all your configuration in text files● Apply the configuration to your machines● Modify the configuration at any time● Ensure that all machines are up-to-date● Straightforward, yet powerful technology

Page 15: Instant LAMP Stack with Vagrant and Puppet

More examples!

Page 16: Instant LAMP Stack with Vagrant and Puppet

Simulating production architecture?

A single VM is all well and good, but we need to simulate production.

No problem!

● Create as many types of VM's as you like● Spin up one of each or entire clusters● The only limit is your hardware

Page 17: Instant LAMP Stack with Vagrant and Puppet

Even more examples!

Page 18: Instant LAMP Stack with Vagrant and Puppet

Integration with Amazon AWS

Vagrant 1.1 (released 3/14) supports multiple providers...

● VirtualBox (the default)● Amazon AWS● Rackspace Cloud● VMWare● ...and more to come.● You can even add your own.

Page 19: Instant LAMP Stack with Vagrant and Puppet

One more example!

Page 20: Instant LAMP Stack with Vagrant and Puppet

Related topics

PuppetForge is a repository of Puppet modules provided by the community.

rspec-puppet is a tool for testing Puppet modules.

Chef is another option for provisioning with Vagrant.

AWS OpsWorks is a new service for configuration management, provisioning, application deployments, auto-scaling, routing, load balancing, and more.

Page 21: Instant LAMP Stack with Vagrant and Puppet

Questions?

Page 22: Instant LAMP Stack with Vagrant and Puppet

Links

● http://www.vagrantup.com/● https://puppetlabs.com/● http://forge.puppetlabs.com/● http://rspec-puppet.com/● http://www.opscode.com/chef/● https://aws.amazon.com/opsworks/