<atom:feed xmlns:atom="http://www.w3.org/2005/Atom"><atom:title type="html">Richard Crowley&amp;#8217;s blog</atom:title><atom:link href="http://rcrowley.org/index.xml" rel="self" /><atom:link href="http://rcrowley.org/" rel="alternate" /><id>http://rcrowley.org/index.xml</id><atom:updated>2011-12-31T07:53:25Z</atom:updated><atom:author><atom:name>Richard Crowley</atom:name></atom:author><atom:entry><atom:title type="html">Square
</atom:title><atom:link href="http://rcrowley.org/2012/01/03/square.html" rel="alternate" /><atom:id>http://rcrowley.org/2012/01/03/square.html</atom:id><atom:published>2011-12-31T07:53:25Z</atom:published><atom:updated>2011-12-31T07:53:25Z</atom:updated><atom:author><atom:name>Richard Crowley</atom:name></atom:author><atom:content type="html">
&lt;article&gt;
&lt;header&gt;
	&lt;time datetime="2012-01-03" pubdate&gt;2012-01-03&lt;/time&gt;
	&lt;h1&gt;Square&lt;/h1&gt;
&lt;/header&gt;

&lt;p&gt;Today is my first day at Square.&amp;nbsp; I&amp;#8217;m joining the infrastructure team there to help automate whole datacenters, build APIs to real hardware, smooth out deployment, and probably much more along the way.&amp;nbsp; I&amp;#8217;m very excited to return to working on scalability and performance problems on a pretty highly-trafficked API.&amp;nbsp; (When you spend all your time writing configuration management software, you tend not to manage any servers.)&lt;/p&gt;

&lt;p&gt;Blueprint will remain an open-source configuration management tool that I maintain, newly decoupled from any business interests.&amp;nbsp; In fact, I just merged the S3-backed Blueprint Server into &lt;a href="https://github.com/devstructure/blueprint/commits/master"&gt;&lt;code&gt;master&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s been about two years since Matt and I set out to build heavily automated development environments and stumbled into a new configuration management workflow.&amp;nbsp; I can&amp;#8217;t understate how much I&amp;#8217;ve learned about both engineering and startups in that time.&amp;nbsp; For now, though, I want to spend my time engineering and not selling or searching for consulting work.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s hip to be (a) square.&lt;/p&gt;

&lt;/article&gt;

</atom:content></atom:entry><atom:entry><atom:title type="html">Debian packaging for busy people &amp;mdash; Debra and Freight
</atom:title><atom:link href="http://rcrowley.org/articles/packaging.html" rel="alternate" /><atom:id>http://rcrowley.org/articles/packaging.html</atom:id><atom:published>2011-12-31T07:53:25Z</atom:published><atom:updated>2011-12-31T07:53:25Z</atom:updated><atom:author><atom:name>Richard Crowley</atom:name></atom:author><atom:content type="html">
&lt;article&gt;
&lt;header&gt;
	&lt;time datetime="2011-01-28" pubdate&gt;2011-01-28&lt;/time&gt;
	&lt;h1&gt;Debian packaging for busy people &amp;mdash; Debra and Freight&lt;/h1&gt;
&lt;/header&gt;
&lt;p&gt;I know the stereotypes.&amp;nbsp; Developers suck at packaging.&amp;nbsp; We&amp;#8217;re typecast as thinking &lt;code&gt;./configure &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install&lt;/code&gt; is good enough or that piping &lt;code&gt;wget&lt;/code&gt; into &lt;code&gt;sh&lt;/code&gt; is acceptable.&amp;nbsp; But there are plenty of &lt;code&gt;Makefile&lt;/code&gt;s without a working &lt;code&gt;uninstall&lt;/code&gt; target and there are plenty of malicious shell scripts waiting to be piped to your shell.&amp;nbsp; Good packaging is a thing of beauty.&lt;/p&gt;
&lt;p&gt;Of course, even the beautiful things get old.&amp;nbsp; There are parts of the Debian packaging system that I don&amp;#8217;t believe have much use anymore so the tools and workflows I&amp;#8217;m about to advocate do not and probably will not support them.&lt;/p&gt;
&lt;h2&gt;&lt;code&gt;conffiles&lt;/code&gt; control file&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;conffiles&lt;/code&gt; instructs the package manager to treat the files listed within specially, taking great care not to squash deviations from the packaged version.&amp;nbsp; The extra care is welcome from the central Debian archive and never needed elsewhere.&amp;nbsp; Sometimes I know enough about my target systems to package configuration files just like other files.&amp;nbsp; All other times, I use Puppet to intelligently manage the file across my entire installation.&lt;/p&gt;
&lt;h2&gt;Source packages&lt;/h2&gt;
&lt;p&gt;The concept make sense for the central Debian archive because of the great distance between your average open-source project and the associated Debian maintainer.&amp;nbsp; See &lt;a href="http://www.lucas-nussbaum.net/blog/?p=617"&gt;Giving up on Ruby packaging&lt;/a&gt; to get a sense of the problem.&amp;nbsp; However, in the year 2011 when version control is not heretic but required, why endorse another way to ship source code around?&amp;nbsp; Source packages have been superseded by GitHub.&amp;nbsp; The argument gets even stronger when I&amp;#8217;m both author and maintainer.&amp;nbsp; Rather than having binary packages, source packages, source package source, and source source (still here?), everything is reduced to a Git repository and &lt;code&gt;make deb&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;Debra builds Debian packages&lt;/h2&gt;
&lt;p&gt;Debra was &lt;a href="http://rcrowley.org/articles/debra.html"&gt;released months ago&lt;/a&gt; so I&amp;#8217;ll treat this as a brief review.&amp;nbsp; Debra is how I build packages.&amp;nbsp; It ends up calling &lt;code&gt;dpkg-deb&lt;/code&gt;(1) just like you&amp;#8217;d expect but handles the heavy lifting for you.&amp;nbsp; Three commands:&lt;/p&gt;
&lt;pre&gt;debra create foo control
# Put files in foo/
debra build foo foo_$VERSION_$ARCH.deb
debra destroy foo&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://rcrowley.github.com/debra/"&gt;Debra&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Freight builds Debian archives&lt;/h2&gt;
&lt;p&gt;Freight replaces &lt;code&gt;reprepro&lt;/code&gt;(1) with two shell scripts.&amp;nbsp; &lt;code&gt;freight-add&lt;/code&gt;(1) manages a staging area, typically in &lt;code&gt;/var/lib/freight&lt;/code&gt; where it maps repositories to sets of package filenames.&amp;nbsp; Packages may appear in more than one repository to, for example, distribute the same package to several Debian/Ubuntu releases.&amp;nbsp; &lt;code&gt;freight-cache&lt;/code&gt;(1) manages the web server&amp;#8217;s document root, typically &lt;code&gt;/var/cache/freight&lt;/code&gt;.&amp;nbsp; There it creates the &lt;code&gt;Release&lt;/code&gt; and &lt;code&gt;Packages&lt;/code&gt; files, deals with GPG signing, and managed the various available architectures.&lt;/p&gt;
&lt;p&gt;Freight uses hard links aggressively to drop old packages from the cache and use as little storage as possible.&amp;nbsp; (I&amp;#8217;m mildly obsessed with hard links.)&lt;/p&gt;
&lt;pre&gt;freight add foo_0.0.0-1_all.deb apt/lucid apt/maverick
freight cache apt/lucid apt/maverick&lt;/pre&gt;
&lt;p&gt;That&amp;#8217;s all it takes to publish a Debian archive.&amp;nbsp; Just BYO web server.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://rcrowley.github.com/freight/"&gt;Freight&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Pack it up&lt;/h2&gt;
&lt;p&gt;You don&amp;#8217;t have to go through what I&amp;#8217;ve heard described as a &amp;#8220;two year hazing process&amp;#8221; to become a Debian developer and understand The Right Way to make packages.&amp;nbsp; Think through the benefits they provide (if you need help, read &lt;a href="http://morethanseven.net/2011/01/16/Why-developers-should-care-about-system-packages.html"&gt;Why Developers Should Care About System Packages&lt;/a&gt;) then get that &lt;code&gt;make deb&lt;/code&gt; target ready.&lt;/p&gt;
&lt;/article&gt;

</atom:content></atom:entry><atom:entry><atom:title type="html">Operable Ruby
</atom:title><atom:link href="http://rcrowley.org/articles/operable-ruby.html" rel="alternate" /><atom:id>http://rcrowley.org/articles/operable-ruby.html</atom:id><atom:published>2011-12-31T07:53:25Z</atom:published><atom:updated>2011-12-31T07:53:25Z</atom:updated><atom:author><atom:name>Richard Crowley</atom:name></atom:author><atom:content type="html">
&lt;article&gt;
&lt;header&gt;
	&lt;time datetime="2011-03-28" pubdate&gt;2011-03-28&lt;/time&gt;
	&lt;h1&gt;Operable Ruby&lt;/h1&gt;
&lt;/header&gt;

&lt;p&gt;Ruby today is a moving target.&amp;nbsp; The reference implementation is releasing rapidly on several branches and at least three alternatives to MRI are in wide use.&amp;nbsp; The RubyGems package manager is releasing nearly every week and the dizzying array of variously compatible gems are releasing whenever they feel like it.&amp;nbsp; Exciting times, to be sure, but also an operator&amp;#8217;s nightmare.&amp;nbsp; At every level of this dependency tree, robust packaging brings order to the chaos.&amp;nbsp; Given that, it surprises me to read folks recommending &lt;a href="http://rvm.beginrescueend.com/"&gt;RVM&lt;/a&gt; for production use.&lt;/p&gt;

&lt;p&gt;An operable production environment relies on packages to account for most files on the system.&amp;nbsp; Think of it as a paper trail: &lt;code&gt;dpkg-query -S &lt;em&gt;pathname&lt;/em&gt;&lt;/code&gt; will tell you the package that owns a particular file.&amp;nbsp; With the mapping of package names to sets of pathnames, packages become uninstallable.&amp;nbsp; Naturally, anything that can be uninstalled entirely can be upgraded.&amp;nbsp; Do you trust that shell script to measure up?&lt;/p&gt;

&lt;p&gt;Hopefully we&amp;#8217;ve settled that packages are not optional in production.&amp;nbsp; By my philosophy, development systems should faithfully mimic production systems in every affordable way, so I extend the policy to my development virtual machines, too.&amp;nbsp; Reliable development environments are just as important to me as reliable production environments.&lt;/p&gt;

&lt;p&gt;There&amp;#8217;s been an interesting &lt;a href="https://groups.google.com/forum/#!topic/devops-toolchain/bslnhqrTT7M"&gt;discussion&lt;/a&gt; on the &lt;a href="https://groups.google.com/group/devops-toolchain"&gt;devops-toolchain mailing list&lt;/a&gt; this week about how best to package the Ruby environment.&amp;nbsp; Unsurprisingly, RVM came up as well as several better options.&amp;nbsp; I&amp;#8217;d like to offer executable proof that building packages from arbitrary Ruby versions is easy.&lt;/p&gt;

&lt;p&gt;The remainder of this article will walk through building up a shell script that uses &lt;a href="http://rcrowley.github.com/debra/"&gt;&lt;code&gt;debra&lt;/code&gt;(1)&lt;/a&gt; to package arbitrary versions of Ruby for Debian-based Linux distributions.&lt;/p&gt;

&lt;p&gt;We&amp;#8217;re building a system package here: the prefix is &lt;code&gt;/usr&lt;/code&gt; and the files should be owned by &lt;code&gt;root&lt;/code&gt;.&amp;nbsp; It isn&amp;#8217;t &lt;code&gt;debra&lt;/code&gt;&amp;#8217;s business who owns the files in the package, so we will run the entire build process as root to ensure this is true.&lt;/p&gt;

&lt;p&gt;First things first, the version numbers we&amp;#8217;re using:&lt;/p&gt;

&lt;pre&gt;VERSION="1.9.2"
PATCH="180"
DPKG_BUILD_ARCH="$(dpkg --print-architecture)"&lt;/pre&gt;

&lt;p&gt;Note well that &lt;code&gt;set -e&lt;/code&gt; should really appear in every single shell script you write so they will exit on failure.&lt;/p&gt;

&lt;pre&gt;set -e&lt;/pre&gt;

&lt;p&gt;Next, use &lt;a href="http://rcrowley.github.com/debra/debra-create.1.html"&gt;&lt;code&gt;debra-create&lt;/code&gt;(1)&lt;/a&gt; to start building up a Debian package in a temporary directory.&amp;nbsp; The first argument to all &lt;code&gt;debra&lt;/code&gt; commands is the directory being used for the build.&amp;nbsp; This block uses one of my favorite shell scripting idioms: using &lt;code&gt;mktemp&lt;/code&gt;(1) to create a temporary directory and &lt;code&gt;trap&lt;/code&gt; to clean up on &lt;code&gt;EXIT&lt;/code&gt; (using &lt;a href="http://rcrowley.github.com/debra/debra-destroy.1.html"&gt;&lt;code&gt;debra-destroy&lt;/code&gt;(1)&lt;/a&gt; in this case).&lt;/p&gt;

&lt;pre&gt;DESTDIR="$(mktemp -d)"
debra create "$DESTDIR"
trap "debra destroy \"$DESTDIR\"" EXIT&lt;/pre&gt;

&lt;p&gt;The extensions we&amp;#8217;re going to enable in the Ruby build require a few development libraries:&lt;/p&gt;

&lt;pre&gt;apt-get -y install libssl-dev libreadline5-dev zlib1g-dev&lt;/pre&gt;

&lt;p&gt;Now for the meat of the Ruby build.&amp;nbsp; Using &lt;a href="http://rcrowley.github.com/debra/debra-sourceinstall.1.html"&gt;&lt;code&gt;debra-sourceinstall&lt;/code&gt;(1)&lt;/a&gt; makes this very easy.&amp;nbsp; It downloads, unpacks, and builds from the tarball given by the second argument.&amp;nbsp; &lt;code&gt;-b&lt;/code&gt; provides a &amp;#8220;bootstrapping&amp;#8221; command that is run immediately after unpacking to setup the extensions we want to enable.&amp;nbsp; &lt;code&gt;-p&lt;/code&gt; relays its argument as &lt;code&gt;--prefix&lt;/code&gt; to the &lt;code&gt;./configure&lt;/code&gt; program and &lt;code&gt;-f&lt;/code&gt; provides other arbitrary arguments to &lt;code&gt;./configure&lt;/code&gt;.&amp;nbsp; After configuring, &lt;a href="http://rcrowley.github.com/debra/sourceinstall.1.html"&gt;&lt;code&gt;sourceinstall&lt;/code&gt;(1)&lt;/a&gt; runs &lt;code&gt;make&lt;/code&gt; and &lt;code&gt;make install&lt;/code&gt; to install the package in &lt;code&gt;DESTDIR&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;debra sourceinstall "$DESTDIR" \
	"ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-$VERSION-p$PATCH.tar.gz" \
	-b"sh -c 'echo fcntl\\\nopenssl\\\nreadline\\\nzlib &amp;gt;ext/Setup'" \
	-p/usr -f"--program-suffix=-$VERSION"&lt;/pre&gt;

&lt;p&gt;(See &lt;a href="http://rcrowley.github.com/debra/sourceinstall.1.html"&gt;&lt;code&gt;sourceinstall&lt;/code&gt;(1)&lt;/a&gt; for more options affecting the build process.)&lt;/p&gt;

&lt;p&gt;The last artifact a Debian package needs is a control file for version and dependency metadata.&amp;nbsp; Other metadata like the MD5 sum of each file are handled automatically by &lt;code&gt;debra&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;cat &amp;gt;$DESTDIR/DEBIAN/control &amp;lt;&amp;lt;EOF
Package: ruby-$VERSION
Version: $VERSION-p$PATCH
Section: devel
Priority: optional
Essential: no
Architecture: $DPKG_BUILD_ARCH
Depends: libc6, libssl0.9.8, libreadline5, zlib1g
Maintainer: Richard Crowley &amp;lt;r@rcrowley.org&amp;gt;
Description: Ruby $VERSION.
EOF&lt;/pre&gt;

&lt;p&gt;With that, we can build the package in a file that follows the Debian convention of &lt;code&gt;&lt;em&gt;package&lt;/em&gt;_&lt;em&gt;version&lt;/em&gt;_&lt;em&gt;architecture&lt;/em&gt;.deb&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;debra build "$DESTDIR" "ruby-${VERSION}_${VERSION}-p${PATCH}_${DPKG_BUILD_ARCH}.deb"&lt;/pre&gt;

&lt;p&gt;This package is useful in development and production, can be uninstalled or upgraded with ease, coexists peacefully with the system&amp;#8217;s Ruby plus other Rubies built this way, and isn&amp;#8217;t gated by anyone else&amp;#8217;s feature freezes or patch schedules.&amp;nbsp; This whole example is available at &lt;a href="https://gist.github.com/891447"&gt;https://gist.github.com/891447&lt;/a&gt;.&lt;/p&gt;

&lt;/article&gt;

</atom:content></atom:entry><atom:entry><atom:title type="html">A blueprint is not a diff but it doesn&amp;#8217;t matter
</atom:title><atom:link href="http://rcrowley.org/articles/blueprint-diff-analogy.html" rel="alternate" /><atom:id>http://rcrowley.org/articles/blueprint-diff-analogy.html</atom:id><atom:published>2011-12-31T07:53:25Z</atom:published><atom:updated>2011-12-31T07:53:25Z</atom:updated><atom:author><atom:name>Richard Crowley</atom:name></atom:author><atom:content type="html">
&lt;article&gt;
&lt;header&gt;
	&lt;time datetime="2011-05-07" pubdate&gt;2011-05-07&lt;/time&gt;
	&lt;h1&gt;A blueprint is not a diff but it doesn&amp;#8217;t matter&lt;/h1&gt;
&lt;/header&gt;
&lt;p&gt;The support we at &lt;a href="http://devstructure.com/"&gt;DevStructure&lt;/a&gt; have seen since opening the source to &lt;a href="https://github.com/devstructure/blueprint"&gt;Blueprint&lt;/a&gt; in February has been fantastic and addicting &amp;#8212; thank you all.&amp;nbsp; As a first introduction to how Blueprint works, I want to address an analogy I&amp;#8217;ve seen many times: that a blueprint is a diff of your server.&amp;nbsp; It&amp;#8217;s a perfect analogy and something instantly understood by developers and operators alike.&lt;/p&gt;
&lt;p&gt;The funny thing is: it isn&amp;#8217;t a diff.&amp;nbsp; Even better: it doesn&amp;#8217;t matter.&lt;/p&gt;
&lt;p&gt;Blueprint aims to describe the absolute state of a server in a concise format that is both human- and machine-readable.&amp;nbsp; That&amp;#8217;s the JSON format you see if you run &lt;code&gt;blueprint show &lt;em&gt;name&lt;/em&gt;&lt;/code&gt; without a format argument (&lt;code&gt;-P&lt;/code&gt;, &lt;code&gt;-C&lt;/code&gt;, or &lt;code&gt;-S&lt;/code&gt;).&amp;nbsp; There are many, many things that are a part of the absolute state of a server that we can omit in favor of brevity without sacrificing correctness and we take advantage of several.&lt;/p&gt;
&lt;p&gt;Building Blueprint around the notion of a diff was a non-starter because it would impose an order of operations on the configuration process.&amp;nbsp; To diff between the current and some past state of a server, one could rely on file modification timestamps or explicitly invoke &lt;code&gt;blueprint start-paying-attention&lt;/code&gt;.&amp;nbsp; Either option requires knowing the time at which you began the configuration process.&amp;nbsp; Worse still, the latter requires you to know ahead of time and install Blueprint first.&lt;/p&gt;
&lt;p&gt;When faced with the prospect of figuring out what you did to configure a server, "You should have installed Blueprint before you started," is not the answer I want to give.&amp;nbsp; Blueprint is just as happy given a server you&amp;#8217;ve been tweaking since 2007 as it is on a pristine machine.&amp;nbsp; This is because Blueprint deals in absolutes.&lt;/p&gt;
&lt;p&gt;An image or a giant tarball certainly declare the absolute state of a system but miss the boat entirely on human readability and conciseness.&amp;nbsp; To have our cake and eat it, too, we needed to rise above the abstraction of files and think about packages, the more useful building blocks of Linux systems.&lt;/p&gt;
&lt;h2&gt;Reducing the noise&lt;/h2&gt;
&lt;p&gt;Of course, there are hundreds of packages on any given Linux server and most of them can be assumed and therefore omitted from a blueprint.&amp;nbsp; Packages like &lt;code&gt;coreutils&lt;/code&gt;, &lt;code&gt;grep&lt;/code&gt;, and &lt;code&gt;libc6&lt;/code&gt; are essential to a Linux userland &amp;#8212; Blueprint itself won&amp;#8217;t even work without them.&amp;nbsp; The system package managers like APT and Yum are easy to interrogate and can be asked about exactly these essential packages directly.&amp;nbsp; In addition, packages like &lt;code&gt;ubuntu-standard&lt;/code&gt; and all their dependencies are omitted for the same reasons.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;/etc&lt;/code&gt; is home to thousands of configuration files, the vast majority of which simply don&amp;#8217;t matter to a blueprint.&amp;nbsp; By examining file metadata and comparing the MD5 sums of file content to both the manifest of files in installed packages and a secondary list of files maintained within Blueprint, almost all of those files may be confidently omitted from a blueprint, leaving only new and modified files.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;/usr/local&lt;/code&gt; is a special directory.&amp;nbsp; It is the de facto standard home of programs compiled and installed from source.&amp;nbsp; Sort of.&amp;nbsp; There are plenty of files and plenty of alternative package managers (like Python&amp;#8217;s &lt;code&gt;easy_install&lt;/code&gt; and &lt;code&gt;pip&lt;/code&gt;) that place files in &lt;code&gt;/usr/local&lt;/code&gt;.&amp;nbsp; Blueprint intelligently trims away the fat and manages only the files that are truly important so you can compile from source knowing that Blueprint will faithfully package your build up for later.&lt;/p&gt;
&lt;h2&gt;Sort of a diff, after all&lt;/h2&gt;
&lt;p&gt;Blueprints certainly look and feel like diffs from outside and that&amp;#8217;s to a great degree by design.&amp;nbsp; The noise reduction techniques used to keep blueprints concise and understandable are very much in the spirit of diffing tools but operate outside the notion of points-in-time.&lt;/p&gt;
&lt;p&gt;A blueprint is a bit like a diff between the minimal Linux installation, as best can be introspected from the installation itself, and the current, running state of the system.&amp;nbsp; Create blueprints from your perfectly configured development environment and deploy with confidence.&lt;/p&gt;
&lt;/article&gt;

</atom:content></atom:entry><atom:entry><atom:title type="html">Blueprints in the new AWS CloudFormation
</atom:title><atom:link href="http://rcrowley.org/2011/10/04/aws-cloudformation.html" rel="alternate" /><atom:id>http://rcrowley.org/2011/10/04/aws-cloudformation.html</atom:id><atom:published>2011-12-31T07:53:25Z</atom:published><atom:updated>2011-12-31T07:53:25Z</atom:updated><atom:author><atom:name>Richard Crowley</atom:name></atom:author><atom:content type="html">
&lt;article&gt;
&lt;header&gt;
	&lt;time datetime="2011-10-03" pubdate&gt;2011-10-03&lt;/time&gt;
	&lt;h1&gt;Blueprints in the new AWS CloudFormation&lt;/h1&gt;
&lt;/header&gt;

&lt;p&gt;&lt;em&gt;Cross-posted from the &lt;a href="http://blog.devstructure.com/blueprints-in-the-new-aws-cloudformation"&gt;DevStructure Blog&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Just last week, Amazon Web Services rolled out the &lt;a href="http://aws.typepad.com/aws/2011/09/amazon-linux-ami-production-status-new-features.html"&gt;first production release of the Amazon Linux AMI&lt;/a&gt; and with it some &lt;a href="http://aws.typepad.com/aws/2011/09/powerful-new-features-for-aws-cloudformation.html"&gt;powerful new features for CloudFormation&lt;/a&gt;.&amp;nbsp; There&amp;#8217;s a lot there (like updating stacks and IAM integration) but we at DevStructure are most excited about Application Bootstrapping.&lt;/p&gt;

&lt;p&gt;The new Amazon Linux AMI comes with the &lt;code&gt;aws-cfn-bootstrap&lt;/code&gt; package, which can unpack tarballs, place configuration files, install packages, and restart services at provision time.&amp;nbsp; Sound familiar?&amp;nbsp; That&amp;#8217;s right, this new section of the CloudFormation template language uses the &lt;a href="http://devstructure.github.com/blueprint/blueprint.5.html"&gt;&lt;code&gt;blueprint&lt;/code&gt;(5)&lt;/a&gt; file format!&lt;/p&gt;

&lt;p&gt;Amazon&amp;#8217;s PDF whitepaper, &lt;a href="https://s3.amazonaws.com/cloudformation-examples/BoostrappingApplicationsWithAWSCloudFormation.pdf"&gt;Bootstrapping Applications via AWS CloudFormation&lt;/a&gt;, walks through building a complete stack template by hand.&amp;nbsp; To summarize, you&amp;#8217;ll need to create an &lt;a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/index.html?aws-properties-iam-user.html"&gt;IAM resource&lt;/a&gt; and declare your EC2 instances like this:&lt;/p&gt;

&lt;pre&gt;"Resources": {
  "DemoInstance": {
    &lt;strong&gt;"Metadata": {
      "AWS::CloudFormation::Init": {
        "config": &lt;em&gt;THIS IS WHERE THE BLUEPRINT GOES!&lt;/em&gt;
      }
    }&lt;/strong&gt;,
    "Properties": {
	    "ImageId": {"Fn::FindInMap": [
	      "AWSRegionArch2AMI",
	      {"Ref": "AWS::Region"},
	      {"Fn::FindInMap": [
	        "AWSInstanceType2Arch",
	        {"Ref": "InstanceType"},
	        "Arch"
	      ]}
	    ]},
      "InstanceType": {"Ref": "InstanceType"},
      "KeyName": {"Ref": "KeyName"},
      "SecurityGroups": [{"Ref": "DemoSecurityGroup"}],
      &lt;strong&gt;"UserData" : {"Fn::Base64" : {"Fn::Join" : ["", [
        "#!/bin/sh\n",
        "/opt/aws/bin/cfn-init",
        " -s '", {"Ref" : "AWS::StackName"}, "'",
        " -r 'DemoInstance'",
        " --region '", { "Ref" : "AWS::Region" }, "'",
        " --access-key '", {"Ref": "DemoKey"}, "'",
        " --secret-key '", {"Fn::GetAtt": ["DemoKey", "SecretAccessKey"]}, "'",
        "\n",
        "/opt/aws/bin/cfn-signal",
        " -e $?",
        " '", {"Ref" : "DemoWaitConditionHandle"}, "'",
        "\n"
      ]]}}&lt;/strong&gt;
    },
    "Type": "AWS::EC2::Instance"
  }
}&lt;/pre&gt;

&lt;p&gt;The user-data calls &lt;code&gt;cfn-init&lt;/code&gt; with the newly-generated IAM credentials to fetch and process the metadata, and &lt;code&gt;cfn-signal&lt;/code&gt; to report success or failure via a &lt;a href="http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/index.html?aws-properties-waitcondition.html"&gt;WaitCondition&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Packages managed by Yum, Python&amp;#8217;s &lt;code&gt;easy_install&lt;/code&gt;, and RubyGems plus files and services all work natively within CloudFormation.&amp;nbsp; Source tarballs will work if you upload them someplace and provide the fully-qualified URL.&lt;/p&gt;

&lt;p&gt;Going the other direction, the metadata from an existing CloudFormation template can be loaded into Blueprint by copying out the &lt;code&gt;"config"&lt;/code&gt; document fragment and passing it on standard input to &lt;a href="http://devstructure.github.com/blueprint/blueprint-create.1.html"&gt;&lt;code&gt;blueprint-create&lt;/code&gt;(1)&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Our thanks to the Reto Kramer, Chris Whitaker, and Adam Thomas for making it even easier to deploy blueprints to Amazon EC2.&lt;/p&gt;

&lt;p&gt;Today, we&amp;#8217;re releasing Blueprint 3.1, which includes &lt;a href="https://github.com/devstructure/blueprint/compare/v3.0.8...v3.1.0"&gt;a number of fixes and improvements&lt;/a&gt; but most importantly, understands all of Amazon&amp;#8217;s extensions to the &lt;code&gt;blueprint&lt;/code&gt;(5) format, allowing seamless transition to and from AWS CloudFormation.&amp;nbsp; Get 3.1 from &lt;a href="https://github.com/devstructure/blueprint"&gt;GitHub&lt;/a&gt;, &lt;a href="https://github.com/devstructure/blueprint/wiki/Installing-with-a-package-manager"&gt;DevStructure&amp;#8217;s Debian archive&lt;/a&gt;, or from PyPI.&lt;/p&gt;

&lt;/article&gt;

</atom:content></atom:entry><atom:entry><atom:title type="html">Monads without pretension
</atom:title><atom:link href="http://rcrowley.org/2011/09/21/monads.html" rel="alternate" /><atom:id>http://rcrowley.org/2011/09/21/monads.html</atom:id><atom:published>2011-12-31T07:53:25Z</atom:published><atom:updated>2011-12-31T07:53:25Z</atom:updated><atom:author><atom:name>Richard Crowley</atom:name></atom:author><atom:content type="html">
&lt;article&gt;
&lt;header&gt;
	&lt;time datetime="2011-09-21" pubdate&gt;2011-09-21&lt;/time&gt;
	&lt;h1&gt;Monads without pretension&lt;/h1&gt;
&lt;/header&gt;
&lt;p&gt;The Strange Loop conference this week took a slight detour from its usual celebration of programming languages no one uses to really highlight Lisp in all its abstract glory.&amp;nbsp; Suddenly, Scala seemed like the most mainstream topic of discussion and monads were everywhere except within the understanding of most attendees.&lt;/p&gt;
&lt;p&gt;I read &lt;a href="http://homepages.inf.ed.ac.uk/wadler/topics/monads.html#essence"&gt;The Essence of Functional Programming&lt;/a&gt; for the second or third time on the plane and am not a professor or language author so I'd like to take a stab at explaining monads to folks accustomed to imperative programming languages.&lt;/p&gt;
&lt;p&gt;This is not an exhaustive discussion of monads.&amp;nbsp; This is what I consider to be the prerequisite material that no one bothered to cover in their talks.&amp;nbsp; These are the three monad laws implemented and tested in Python.&lt;/p&gt;
&lt;script src="https://gist.github.com/1232809.js"&gt; &lt;/script&gt;
&lt;p&gt;Such contrived code has no place in a real Python application but now with monads solved your only problem is homoiconic syntax.&amp;nbsp; To take monads to the next level, reimplement &lt;code&gt;M&lt;/code&gt;, &lt;code&gt;unitM&lt;/code&gt;, and &lt;code&gt;bindM&lt;/code&gt; to encapsulate side effects (such as the primitive logging above), propagate error messages and statistics (both as demonstrated in the paper), or perhaps automatically memoize &lt;code&gt;k&lt;/code&gt;.&lt;/p&gt;
&lt;/article&gt;

</atom:content></atom:entry><atom:entry><atom:title type="html">Git Paid, the programmer&amp;#8217;s time tracker
</atom:title><atom:link href="http://rcrowley.org/2011/01/13/gitpaid.html" rel="alternate" /><atom:id>http://rcrowley.org/2011/01/13/gitpaid.html</atom:id><atom:published>2011-12-31T07:53:25Z</atom:published><atom:updated>2011-12-31T07:53:25Z</atom:updated><atom:author><atom:name>Richard Crowley</atom:name></atom:author><atom:content type="html">
&lt;article&gt;
&lt;header&gt;
	&lt;time datetime="2011-01-13" pubdate&gt;2011-01-13&lt;/time&gt;
	&lt;h1&gt;Git Paid, the programmer&amp;#8217;s time tracker&lt;/h1&gt;
&lt;/header&gt;
&lt;p&gt;As part of an effort to learn hands-on about DevStructure&amp;#8217;s potential customers, I&amp;#8217;ve started working with small companies helping with their Puppet infrastructure and general operational polish.&amp;nbsp; It became quickly clear to me that tracking my time in TextMate was a losing proposition so I took a late evening to whip up Git Paid.&lt;/p&gt;
&lt;p&gt;Git Paid includes three programs.&amp;nbsp; &lt;a href="http://rcrowley.github.com/gitpaid/gpbegin.1.html"&gt;&lt;code&gt;gpbegin&lt;/code&gt;(1)&lt;/a&gt; and &lt;a href="http://rcrowley.github.com/gitpaid/gpend.1.html"&gt;&lt;code&gt;gpend&lt;/code&gt;(1)&lt;/a&gt; mark the beginning and end of a work session by making commits to a Git repository.&amp;nbsp; By default, this repository is &lt;code&gt;~/.gitpaid&lt;/code&gt; but it can be overridden by the &lt;code&gt;GITPAID_REPO&lt;/code&gt; environment variable or the &lt;code&gt;-r&lt;/code&gt; option.&amp;nbsp; Likewise the default branch is &lt;code&gt;master&lt;/code&gt; but it can be overridden by the &lt;code&gt;GITPAID_BRANCH&lt;/code&gt; environment variable or the &lt;code&gt;-b&lt;/code&gt; option.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://rcrowley.github.com/gitpaid/gpinvoice.1.html"&gt;&lt;code&gt;gpinvoice&lt;/code&gt;(1)&lt;/a&gt; tabulates the time spent in all work sessions and generates a nice work summary, which includes all the commit messages given to &lt;code&gt;gpbegin&lt;/code&gt;(1) and &lt;code&gt;gpend&lt;/code&gt;(1) with the &lt;code&gt;-m&lt;/code&gt; option.&amp;nbsp; It respects that not all hours are billable so the &lt;code&gt;-t&lt;/code&gt; option to &lt;code&gt;gpend&lt;/code&gt;(1) will cause &lt;code&gt;gpinvoice&lt;/code&gt;(1) to count an arbitrary amount of time for that session.&amp;nbsp; For example:&lt;/p&gt;
&lt;pre&gt;
$ gpbegin -b client-name
$ ...
$ gpend -b client-name -m "Shaved the yak."
$ gpbegin -b client-name
$ gpend -b client-name -t 1:45 -m "Faked the time."
$ gpinvoice -b client-name
# Invoice

Thu Jan  6 18:27:32 UTC 2011
from client-name branch of /home/vagrant/.gitpaid

## Work log

Began: Thu, 6 Jan 2011 16:17:29 +0000

&amp;gt; Shaved the yak.

Ended: Thu, 6 Jan 2011 17:47:42 +0000
Billed time: 1:30

Began: Thu, 6 Jan 2011 18:27:23 +0000

&amp;gt; Faked the time.

Ended: Thu, 6 Jan 2011 18:27:25 +0000
Billed time (adjusted): 1:45

## Summary

Total billed time: 3:15
&lt;/pre&gt;
&lt;p&gt;&lt;big&gt;&lt;a href="https://github.com/rcrowley/gitpaid"&gt;Git Paid on GitHub&lt;/a&gt;&lt;/big&gt;&lt;/p&gt;
&lt;/article&gt;

</atom:content></atom:entry></atom:feed>

