Using Docker Transparently on OSX

Docker current requires a Linux OS to run due to using kernel technologies that are specific to this platform, such as lxc.

You can use Docker fairly painlessly on an OSX development machine by leveraging vagrant and some work by Mitchell Hashimoto and Steeve Morin.

Installing prerequisites

These commands require homebrew.

Vagrantfile

Create a directory to store your dockerfiles, and save the following file as your Vagrantfile in that location. You may want to adjust the forwarded ports as necessary depending on what services you’re developing, or add a private IP address for convenient external access, etc. Please see the Vagrant docs for more information.

Usage

Gotchas

Mounting local folders as a volume on a running instance of an image currently doesn’t work on this method. You’d have to put the files on the VM running Docker, and then SSH into it and use docker run from there.

The (incredibly lightweight) boot2docker VM used in this example does not currently support Vagrant/Virtualbox shared folders easily if at all, so if you need to do so, you may want to move to a full-blown Linux instance that Docker supports, such as Ubuntu.

Example repo

I’ve been playing with writing my own Dockerfiles and have used the above technique in the git repo.

Local Gem Documentation With YARD, Pow and Alfred 2

I love rubydoc.info, but I was curious how hard it might be to run a local copy. The site is powered by the YARD gem.

You can use YARD to generate documentation for your installed gems, even if you use --no-rdoc when running gem install (or have included it in your .gemrc, as I have). This can be done by running yard server --gems and browsing to http://localhost:8808/.

I already run Pow on my MacBook, so I set up the yard server command to run in the background via OSX LaunchAgents:

’~/Library/LaunchAgents/YardDocs.plist’ (YardDocs.plist) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>KeepAlive</key>
  <true/>
  <key>Label</key>
  <string>Yard Docs</string>
  <key>ProgramArguments</key>
  <array>
      <string>/opt/boxen/rbenv/shims/yard</string>
      <string>server</string>
      <string>--gems</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
</dict>
</plist>
1
$ launchctl load -w ~/Library/LaunchAgents/YardDocs.plist

and then used the following to connect it up with Pow and visit it in my browser:

1
2
$ echo '8808' > ~/.pow/gemdocs
$ open http://gemdocs.dev/

This uses Pow’s port forwarding functionality rather than the more common Rack app usage. There was probably a way to implement this with a Rackup file but the last time I investigated this, I was not able to find a Rack configuration to run YARD’s gem docs server.

Next, I set up a custom search in Alfred 2 that allows me to look at the docs for any gem by pressint Alt+Space, then typing “gemd <gem name>”:

Alfred 2 Custom Search

If you have Alfred 2 installed, you can click here to add this search to your custom searches automatically.

Avoid Pow DNS Collisions on *.dev Through /etc/resolver

At work, we use the .dev TLD for some internal services, staging servers, etc. But I already use pow. What am I to do?

Turns out there’s a super easy fix for my scenario. All our stuff at work is a subdomain in the format of foo.<company>.dev, so this was all I had to do:

1
$ echo 'nameserver <DNS IP>' | sudo tee /etc/resolver/<company>.dev

Now Pow still works, but so do our internal services.

OSX, Pow

Ambition Gets the Best of Me

Recently I splashed on a RubyMotion license, and I’ve been itching to put it to good use as soon as I got my grubby little hands on it.

I’ve got a use-case I might be able to work with at my job for an internal service, but since our VPN client keeps crashing my Mac Mini due to a Mountain Lion incompatibility, I’m searching for something I can do at home.

So, I’m seriously considering setting out on the journey of developing a Ruby on Rails-powered blog engine and its accompanying read-write iOS client app in parallel, as a learning experience only.

Given my track record, I wouldn’t hold my breath on the results showing polish, or you know, completion.

Read on →

SublimeText 2

It’s been a full month since I purchased my license for SublimeText 2 and I couldn’t be happier.

Read on →

AT&T iPhone 3G Versus Verizon Blackberry Curve

Having used a Blackberry Curve 8330 on Verizon’s network for many months, I feel I can provide a fairly deep comparison between that and my new iPhone 3G. Let me preface the following by saying I am neither a Mac nor a PC. I am both, and neither. I use OSX Leopard just as often as I do XP SP3 and Vista x64 SP1, along with Ubuntu 8.10 and Fedora 10. I am an OS-aholic. So I have no strong ties to any given platform.

What inspired the change was this: Up until the last month or so of my Verizon service, e-mail delivery on my Curve was nigh instantaneous. We’re talking 5-10 seconds average. I would get a little “ding!” out of my phone quicker than on my desktop e-mail client at my desk at work, and I should point that I am wired to the server by a single switch and a physical distance of perhaps 30 feet. That should clue you in. It was fast.

For the last 3-4 weeks, however, deliveries to my phone have been going slower and slower. I can verify that yes, e-mails are arriving in a timely fashion, as my desktop client is still showing work e-mail arrivals in the time you would expect. Same with Gmail. But my phone was frequently 10-15 minutes behind, and getting worse. I had full signal, according to my phone’s indicators, at all times.

Read on →

Snippet: Update Your Local Git/Subversion-based Textmate Bundles With Sake

Gist

Install this with Sake and run sake textmate:bundles:update to update any local bundles you have checked out through svn/git.

More OSX Apps I Love

  • TextMate – Programmer’s text editor
  • 1Password – secure password and information manager that integrates into your browser(s)
  • AppZapper – clean up behind software you decide to axe
  • Boot Camp – Yeah, there’s still some Windows apps I use. (built into OSX)
  • Camouflage – hide those pesky desktop icons for focus and clarity
  • CoverSutra – iTunes tool for keyboard shortcuts, album artwork, Spotlight-like search, and Last.FM integration
  • Cyberduck – FTP/SFTP client with drag-and-drop and Growl notifications
  • Firefox 3.0 – only in release candidate status, but already a contender to finally replace Safari
  • Fluid – turn any website into a .app
  • Handbrake – DVD-ripping tool for converting DVDs to digital video files for your iPod, AppleTV, XBMC, etc.
  • iStat Menus – monitor your CPU, memory, and network usage in your menu bar
  • MacPorts – install Unix/linux tools using a tool similar to apt-get
  • NeoOffice – good, free replacement for the ****slow and bloated MS Office
  • Parallels Desktop – run Windows or Linux inside OSX
  • SquidMan – run the Squid HTTP caching proxy on OSX
  • SuperDuper / Carbon Copy Cloner – great backup tool
  • ted – Torrent episode downloader – track your favorite TV shows!
  • Time Machine – great, simple, configure-and-forget backup solution (built into OSX)
  • Twitterific – Twitter client
  • WhatSize / GrandPerspective – a graphical overview of what’s eating up all your harddrive space (hint: pr0n.)

OSX Apps I Can’t Live Without

  • Adium Multi-protocol IM client; supports AIM, Yahoo, MSN, MySpace, Google Talk, and loads more.
  • Growl pop-up notifications for anything and everything
  • Safari – included with OSX
  • Mail and Address Book- included with OSX
  • Quicksilver keyboard-based launcher; hard to explain what it does, but useful as all hell
  • Firefox browser, though I don’t use it nearly as much on OSX because of Safari
  • Schoolhouse homework manager or iProcrastinate
  • Colloquy IRC chat client
  • Google Mail notifier
  • iBackup
  • NetNewsWire RSS reader
  • Skim PDF reader (Preview is good, Skim is better)
  • The Unarchiver for zips, rars, aces, etc.
  • Transmission bittorrent client
  • VLC media player for files Quicktime won’t handle

Quick Tip: Ubuntu Default Runlevel

If you, like me, use sysv-rc-conf to change the services that run a particular runlevel, i.e. so that runlevel 2 is actually only networked and not GUI as tradition holds, you can set the default runlevel to boot in Ubuntu by editing:

/etc/inittab
1
id:3:initdefault

The number in the middle is the runlevel to start by default.