<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="/feed.xml" rel="self" type="application/atom+xml" /><link href="/" rel="alternate" type="text/html" /><updated>2020-02-28T07:16:01+00:00</updated><id>/feed.xml</id><title type="html">Matt Whiteley</title><subtitle>Infrequent thoughts by an aspiring full-time camper and current engineer</subtitle><entry><title type="html">IAM Policy For Kitchen EC2</title><link href="/2014/10/25/iam-policy-for-kitchen-ec2.html" rel="alternate" type="text/html" title="IAM Policy For Kitchen EC2" /><published>2014-10-25T00:00:00+00:00</published><updated>2014-10-25T00:00:00+00:00</updated><id>/2014/10/25/iam-policy-for-kitchen-ec2</id><content type="html" xml:base="/2014/10/25/iam-policy-for-kitchen-ec2.html">&lt;p&gt;&lt;a href=&quot;http://aws.amazon.com/iam/&quot;&gt;IAM&lt;/a&gt; policies can be tricky but that is certainly not a reason to use your AWS root account credentials all over the place. In the &lt;a href=&quot;https://github.com/whiteley/test-kitchen-berks-api&quot;&gt;test-kitchen-berks-api&lt;/a&gt; example I created a new user and granted it permissions for the &lt;a href=&quot;https://github.com/test-kitchen/kitchen-ec2&quot;&gt;kitchen-ec2&lt;/a&gt; tests. This requires being much more explicit than authorizing &lt;code&gt;ec2:RunInstances&lt;/code&gt;. The user needs to be able to tag the running instances and to prevent complications we limit the instance termination permissions.&lt;/p&gt;
&lt;p&gt;To create a working policy, you'll want to use the &lt;a href=&quot;http://awspolicygen.s3.amazonaws.com/policygen.html&quot;&gt;iam-policy-generator&lt;/a&gt; and the &lt;a href=&quot;https://policysim.aws.amazon.com/&quot;&gt;iam-policy-simulator&lt;/a&gt;. The permissions required for this test are very well explained on the &lt;a href=&quot;http://blogs.aws.amazon.com/security/post/Tx2KPWZJJ4S26H6/Demystifying-EC2-Resource-Level-Permissions&quot;&gt;AWS Security Blog&lt;/a&gt;.&lt;/p&gt;
&lt;script src=&quot;https://gist.github.com/whiteley/c1e2cd106b70c2243ce0.js&quot;&gt; &lt;/script&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;iam-usercreate -u test-kitchen-berks-api -k&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;iam-useruploadpolicy -f iam.json -p test-kitchen-berks-api-instances -u test-kitchen-berks-api&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It should be noted that the restrictions in this policy are not &lt;em&gt;secure&lt;/em&gt; in that they allow the tagging of all resources in the account and do not limit tags to instances created by this user. To force a tag onto a newly booted instance it would need to be applied to the AMI.&lt;/p&gt;</content><author><name></name></author><summary type="html">IAM policies can be tricky but that is certainly not a reason to use your AWS root account credentials all over the place. In the test-kitchen-berks-api example I created a new user and granted it permissions for the kitchen-ec2 tests. This requires being much more explicit than authorizing ec2:RunInstances. The user needs to be able to tag the running instances and to prevent complications we limit the instance termination permissions.</summary></entry><entry><title type="html">Test Kitchen on Travis CI</title><link href="/2014/10/23/test-kitchen-on-travis-ci.html" rel="alternate" type="text/html" title="Test Kitchen on Travis CI" /><published>2014-10-23T00:00:00+00:00</published><updated>2014-10-23T00:00:00+00:00</updated><id>/2014/10/23/test-kitchen-on-travis-ci</id><content type="html" xml:base="/2014/10/23/test-kitchen-on-travis-ci.html">&lt;p&gt;The world of &lt;a href=&quot;https://www.getchef.com/&quot;&gt;Chef&lt;/a&gt; cookbook development and testing has improved a ton in the last year or two. &lt;a href=&quot;https://www.engineyard.com/&quot;&gt;We&lt;/a&gt; can be far more confident in our configuration quality since we run them via &lt;a href=&quot;http://kitchen.ci/&quot;&gt;Test Kitchen&lt;/a&gt; using our internal custom AMIs.&lt;/p&gt;
&lt;p&gt;At this point, &lt;a href=&quot;http://berkshelf.com/&quot;&gt;Berkshelf&lt;/a&gt; can't directly index cookbooks hosted in chef-server and a &lt;a href=&quot;https://github.com/berkshelf/berkshelf-api&quot;&gt;Berkshelf API&lt;/a&gt; server is required. We had need for multiple configurations during development and I wanted to save every engineer on the team from running their own &lt;a href=&quot;https://github.com/berkshelf/berkshelf-api&quot;&gt;API server&lt;/a&gt; locally.&lt;/p&gt;
&lt;p&gt;We use &lt;a href=&quot;https://travis-ci.org/&quot;&gt;Travis CI&lt;/a&gt; to test our cookbooks and why not have the server running right where the information is needed. To simplify this &lt;a href=&quot;https://github.com/whiteley/test-kitchen-berks-api&quot;&gt;example&lt;/a&gt;, I replaced hosted chef in the &lt;a href=&quot;https://github.com/whiteley/test-kitchen-berks-api/blob/master/config.json&quot;&gt;&lt;code&gt;config.json&lt;/code&gt;&lt;/a&gt; with the &lt;a href=&quot;https://supermarket.getchef.com/&quot;&gt;Supermarket&lt;/a&gt; configuration but this would work with any of the supported endpoints.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;ENV['BERKSHELF_API_PATH']&lt;/code&gt; is set to the root of the repository to override the default of &lt;code&gt;~/.berkshelf/api-server&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Travis encrypted environment variables are provided for &lt;code&gt;aws_access_key_id&lt;/code&gt; and &lt;code&gt;aws_secret_access_key&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;The SSH private key is added via &lt;code&gt;travis encrypt-file&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Cache for APT and Bundler are both enabled to speed up test runs&lt;/li&gt;
&lt;li&gt;Package containing &lt;code&gt;libarchive.so&lt;/code&gt; installed for &lt;code&gt;berks-api&lt;/code&gt; dependency&lt;/li&gt;
&lt;li&gt;AWS resource tags are applied to the EC2 instances to help identify them&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;After figuring out the Bundler cache hiccups, I ran into an &lt;a href=&quot;https://github.com/test-kitchen/test-kitchen/issues/429&quot;&gt;issue&lt;/a&gt; that one of my &lt;a href=&quot;http://ryansouza.net/&quot;&gt;coworkers&lt;/a&gt; had reported earlier this year. As pointed out there, uploading compressed tarballs or switching to &lt;code&gt;sftp&lt;/code&gt; may be the best course of action but for now &lt;a href=&quot;https://github.com/test-kitchen/test-kitchen/pull/530&quot;&gt;removing the empty directories&lt;/a&gt; results in a &lt;strong&gt;massive&lt;/strong&gt; performance improvement.&lt;/p&gt;
&lt;p&gt;The trickiest part of this test was getting the IAM configuration correct, so I'll explain that in another post.&lt;/p&gt;</content><author><name></name></author><summary type="html">The world of Chef cookbook development and testing has improved a ton in the last year or two. We can be far more confident in our configuration quality since we run them via Test Kitchen using our internal custom AMIs.</summary></entry><entry><title type="html">Travis Makes a Better Launchpad</title><link href="/2014/08/24/travis-makes-a-better-launchpad.html" rel="alternate" type="text/html" title="Travis Makes a Better Launchpad" /><published>2014-08-24T00:00:00+00:00</published><updated>2014-08-24T00:00:00+00:00</updated><id>/2014/08/24/travis-makes-a-better-launchpad</id><content type="html" xml:base="/2014/08/24/travis-makes-a-better-launchpad.html">&lt;p&gt;At &lt;a href=&quot;https://www.engineyard.com/&quot;&gt;work&lt;/a&gt; we have a love/hate relationship with Launchpad ... we can turn Debian source packages into APT repositories but only if we jump through the hoops just right. Discussing the many limitations of Launchpad is a black hole, so I just want to share an &lt;a href=&quot;https://github.com/whiteley/hello&quot;&gt;experiment&lt;/a&gt; I completed recently. Most Debian packaging tutorials start with the &lt;a href=&quot;http://www.gnu.org/software/hello/&quot;&gt;GNU Hello&lt;/a&gt; program, so I used that for consistency.&lt;/p&gt;
&lt;p&gt;I first started with a list of requirements:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Store packaging files in git&lt;/li&gt;
&lt;li&gt;Build packages for multiple Ubuntu releases&lt;/li&gt;
&lt;li&gt;Create APT repositories&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;We use (and love) &lt;a href=&quot;https://travis-ci.org/&quot;&gt;Travis CI&lt;/a&gt; a ton and it seemed like the perfect place to iterate on packages. With the typical build environment already available, the only extra tools I used were:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;https://github.com/krobertson/deb-s3&quot;&gt;&lt;code&gt;deb-s3&lt;/code&gt;&lt;/a&gt; for creating and managing APT repositories in the cloud without rsyncing local copies of everything&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://pbuilder.alioth.debian.org/&quot;&gt;&lt;code&gt;pbuilder&lt;/code&gt;&lt;/a&gt; to isolate the package building environment&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The contents of the &lt;a href=&quot;https://github.com/whiteley/hello/tree/master/hello/debian&quot;&gt;&lt;code&gt;hello/debian&lt;/code&gt;&lt;/a&gt; directory will be straightforward to anyone familiar with Debian packaging and all of the interesting bits are contained in the &lt;a href=&quot;https://github.com/whiteley/hello/blob/master/.travis.yml&quot;&gt;&lt;code&gt;.travis.yml&lt;/code&gt;&lt;/a&gt; file.&lt;/p&gt;
&lt;p&gt;The resulting repository is hosted on S3 and can be added to your system with the following APT source:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;deb https://s3.amazonaws.com/s3pa-mwhiteley-hello precise main
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Next steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Use &lt;a href=&quot;https://wiki.debian.org/sbuild&quot;&gt;&lt;code&gt;sbuild&lt;/code&gt;&lt;/a&gt; or similar to solve the multiple distributions issue&lt;/li&gt;
&lt;li&gt;Inject the APT repository into the build sources so that dependent packages can be created&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://wiki.debian.org/SecureApt&quot;&gt;Sign&lt;/a&gt; the packages and repository catalogs&lt;/li&gt;
&lt;li&gt;Create a community index for GitHub repositories and S3 buckets&lt;/li&gt;
&lt;/ol&gt;</content><author><name></name></author><summary type="html">At work we have a love/hate relationship with Launchpad ... we can turn Debian source packages into APT repositories but only if we jump through the hoops just right. Discussing the many limitations of Launchpad is a black hole, so I just want to share an experiment I completed recently. Most Debian packaging tutorials start with the GNU Hello program, so I used that for consistency.</summary></entry><entry><title type="html">Docker on i386</title><link href="/linux-containers/2013/08/31/docker-on-i386.html" rel="alternate" type="text/html" title="Docker on i386" /><published>2013-08-31T00:00:00+00:00</published><updated>2013-08-31T00:00:00+00:00</updated><id>/linux-containers/2013/08/31/docker-on-i386</id><content type="html" xml:base="/linux-containers/2013/08/31/docker-on-i386.html">&lt;p&gt;I have had a much outdated but heroically stable Dell PowerEdge 2550 for many
years now. It's great to have a place to work on personal development projects
without dealing with hourly costs etc, but sometimes the lack of performance can
really be an issue. A lot of the work I've done in the past few years has been
centered around virtualization and so the machine has collected more dust than
it once did. I've been doing some work with &lt;a href=&quot;http://www.docker.io/&quot;&gt;Docker&lt;/a&gt; recently and got
excited that I could deploy some of my projects on this machine again. Somehow,
I hadn't ever noticed that &lt;a href=&quot;http://www.docker.io/&quot;&gt;Docker&lt;/a&gt; is only supported on &lt;code&gt;amd64&lt;/code&gt; at this
point.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&amp;quot;focusing on amd64 for now&amp;quot;&lt;/li&gt;
&lt;li&gt;&amp;quot;it &lt;em&gt;should&lt;/em&gt; work fine on 32-bit&amp;quot;&lt;/li&gt;
&lt;li&gt;&amp;quot;you just need new images and a 32-bit docker binary&amp;quot;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After some more searching I found that it wasn't incompatible but only
&lt;a href=&quot;https://github.com/dotcloud/docker/issues/136&quot;&gt;unsupported&lt;/a&gt;. With comments like these, I had a new yak to
shave.&lt;/p&gt;
&lt;p&gt;The server started with a fully updated Ubuntu 13.04 install. I originally tried
to use the available Go &lt;a href=&quot;https://launchpad.net/ubuntu/raring/i386/golang/2:1.0.2-2&quot;&gt;deb packages&lt;/a&gt; but they were too old
(&lt;code&gt;1.0.2&lt;/code&gt;) for &lt;a href=&quot;http://www.docker.io/&quot;&gt;Docker&lt;/a&gt; which requires at least &lt;code&gt;1.1&lt;/code&gt;. Next, I tried the
&lt;a href=&quot;https://code.google.com/p/go/downloads/list&quot;&gt;binary distribution&lt;/a&gt; but that was compiled with SSE2
optimizations enabled. I would have to build Go from &lt;a href=&quot;http://golang.org/doc/install/source&quot;&gt;source&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Building Go doesn't require a lot of prerequisites, but we need a
compiler and mercurial to clone the sources.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;build-essential mercurial&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Not only is this server 32-bit, but it's old enough to lack support for SSE2.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;GO386&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;387&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Clone the Go sources.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;hg clone &lt;span class=&quot;nt&quot;&gt;-u&lt;/span&gt; release https://code.google.com/p/go /home/mwhiteley/p/go
&lt;span class=&quot;c&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Build Go and add it to our path.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;pushd&lt;/span&gt; /home/mwhiteley/p/go/src
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;./all.bash
&lt;span class=&quot;c&quot;&gt;...
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;popd&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;GOPATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/home/mwhiteley/go
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$GOPATH&lt;/span&gt;/bin:&lt;span class=&quot;nv&quot;&gt;$PATH&lt;/span&gt;:/home/mwhiteley/p/go/bin
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;go version
&lt;span class=&quot;go&quot;&gt;go version go1.1.2 linux/386&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;For Docker, we need a few more prerequisites such as the Linux Containers
userspace tools and a kernel module for the Advanced Multi Layered Unification
Filesystem.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;apt-get &lt;span class=&quot;nt&quot;&gt;-y&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;install &lt;/span&gt;git linux-image-extra-&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;uname&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-r&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt; lxc xz-utils&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Clone the Docker sources.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;git clone dotcloud/docker &lt;span class=&quot;nv&quot;&gt;$GOPATH&lt;/span&gt;/src/github.com/dotcloud/docker
&lt;span class=&quot;c&quot;&gt;...&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Enable and build a 32-bit Docker.&lt;/p&gt;
&lt;script src=&quot;https://gist.github.com/6400552.js?file=server.go.diff&quot;&gt; &lt;/script&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;pushd&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$GOPATH&lt;/span&gt;/src/github.com/dotcloud/docker
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;curl https://gist.github.com/whiteley/6400552/raw/server.go.diff | git apply -
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;go get &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; github.com/dotcloud/docker/...
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;go &lt;span class=&quot;nb&quot;&gt;install&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-v&lt;/span&gt; github.com/dotcloud/docker/...
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;popd&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;docker version
&lt;span class=&quot;go&quot;&gt;Go version (client): go1.1.2
Go version (server): go1.1.2
Last stable version: 0.6.1&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;A base image is just the contents of a minimal file system and we can create one
with &lt;a href=&quot;https://wiki.debian.org/Debootstrap&quot;&gt;debootstrap&lt;/a&gt;. The &lt;code&gt;/etc/apt/sources.list&lt;/code&gt; file will not
contain anything except the single install repository.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;debootstrap raring /tmp/rootfs
&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;d &lt;span class=&quot;k&quot;&gt;in &lt;/span&gt;raring raring-security raring-updates raring-backports
&lt;span class=&quot;gp&quot;&gt;for&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;do &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;deb http://archive.ubuntu.com/ubuntu &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; main universe multiverse&quot;&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;for&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;done&lt;/span&gt; | &lt;span class=&quot;nb&quot;&gt;sudo tee&lt;/span&gt; /tmp/rootfs/etc/apt/sources.list
&lt;span class=&quot;go&quot;&gt;deb http://archive.ubuntu.com/ubuntu raring main universe multiverse
deb http://archive.ubuntu.com/ubuntu raring-security main universe multiverse
deb http://archive.ubuntu.com/ubuntu raring-updates main universe multiverse
deb http://archive.ubuntu.com/ubuntu raring-backports main universe multiverse
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo tar &lt;/span&gt;czf /home/mwhiteley/p/raring_base32_rootfs.tgz &lt;span class=&quot;nt&quot;&gt;-C&lt;/span&gt; /tmp/rootfs .&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;We can now create a &lt;code&gt;docker&lt;/code&gt; group and start the daemon. The group members will
have access to connect directly to the daemon running as root and potentially
gain root access on the host. Make sure to read the &lt;a href=&quot;http://docs.docker.io/en/latest/use/basics/#why-sudo&quot;&gt;instructions&lt;/a&gt;
carefully and only do this on a development machine.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;addgroup docker
&lt;span class=&quot;go&quot;&gt;Adding group `docker' (GID 1001) ...
Done.
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;addgroup mwhiteley docker
&lt;span class=&quot;go&quot;&gt;Adding user `mwhiteley' to group `docker' ...
Adding user mwhiteley to group docker
Done.
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;sudo &lt;/span&gt;docker &lt;span class=&quot;nt&quot;&gt;-d&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Loading containers: done.
2013/08/31 17:25:41 WARNING: Your kernel does not support cgroup swap limit.
2013/08/31 17:25:41 Listening for HTTP on /var/run/docker.sock (unix)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Now, in another terminal (a new login shell so your group membership takes
effect), we can import the base image.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; /home/mwhiteley/raring_base32_rootfs.tgz | docker import - mwhiteley/base32
&lt;span class=&quot;go&quot;&gt;c755b018548a
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;docker images
&lt;span class=&quot;go&quot;&gt;REPOSITORY          TAG                 ID                  CREATED             SIZE
mwhiteley/base32    latest              c755b018548a        21 minutes ago      187.4 MB (virtual 187.4 MB)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Run a simple test to make sure that everything seems operational.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;docker run c755b018548a &lt;span class=&quot;nb&quot;&gt;env&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;HOME=/
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
container=lxc
HOSTNAME=d60803fb36fe&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Create a Dockerfile and build an image&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cat&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOP&lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;' &amp;gt;/home/mwhiteley/p/docker/chef/Dockerfile
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;heredoc&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;FROM c755b018548a
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;heredoc&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;MAINTAINER Matt Whiteley &amp;lt;mattwhiteley@gmail.com&amp;gt;
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;heredoc&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;RUN apt-get update
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;heredoc&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;RUN apt-get -y install curl git ruby1.9.3
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;heredoc&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;sh&quot;&gt;RUN curl -L https://www.opscode.com/chef/install.sh | bash
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;heredoc&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;no&quot;&gt;EOP
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;docker build /home/mwhiteley/p/docker/chef
&lt;span class=&quot;c&quot;&gt; ...
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt; ---&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;b8d729360f11
&lt;span class=&quot;go&quot;&gt;Successfully built b8d729360f11
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;docker images
&lt;span class=&quot;go&quot;&gt;REPOSITORY          TAG                 ID                  CREATED             SIZE
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;&amp;lt;none&amp;gt;&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;              &lt;/span&gt;&amp;lt;none&amp;gt;              b8d729360f11        19 seconds ago      88.5 MB &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;virtual 710.8 MB&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;mwhiteley/base32    latest              c755b018548a        35 minutes ago      187.4 MB (virtual 187.4 MB)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Wow, look at the size of that thing! Evidently the &lt;code&gt;ruby1.9.3&lt;/code&gt; package in Ubuntu
pulls in a ton of dependencies that we won't be needing and a different route
for Ruby will save us a ton of space. For now, let's just make sure it all
worked.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;docker run b8d729360f11 chef-solo &lt;span class=&quot;nt&quot;&gt;--version&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Chef: 11.6.0&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Awesome, &lt;a href=&quot;http://www.docker.io/&quot;&gt;Docker&lt;/a&gt; running on my 866MHz Pentium III! Now, on to make some
better images for test environments.&lt;/p&gt;</content><author><name></name></author><category term="docker" /><category term="ubuntu" /><summary type="html">I have had a much outdated but heroically stable Dell PowerEdge 2550 for many years now. It's great to have a place to work on personal development projects without dealing with hourly costs etc, but sometimes the lack of performance can really be an issue. A lot of the work I've done in the past few years has been centered around virtualization and so the machine has collected more dust than it once did. I've been doing some work with Docker recently and got excited that I could deploy some of my projects on this machine again. Somehow, I hadn't ever noticed that Docker is only supported on amd64 at this point.</summary></entry><entry><title type="html">Packer Definition for Ubuntu Raring on VMware Fusion</title><link href="/virtualization/2013/07/26/packer-raring-fusion.html" rel="alternate" type="text/html" title="Packer Definition for Ubuntu Raring on VMware Fusion" /><published>2013-07-26T00:00:00+00:00</published><updated>2013-07-26T00:00:00+00:00</updated><id>/virtualization/2013/07/26/packer-raring-fusion</id><content type="html" xml:base="/virtualization/2013/07/26/packer-raring-fusion.html">&lt;p&gt;I needed a virtual machine on my laptop to use with &lt;a href=&quot;https://github.com/clalancette/oz/wiki&quot;&gt;Oz&lt;/a&gt; for offline
testing. Since &lt;a href=&quot;https://github.com/clalancette/oz/wiki&quot;&gt;Oz&lt;/a&gt; uses &lt;em&gt;kvm&lt;/em&gt; to install the guest image, I would need
nested hypervisor support. Virtualbox doesn't provide this, but VMware Fusion
does.&lt;/p&gt;
&lt;p&gt;Another requirement for any development testing cycle using virtual machines is
&lt;a href=&quot;http://www.vagrantup.com/&quot;&gt;Vagrant&lt;/a&gt; and so the first thing I needed was the &lt;a href=&quot;http://www.vagrantup.com/vmware&quot;&gt;Vagrant VMware
Provider&lt;/a&gt;. Step 2 was setting up a base box with the required
environment.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.hashicorp.com/&quot;&gt;Hashicorp&lt;/a&gt;, the people behind vagrant, have a new product out
called &lt;a href=&quot;http://www.packer.io/&quot;&gt;Packer&lt;/a&gt; that I used to create the base box. &lt;a href=&quot;http://www.packer.io/&quot;&gt;Packer&lt;/a&gt;
could actually be used to replace &lt;a href=&quot;https://github.com/clalancette/oz/wiki&quot;&gt;Oz&lt;/a&gt; in a lot of situations, but this is
for a larger project that relies on a number of &lt;a href=&quot;https://github.com/clalancette/oz/wiki&quot;&gt;Oz&lt;/a&gt; specifics. You can
grab my &lt;a href=&quot;https://github.com/whiteley/packer-raring-fusion&quot;&gt;packer-raring-fusion&lt;/a&gt; definition which sets up
a small image with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Installs VMware tools with some needed patches for 3.8 kernels&lt;/li&gt;
&lt;li&gt;Installs Vagrant insecure public key&lt;/li&gt;
&lt;li&gt;Downloads Packer and unzips in bin/&lt;/li&gt;
&lt;li&gt;Enables VHV for nested hypervisors on the guest&lt;/li&gt;
&lt;li&gt;Sets Vagrant User password to 'packer'&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;or the &lt;a href=&quot;https://mwhiteley-vagrant-boxes.s3.amazonaws.com/packer_vmware_vmware.box&quot;&gt;packaged base box&lt;/a&gt; (650MB).&lt;/p&gt;</content><author><name></name></author><category term="packer" /><category term="vmware-fusion" /><category term="ubuntu" /><summary type="html">I needed a virtual machine on my laptop to use with Oz for offline testing. Since Oz uses kvm to install the guest image, I would need nested hypervisor support. Virtualbox doesn't provide this, but VMware Fusion does.</summary></entry><entry><title type="html">My Adventures with Jekyll</title><link href="/jekyll/update/2013/07/23/my-adventures-with-jekyll.html" rel="alternate" type="text/html" title="My Adventures with Jekyll" /><published>2013-07-23T13:45:32+00:00</published><updated>2013-07-23T13:45:32+00:00</updated><id>/jekyll/update/2013/07/23/my-adventures-with-jekyll</id><content type="html" xml:base="/jekyll/update/2013/07/23/my-adventures-with-jekyll.html">&lt;p&gt;I've decided to give Jekyll a try for posting some of my snippets of code,
thoughts, and other work. This post is just here to get me started.&lt;/p&gt;
&lt;p&gt;A random trick I pulled off today, that I'm sure to forget:&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;brew list emacs | xargs &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    pax &lt;span class=&quot;nt&quot;&gt;-w&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-z&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-s&lt;/span&gt; ,&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;brew &lt;span class=&quot;nt&quot;&gt;--prefix&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;,, &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; ~/Downloads/emacs-&lt;span class=&quot;si&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;stat&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'%Sc'&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-t&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;'%Y%m%d'&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;-brewed&lt;/span&gt;.tgz&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;This created an archive of the &lt;a href=&quot;http://mxcl.github.io/homebrew/&quot;&gt;Homebrew&lt;/a&gt; installed emacs package and
I could then try to install it fresh from the git repo but restore the working
version if it failed.&lt;/p&gt;
&lt;p&gt;I'm sure that I will need this link to the &lt;a href=&quot;http://jekyllrb.com&quot;&gt;Jekyll docs&lt;/a&gt; in the near
future and maybe at some point, I'll even have a commit in &lt;a href=&quot;https://github.com/mojombo/jekyll&quot;&gt;Jekyll's GitHub
repo&lt;/a&gt;.&lt;/p&gt;</content><author><name></name></author><summary type="html">I've decided to give Jekyll a try for posting some of my snippets of code, thoughts, and other work. This post is just here to get me started.</summary></entry><entry><title type="html">Crawl EC2 meta-data and output JSON</title><link href="/virtualization/2013/02/23/golang-ec2-metadata.html" rel="alternate" type="text/html" title="Crawl EC2 meta-data and output JSON" /><published>2013-02-23T00:00:00+00:00</published><updated>2013-02-23T00:00:00+00:00</updated><id>/virtualization/2013/02/23/golang-ec2-metadata</id><content type="html" xml:base="/virtualization/2013/02/23/golang-ec2-metadata.html">&lt;p&gt;Last week, while debugging an issue with some EC2 instances at work, I wanted
to quickly analyze and compare some of the instance meta-data. Our typical
interaction with this is in Chef as learned by Ohai, but I wanted something
standalone. I keep wanting to play with &lt;a href=&quot;http://golang.org/&quot;&gt;Go&lt;/a&gt; more, and this seemed like
a fun Sunday morning hack (translation: homework avoidance).&lt;/p&gt;
&lt;script src=&quot;https://gist.github.com/4751059.js&quot;&gt; &lt;/script&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;setup Go
&lt;span class=&quot;go&quot;&gt;wget -P /tmp http://go.googlecode.com/files/go1.0.3.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf /tmp/go1.0.3.linux-amd64.tar.gz
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;export PATH=$&lt;/span&gt;PATH:/usr/local/go/bin
&lt;span class=&quot;go&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;grab the &lt;span class=&quot;nb&quot;&gt;source &lt;/span&gt;file
&lt;span class=&quot;go&quot;&gt;wget https://gist.github.com/whiteley/4751059/raw/md.go

&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;print meta-data
&lt;span class=&quot;go&quot;&gt;go run md.go
{&quot;ami-id&quot;:&quot;ami-aa941e9a&quot;,&quot;ami-launch-index&quot;:&quot;0&quot;,&quot;ami-manifest-path&quot;:&quot;ubuntu-us-west-2/images/ubuntu-precise-12.04-amd64-server-20130204.manifest.xml&quot;,&quot;block-device-mapping&quot;:{&quot;ami&quot;:&quot;sda1&quot;,&quot;ephemeral0&quot;:&quot;sda2&quot;,&quot;root&quot;:&quot;/dev/sda1&quot;,&quot;swap&quot;:&quot;sda3&quot;}, …

&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pretty print meta-data
&lt;span class=&quot;go&quot;&gt;go run md.go --prettyprint
{
  &quot;ami-id&quot;: &quot;ami-aa941e9a&quot;,
  &quot;ami-launch-index&quot;: &quot;0&quot;,
  &quot;ami-manifest-path&quot;: &quot;ubuntu-us-west-2/images/ubuntu-precise-12.04-amd64-server-20130204.manifest.xml&quot;,
  &quot;block-device-mapping&quot;: {
    &quot;ami&quot;: &quot;sda1&quot;,
    &quot;ephemeral0&quot;: &quot;sda2&quot;,
    &quot;root&quot;: &quot;/dev/sda1&quot;,
    &quot;swap&quot;: &quot;sda3&quot;
  },
  …
}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;&lt;a href=&quot;http://golang.org/&quot;&gt;Go&lt;/a&gt; has a number of exciting features, but the most interesting in this
experiment is possibly the compilation to an executable binary. I can now
quickly grab this file on a running instance and inspect the meta-data easily
without installing &lt;a href=&quot;http://golang.org/&quot;&gt;Go&lt;/a&gt; or anything else.&lt;/p&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;grab the binary
&lt;span class=&quot;go&quot;&gt;wget http://go-mwhiteley.s3.amazonaws.com/md &amp;amp;&amp;amp; chmod 0755 md
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;run
&lt;span class=&quot;go&quot;&gt;./md&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Next up, I plan to investigate &lt;a href=&quot;http://www.rust-lang.org/&quot;&gt;Rust&lt;/a&gt;.&lt;/p&gt;</content><author><name></name></author><category term="ubuntu" /><category term="ec2" /><category term="golang" /><summary type="html">Last week, while debugging an issue with some EC2 instances at work, I wanted to quickly analyze and compare some of the instance meta-data. Our typical interaction with this is in Chef as learned by Ohai, but I wanted something standalone. I keep wanting to play with Go more, and this seemed like a fun Sunday morning hack (translation: homework avoidance).</summary></entry><entry><title type="html">EC2 Launching</title><link href="/virtualization/2012/12/13/ec2-launch.html" rel="alternate" type="text/html" title="EC2 Launching" /><published>2012-12-13T00:00:00+00:00</published><updated>2012-12-13T00:00:00+00:00</updated><id>/virtualization/2012/12/13/ec2-launch</id><content type="html" xml:base="/virtualization/2012/12/13/ec2-launch.html">&lt;p&gt;Everyday I launch a lot of EC2 instances as part of a controlled process:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;deploying an application in the &lt;a href=&quot;http://www.engineyard.com/products/cloud&quot;&gt;Engine Yard Cloud&lt;/a&gt; Dashboard&lt;/li&gt;
&lt;li&gt;using the &lt;a href=&quot;http://wiki.opscode.com/display/chef/Launch+Cloud+Instances+with+Knife&quot;&gt;EC2 plugin for the knife&lt;/a&gt; cli tool for &lt;a href=&quot;http://www.opscode.com/chef/&quot;&gt;Opscode Chef&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I also wind up running a lot of ad-hoc instances for quick experiments. This
required a frustrating multi-step dance:&lt;/p&gt;
&lt;ol start=&quot;0&quot;&gt;
&lt;li&gt;&lt;code&gt;ec2-run-instances&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;highlight and copy the Instance ID&lt;/li&gt;
&lt;li&gt;wait long enough that networking is provisioned&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ec2-describe-instances&lt;/code&gt; with the pasted id&lt;/li&gt;
&lt;li&gt;highlight and copy the &lt;em&gt;Public DNS&lt;/em&gt; attribute&lt;/li&gt;
&lt;li&gt;wait long enough that sshd will be available before the connection times out&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ssh -oForwardAgent=yes -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -i ~/.ec2/keypair.pem&lt;/code&gt; with the pasted hostname&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Last week I got to the breaking point during one of these cycles and hacked
together a &lt;a href=&quot;https://gist.github.com/4282468&quot;&gt;script&lt;/a&gt; to launch and log into these one-off instances. The
helpful &lt;code&gt;tcp_test_ssh&lt;/code&gt; and &lt;code&gt;wait_for_sshd&lt;/code&gt; methods are grabbed mostly verbatim
from the previously mentioned &lt;a href=&quot;http://wiki.opscode.com/display/chef/Launch+Cloud+Instances+with+Knife&quot;&gt;knife-ec2&lt;/a&gt; plugin.&lt;/p&gt;
&lt;script src=&quot;https://gist.github.com/4282468.js&quot;&gt; &lt;/script&gt;</content><author><name></name></author><category term="ec2" /><category term="chef" /><category term="eycloud" /><summary type="html">Everyday I launch a lot of EC2 instances as part of a controlled process:</summary></entry><entry><title type="html">Checking Upstart configuration syntax</title><link href="/scripts/2012/12/11/dbus-init-checkconf.html" rel="alternate" type="text/html" title="Checking Upstart configuration syntax" /><published>2012-12-11T00:00:00+00:00</published><updated>2012-12-11T00:00:00+00:00</updated><id>/scripts/2012/12/11/dbus-init-checkconf</id><content type="html" xml:base="/scripts/2012/12/11/dbus-init-checkconf.html">&lt;p&gt;There is a handy tool &lt;code&gt;init-checkconf&lt;/code&gt; you can use to validate your freshly
written Upstart configs. If you're trying to use this on an Ubuntu server
install or similar environment, you might have run into this issue:&lt;/p&gt;
&lt;script src=&quot;https://gist.github.com/6073365.js&quot;&gt; &lt;/script&gt;
&lt;p&gt;The problem is that &lt;code&gt;init-checkconf&lt;/code&gt; is assuming you have a &lt;code&gt;dbus-daemon&lt;/code&gt;
running and the related environment variables set to find it. A graphical login
session generally will start a dbus session for the user, but on a server
install you are most likely running without one.&lt;/p&gt;
&lt;p&gt;I wrote a quick &lt;a href=&quot;https://gist.github.com/4256487&quot;&gt;script&lt;/a&gt; for a coworker that wraps &lt;code&gt;init-checkconf&lt;/code&gt; with
a temporary dbus session. It might come in handy for someone else as well.&lt;/p&gt;
&lt;script src=&quot;https://gist.github.com/4256487.js&quot;&gt; &lt;/script&gt;</content><author><name></name></author><category term="ubuntu" /><category term="upstart" /><category term="dbus" /><summary type="html">There is a handy tool init-checkconf you can use to validate your freshly written Upstart configs. If you're trying to use this on an Ubuntu server install or similar environment, you might have run into this issue:</summary></entry><entry><title type="html">Ubuntu Cloud AMI ID Finder</title><link href="/virtualization/2012/12/07/ubuntu-cloud-images.html" rel="alternate" type="text/html" title="Ubuntu Cloud AMI ID Finder" /><published>2012-12-07T00:00:00+00:00</published><updated>2012-12-07T00:00:00+00:00</updated><id>/virtualization/2012/12/07/ubuntu-cloud-images</id><content type="html" xml:base="/virtualization/2012/12/07/ubuntu-cloud-images.html">&lt;p&gt;Recently, I've found myself loading up the &lt;a href=&quot;http://cloud-images.ubuntu.com/&quot;&gt;Ubuntu Cloud
Images&lt;/a&gt; site way too frequently just to copy and paste an
up to date AMI id.&lt;/p&gt;
&lt;p&gt;I hacked together a &lt;a href=&quot;https://gist.github.com/9b473ad1a695cc521f6c&quot;&gt;script&lt;/a&gt; to grab the json source, filter it on some
provided attributes and output a table in your terminal. My buddy &lt;a href=&quot;https://github.com/jdhuntington&quot;&gt;JD&lt;/a&gt;
helped out with some refactoring and it's a much more pleasant way to find that
AMI id you need.&lt;/p&gt;
&lt;script src=&quot;https://gist.github.com/whiteley/9b473ad1a695cc521f6c.js&quot;&gt; &lt;/script&gt;
&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-console&quot; data-lang=&quot;console&quot;&gt;&lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;ubuntu-cloud-images suite:precise region:us-west-2 &lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;:ebs
&lt;span class=&quot;go&quot;&gt;+-----------+---------+-------+------+------------+--------------+---------------------------------------------+
| region    | suite   | arch  | type | date       | ami          | launch                                      |
+-----------+---------+-------+------+------------+--------------+---------------------------------------------+
| us-west-2 | precise | amd64 | ebs  | 20121026.1 | ami-7eab224e | ec2-run-instances -k mwhiteley ami-7eab224e |
| us-west-2 | precise | i386  | ebs  | 20121026.1 | ami-7cab224c | ec2-run-instances -k mwhiteley ami-7cab224c |
+-----------+---------+-------+------+------------+--------------+---------------------------------------------+&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Next up, I'll post my script that I use to run instances that waits for ssh
access and drops you into a shell.&lt;/p&gt;</content><author><name></name></author><category term="ubuntu" /><category term="ec2" /><summary type="html">Recently, I've found myself loading up the Ubuntu Cloud Images site way too frequently just to copy and paste an up to date AMI id.</summary></entry></feed>