Book Image

Creating Development Environments with Vagrant

By : MICHAEL KEITH PEACOCK
Book Image

Creating Development Environments with Vagrant

By: MICHAEL KEITH PEACOCK

Overview of this book

Table of Contents (17 chapters)
Creating Development Environments with Vagrant Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Web-based software projects are increasingly complicated, with a range of different dependencies, requirements, and interlinking components. Swapping between projects, which require different versions of the same software, becomes troublesome. Getting team members up and running on new projects becomes time-consuming.

Vagrant is a powerful tool used to create, manage, and work with virtualized development environments for your projects. By creating a virtual environment for each project, their dependencies and requirements are isolated, they also don't interfere with the software installed on your own machine such as WAMP or MAMP. Colleagues can be up and running on a new project in minutes with a single command. With Vagrant, we can wipe the slate clean if we break our environment and be back up and running in no time.

What this book covers

Chapter 1, Getting Started with Vagrant, introduces the concept of virtualization, its importance in the role of the development environment, and walks you through the Vagrant installation process.

Chapter 2, Managing Vagrant Boxes and Projects, walks you through creating Vagrant projects, exploring and configuring the Vagrantfile, and working with base boxes.

Chapter 3, Provisioning with Puppet, explores Puppet, the provisioning tool, and how to create Puppet manifests to provision a server.

Chapter 4, Using Ansible, explores Ansible, the provisioning tool, and how to create Ansible playbooks to provision a server.

Chapter 5, Using Chef, explores Chef, the provisioning tool, and how to create Chef recipes to provision a server.

Chapter 6, Provisioning Vagrant Machines with Puppet, Ansible, and Chef, discusses how to use Puppet, Ansible, and Chef within the context of Vagrant to provision development environments.

Chapter 7, Working with Multiple Machines, explores using Vagrant to create and manage projects that use multiple virtual machines, which communicate with each other.

Chapter 8, Creating Your Own Box, discusses the process of creating your own base box for use within a Vagrant project.

Chapter 9, HashiCorp Atlas, walks you through using Vagrant Share to share SSH and HTTP(S) access to a Vagrant-managed machine, and how to use the services provided through the Vagrant Cloud.

Appendix, A Sample LEMP Stack, walks you through the process of creating a LEMP server within a new Vagrant project.

What you need for this book

You will need a Windows, OS X, or Linux computer with Vagrant and Oracle VirtualBox installed, although the installation process for these will be discussed in Chapter 1, Getting Started with Vagrant.

Who this book is for

This book is for software developers, development managers, and technical team leaders who want to have a more efficient, robust, and flexible development environment for their projects and for their team.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "After installing Vagrant, we ran the vagrant command to check whether it was installed correctly."

A block of code is set as follows:

VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "base"
end

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

---
- hosts: default
  tasks:
  - name: update apt cache
    apt: update_cache=yes
  - name: ensure nginx is installed
    apt: pkg=nginx state=present
  - name: write the nginx config file
    template: src=nginx-default-site.conf dest=/etc/nginx/sites-available/default.conf
    notify:
    - restart nginx
  - name: ensure nginx is running
    service: name=nginx state=started
  handlers:
    - name: restart nginx
      service: name=nginx state=restarted

Any command-line input or output is written as follows:

ansible-playbook our-playbook.yml -i our-inventory-file

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Again, on OS X, the first step is to double-click on the Vagrant.pkg icon."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.