Skip to content

Instantly share code, notes, and snippets.

@kamarcum
Last active December 18, 2015 00:08
Show Gist options
  • Save kamarcum/e103ad683c1d17e76621 to your computer and use it in GitHub Desktop.
Save kamarcum/e103ad683c1d17e76621 to your computer and use it in GitHub Desktop.
The Last Will and Testament of my Development Environment

I'm creating a log here of what I'm doing so that when people mock my failures later, they can do so accurately.

In the event that this all works out, I'll make some sort of post about switching to boxen from a brownfield machine.

I'd like to switch to boxen for a couple reasons:

  • I'm hoping to get a new MBP in the fall and would like to be able to provision it quickly.
  • Some friends are working on a puppet project. I'd like to learn enough to at least talk about it.
  • I'm horrible at managing dependencies (more on that later).

My current develpment environment has a lot of things boxen won't like:

  • RVM
  • Existing homebrew
  • Several manually linked libs that I've since forgotten about
  • My brew doctor output

I'll need this dev machine in working order again in about 20 hours for my day job. I know it takes me about 3 hours to bootstrap a paved machine from my old checklist, so I won't start panicking until at least 8pm.

Phase 1: Burn down RVM

  1. tmux kill-server
  2. rvm implode
  3. remove rvm line from ~/.bashrc.local
  4. restart terminal
  5. ruby -v => ERROR: Missing RVM environment file: '/Users/keith/.rvm/environments/jruby-1.6.3'
  6. ls -la ~/bin => all of my rubies are still simlinked to rvm stuff
  7. mv ~/bin ~/old_bin
  8. restart terminal
  9. ruby -v => system ruby

Phase 2: Burn down homebrew

  1. read wiki entry for uninstalling
  2. read gist for uninstalling
  3. read panic-inducing comment
  4. The gist has been updated since that comment. Screw it.
  5. Copy + Paste gist into terminal
  6. [Process Completed] last printed line was rmdir -p bin Library share/man/man1 2> /dev/null
  7. In for a penny, in for a pound. Copy remaining lines of gist and paste those.
  8. which brew returns nothing. Success?

Phase 3: Enter the boxen

  1. Put boxen/our-boxen e736220c84 in a private repo
  2. Review preflight checklist
  3. Double check that XCode command line tools are installed
  4. Follow directions in README.md
  5. Review Puppetfile one more time
  6. script/boxen
  7. Wait.
  8. Add [ -f /opt/boxen/env.sh ] && source /opt/boxen/env.sh to the end of my ~/.bashrc.local
  9. Tada?

Phase 4: Is this thing on?

  1. Set up user manifest requiring a single project
  2. Set up project manifest definining github location and ruby version
  3. script/boxen => could not read Username for 'https://github.com': Device not configured
  4. git config -l => Everything looks right. Github username and token are set.
  5. git config --global credential.helper => /opt/boxen/bin/boxen-git-credential
  6. Copy command puppet said it was running, /opt/boxen/homebrew/bin/git clone --recurse-submodules https://github.com/Zeumo/zeumo /Users/keith/src/zeumo and run it. The clone succeeds. Rerun script/boxen, same error. Wtf, puppet.
  7. Replace "repo => 'Zeumo/zeumo'" with "repo => 'git@github.com:Zeumo/zeumo.git'". Everything works.
  8. cd ~/src/zeumo ruby -v => 2.0.0
  9. Tada.

Phase 5: When in Rome

Here's the puppet manifest I have for zeumo at this point

class projects::zeumo {
  boxen::project { 'zeumo':
    ruby   => '2.0.0',
    source => 'git@github.com:Zeumo/zeumo.git'
  }
}

But zeumo needs a lot more than just ruby. Let's puppetize this the rest of the way.

  1. bundle => cryptic error than I know means capybara-webkit wants qt
  2. Add "include qt" to top of zeumo project manifest
  3. script/boxen => "Could not find class qt"
  4. Adding qt to Puppetfile. I somehow remember that valid versions are the tags on the repo.
  5. script/boxen => "Could not find class xquartz"
  6. Yeah, I understand xquartz is a dependency for qt. It's listed in puppet-qt's README. puppet-qt doesn't have a Puppetfile, though, so it doesn't have a way to take care of this for me, I guess. Pandas weep.
  7. Adding xquartz to Puppetfile. script/boxen => Failure
Notice: /Stage[main]/Qt/Homebrew::Formula[qt]/File[/opt/boxen/homebrew/Library/Taps/boxen-brews/qt.rb]/ensure: defined content as '{md5}9bc2e00a20846dd90e679c70f594e6f0'
Notice: /Stage[main]/Xquartz/Package[XQuartz]/ensure: created
Warning: Building source; cellar of libpng's bottle is /usr/local/Cellar
Error: Could not update: Failed running sudo -E -u keith /opt/boxen/homebrew/bin/brew install boxen/brews/qt
Error: /Stage[main]/Qt/Package[boxen/brews/qt]/ensure: change from absent to 4.8.4-boxen1 failed: Could not update: Failed running sudo -E -u keith /opt/boxen/homebrew/bin/brew install boxen/brews/qt

I thought maybe I'd gotten off too easy with my botched brew uninstallation. At this point I just guess at what's wrong.

  1. brew uninstall libpng script/boxen => Same error. Guessing isn't working, so I dig around for homebrew's logs.
  2. I find the actual compile error in ~/Library/Logs/Homebrew/qt/02.make. Which lets me find the cause and its cause
  3. It turns out this was fixed in homebrew so I fork boxen/puppet-qt and apply the relevant bit of that diff and tag it 1.0.1. I update my Puppetfile and script/boxen again.
  4. Two ice ages pass while qt compiles (~50 minutes)
  5. bundle succeeds
  6. Create database.yml per the docs
  7. Add postgresql => true to project manifest. Add postgresql to Puppetfile and top of manifest. script/boxen
  8. postgresql requires sysctl. Add that to Puppetfile and try again.
  9. rake db:migrate still fails because queue_classic has decided to disappoint me
  10. Added an initializer to help queue_classic, and rake db:migrate passes
  11. rake passes. My dev environment is fully operational again, and 2 hours before my self-imposed deadline.
  12. beer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment