Engine Yard Blog RSS Feed

Virtualization for developers, Part 2

Welcome back! In Part 1 of this series we introduced you to Vagrant, a powerful tool for creating virtual environments of all flavors for development purposes. When we last left off we had configured Vagrant using the Vagrantfile and brought up our virtual environment based on an Ubuntu 12.04 image. In part two, we are going to now start automating the configuration of the virtual environment itself.

Introducing Puppet

Once a virtual environment has been created using Vagrant, in almost all cases there is going to be some configuration necessary of that environment itself before it can be useful. For example, if you are like me you'll need to install some sort of LAMP stack so you can do some PHP development. To accomplish this we will need to add a provisioning technology to our Vagrant setup which will run in the virtual environment once it is created to install any packages, etc. necessary.

Out of the box Vagrant supports a number of different provisioning technologies such as Puppet, shell scripting, Chef, and more. In this article we will be using Puppet to configure and install our packages in the virtual environment. To get started, we need to head back into our Vagrantfile to add a new configuration block to specify our Puppet provisioner as shown below:

config.vm.provision :puppet do |puppet|
    puppet.options        = "--verbose --debug"
    puppet.manifests_path = "puppet/manifests"
    puppet.module_path    = "puppet/modules"
    puppet.manifest_file  = "site.pp"
    puppet.facter         = {
        "vagrant"     => true,
    }
end

There is a lot going on here in this configuration block, but if you are familiar with Puppet already most of these configuration settings should already be familiar to you. For those of you who aren't certain what these mean, he's a quick legend for you:


Functions, Threads, and Processes. What's Next? Cows

cows-fork

In the previous post in this series, we discovered that setting up a server before you even boot it is not only possible, but gives enormous productivity rewards in a cloud architecture. In this post, we look at the four essential principles of designing your app for the cloud.

Introduction

Using a cloud architecture places extra constraints on app developers. These constraints cannot be worked around, and therefore app developers must get to grips with them before they start designing their apps.

Because the constraints are often unusual and unintuitive, it is worth also understanding the context behind the constraints. Why are they necessary? How do they improve the reliability of applications? Are there no alternatives? With these questions answered, an app developer can plan more confidently, knowing that they are taking the optimum path.

All of the core constraints emerge from one fundamental principle: cloud computing must account for random failures. To cope with this you will need multiple servers, and when you have multiple servers you also need a strategy for setting up and maintaining these servers with as little effort and as few subsequent interventions as possible. Such strategies are said to belong to the cattle model, because they contrast with the usual non-cloud method of dealing with servers as something like pets.


Building a Better PHP — Part 2: Using HHVM

Note: This is part 2 in our HHVM/Hack series, read part 1, part 3

Using HHVM

Continuing on from part one in our series, now that we have a working HHVM environment, we can start to use it for something more practical than phpinfo().

Composer

One of the first things you can do today to improve your workflow, is to start using HHVM for composer. As noted in numerous tweets. This will make composer run faster, and use less resources. And, as this is a standalone process, it is easy to switch away from PHP.net -- and more importantly, switch back if things go awry.

First, lets start by installing Composer. Because HHVM defaults to a 5000ms HTTP request timeout, we will want to change this setting.

To change this, we need to set the Http.SlowQueryThreshold configuration option.

We can set it in the server.hdf config (affecting all requests) by adding:

Http {
  SlowQueryThreshold = 30000
}

Or, we can do it via the command line using the -v flag, or if using --php flag to emulate PHP's CLI, the -d flag:

$ hhvm -v Http.SlowQueryThreshold=30000
or
$ hhvm --php -dHttp.SlowQueryThreshold=30000

Note: You may require a higher threshold depending on your internet connection

We then have to install a couple of dependencies:


March 21, 2014: This Week at Engine Yard

We recently released a new partner program, built to help our development shops and digital agencies succeed through incentives, lead generation, marketing and support. Check it out!

--Tasha Drew, Product Manager

Engineering Updates

PostgreSQL 9.2.7 and 9.3.3 are now available! See Database Version Upgrade Policies for upgrade information.

Nginx has been upgraded to 1.4.6 from 1.2.9 for all environments that are using app servers other than Passenger 2 or 3.

A bunch of other updates are chronicled in our regular release notes!

Social Calendar (Come say hi!)

RubyConf India, March 22-23: In addition to the many excellent talks, our one and only community engineer extraordinaire PJ Haggerty will be giving a talk on Ruby Groups: Act Locally - Think Globally, on March 22nd at 3pm.

RubyConf Philippines, March 28-29: Attendees can visit the Engine Yard table to meet members of our support team who can answer a wide range of any technical and non-technical questions you may have about Engine Yard. Also, PJ Haggerty continues his fabulous world tour, and will be giving a talk on creating active user groups in your local Ruby community.

Articles of Interest

Facebook announced it was open-sourcing a new programming language, Hack, which is designed to enable programmers to develop web pages faster by avoiding system crashing errors. It is built to interoperate seamlessly with PHP. Our community engineer Davey Shafik released a blog exploring Hack and comparing it to other technologies in the PHP space.

Got opinions? Want to explain something cool? Submit a talk for our developer conference, Distill!

Building a Better PHP — Part 1: HHVM and Hack

Note: This is part 1 in our HHVM/Hack series, read part 2, part 3

With the official release of Hack for HHVM today by Facebook, we thought it would be a good idea to take a look at HHVM, and Hack in detail.

Facebook is [probably] the largest PHP installation on the planet, and yet in more recent years, they have turned away from PHP5 in favor of home-grown solutions.