43
Vagrant, Chef and TYPO3 a love affair

Vagrant, Chef and TYPO3 - A Love Affair

Embed Size (px)

Citation preview

Vagrant, Chefand TYPO3

a love affair 💞💞💞

💞💞💞

@kaktusmimi

lihsmi.ch

Gewinnspiel

• Wie viele Einhörner sind in den

Slides?

• Twitter an @codecoon und gewinne

einen USB 3.0 – Stick mit einer

Codecoon Box

Outline

• Motivation

• Introducing Vagrant & Chef

• TYPO3 & Vagrant

• „The punkt.de Way“

• Codecoon

How long does it take you

to set up a new TYPO3

project?

How do you handle

multiple TYPO3 projects

on your development

machine?

How do you share

projects

With your colleagues?

“But it worked on my

machine!”

What about

“You build it – you run it!”

How can Vagrant help you?

• Install (multiple) TYPO3 projects in

minutes

• Have it “to go”

• Share it with others

• Have a “copy” of your production

server

Technology StackVirtualBoxFree Open Source Virtualization Tool

ChefConfiguration ManagementFramework

Vagrant“Remote Control” for VirtualBox

What is Vagrant?

• Building tool for portable work

environments

• Written in Ruby

• Open Source

• Build upon well-established tools

Vagrant Components

• Vagrant Box

• Vagrantfile

• Provisioners

• Providers

Vagrant Boxes

• Basically a “tweaked” virtual

machine Image

• Used as base layer for all further

provisioning

• Many pre-installed boxes available

online:

$ vagrant box add {title} {url}$ vagrant init {title}$ vagrant up

The Vagrantfile

• Configures your Vagrant environment

Provisioners

• Run once the box is booted in

VirtualBox

• „Where the magic happens“

– Installing packages and software

– Configuration and starting of services

– E.g. creating vhost, database, ...

Providers

• Describe in which virtualization

environment to provision your machines

• Multiple providers available

– VirtualBox

– VMWare

– Amazon AWS

What is Chef?

• Configuration Management

Automation Tool

• Written in Ruby

– Provides easy-to-learn (?) DSL

• „Infrastructure as code“

– Reproducible, Testable, Versionable

Chef Tools

• Chef Client

• Chef Server

• Knife

• …too many

Chef Components

• Cookbooks, Recipes, Resources

• Attributes

• Templates

• Roles

• and many more…

└── cookbook_name    ├── attributes │ └── default.rb   ├── recipes │ └── default.rb   ├── templates │ └── default │ └── template.erb └── metadata.rb

Provisioning

Run Chef in your VagrantBox

sudo chef-solo –c solo.rb -j config.json

Your own Vagrant Box• The “Playbook-to-Cookbook-

Algorithm”

–Write installation steps in a text

document

– Follow steps yourself, refine document

– Give document to someone else, refine

again

– No changes in document start writing

cookbooks

Generic TYPO3 Cookbook

1. Install Packages for Apache, MySQL,

PHP

2. Provision Webspace(s) and vhost(s)

3. Provision MySQL Database(s)

4. Download TYPO3 sources (or use

Composer)

5. Clone your Git project

“The punkt.de way”

• Project configuration in JSON files

(DataBags)

• Each developer works on multiple

projects

• Each developer has individual

projects list

“The punkt.de way”

• Vagrant Box == Hosting Server

• Provisioning with Chef

• Chef recipes also used for Jenkins

“The punkt.de way”

• Project files on Host

– NFS mount into Vagrant Box

– No problems with IDE & Git

– Faster provisioning after vagrant destroy

“The punkt.de way”

• Next steps

– Provisioning of hosting servers with Chef

– Building Vagrant Boxes on CI Server

– Vagrant Boxes for customers

– Codecoon

The nice things…

• Multi-Machine setup

• Remote Debugging with PHPStorm

• Local Project Files

• Git GUIs

• Ships with all the tools

– Node.js, grunt, bower, xdebug, …

Biggest Pain: File Mounts

• 3 solutions

– VirtualBox / VMWare shared folders

– Samba Mounts

– NFS Mounts

• Files in Box -- Mount on Host

• Files on Host -- Mount in Box

Codecoon

Make it fun to code again!

• Ready-to-use Vagrant Boxes• Identical to hosting environment• One-click deployment• Try it www.codecoon.com

Summary• Vagrant is a great tool for portable

boxes

• Chef can help you manage your

configuration

• „Infrastructure as Code“

• Same environment on dev and

production

• DevOps brings devs and admins

together

Thank You!