T-Shirts, Wearable Art, and Illustrations - now taking custom - just in time orders

Some nice text

Some nice text

Chef + Capistrano + rvm gemset

I spent the last few days struggling with chef.

What can i tell you so that you need not have to have the same struggle.

What ended up confusing me the most:

Essentially ruby needs to exist on the server side - I use RVM because it is easy to script and i know it well enough. The client side Capistrano script expects the gem bundler to exist on the client side and to be part of the gemset described in Capistrano - this gemset is named ‘blazing_gemset_for_client_xxx’ for the purpose of this post.

Design problem: 

[RVM + Chef-Solo ]:: Server Side -> responsible for bootstrapping a fresh ubuntu 10.10 LTS machine into complete ready state (DB+WEB)

[RVM + Capistrano ]:: Client Side -> cap production deploy should just work as it always does in the regular dev-cycle

Design Principles:

 Easy to start a new production machine from scratch

 Developers do not need root to deploy

What is less than vanilla in our setup:

 Had some legacy perl that expected to have apache.

What web stack did we choose :

 Passenger 3

What did I end up doing in the end

  1.  Install apache as the same user as is running the rails app (avoid permission issues and isolate user from root )
  2. System Wide RVM
  3. Create Gemset and manually bootstrap bundler into the gemset

What I wish i could do differently

  1. Didn’t like having to couple the name ‘blazing_gemset_for_client_xxx’ (the rvm gemset that the capistrano script knows about) into the chef scripts

What I like about what was accomplished 

  1. Implemented a Internet-friendly chef-solo bootstrap script
  2. Installed vim and my jan repo for nicer editing experience server side
  3. discovered the tricky part about capistrano  + chef + rvm

What was in the way from taking a userland based approach for RVM

  1. Passenger is a server side component that requires a config file with pointers to ruby runtime - because of this - ‘client’ knowledge ended up embedded in the chef repository
  2. Capistrano assumes that a machine is setup in a particular configuration and it’s RVM support did not seem to include bootstrapping a gemset - event if it did - there would be more work to integrate it into passenger

Notes

  1. Unicorn runs in a different model and wouldn’t have encountered exactly this same issue
  2. There would still be the issues of coupling gemset name between Capistrano and chef - a detail that i think only one should know about. 

About Me

  1. I have been a unix script banger since i was a teenager.
  2. I’ve been coding ruby since 2003 and rails since 2005.
  3. I’ve used Capistrano on pretty much every project.
  4. I deploy my node.js scripts with chef and it works ok.
  5. This is my second chef based machine rollout package and my first time integrating it with capistrano.
  6. I just started learning how to plie.

Footnote 1 :

I implemented a internet-hostile standalone chef-solo system for unpacking complete systems inside user accounts on lockdown intranet virtual machines as well - this was a build based solution and did not use rvm - but took a userland based ruby approach.

Some nice text

Some nice text

erlang notices

When using ’export’ a typo of ’exports’ will result in a warning that your functions are not used.

a function declaration seems to be a collection of ’,’ separated statements ending in a period.

If a process executes a function with a runtime error then an error report will be generated and the exit value, the error with it will be described.

Some nice text

Some nice text

Bees, Javascript, Worms , Javascript, Javascript, Javascript

While riding my fixie up and down Geary street this morning - I had very little time to think about bees, worms, or javascript - for the past week thats whats generally been on my mind, that and the occasional cardamon infused coffee.

On the Javascript front BlazingCloud has released a online university class dictated by your’s truly - Mr Curtis Jennings.

I havent found a way to work worms or bees into the Javascript curriculum - when i do it is going to be awesome.

And what is this javascript curriculum i’m talking - imagine the combined power of Sarah Allen, Alex Chaffee and myself - in hybrid magic glowing brontosaurus shaped bus - traveling the galaxy sprinkling programming nuggets on the new javascript programmers. I’m building on their great work and on the great work of a thousand monkey ninja coders with blogger accounts.

When I say nuggets - I’m not talking about black gold - [ by that i mean worm compost - ( it’s the goods to mix in that soil compost mixture you know you want to make from your leftover rice) ].

Nuggets of Javascript Awesomeness - like closures and object patterns and even that blasted new operator.

I’ve been pumping out these videos for 2 weeks and there isn’t an end in sight.

The course is up and running - im making small tweaks to it as we go - there is a discount through women 2.0.

The course is up and running - i’m making small tweaks to it as we go - there is a discount through women 2.0.

http://www.udemy.com/beginning-javascript-and-behavior-driven-development-with-jasmine/

I heard the myth that bumble bees wings are much to small to achieve lift - i wrote an article for a small art group that was made up of myself and myself with a different name - and now today - science can share with you that Bumble bees fly through ‘brute force’ - rather they got massive energy and they just get it done - not so much finesse but just by doing it. *1

Much like the bumble bee - Bombus Terrestris - i am a power pack of energy and right now its been going into javascript lessons for you.

I’ve put up some awesome free walkthroughs of the lessons in the paid course for those of you that ‘just can’t get enough’*2 of me saying ‘HELLO PROGRAMMERS’

http://www.youtube.com/blazingcloudnet

Footnotes:

*1 http://www.sciencedaily.com/releases/2009/05/090507194511.htm

*2  You think it’s hard to sort through rotten food with your bare hands so you can feed worms? Try being Depeche mode and writing an awesome love song - mission accomplished - 1981 - ‘Just Can’t Get Enough’ : Key of G

Colophon:

font in images: NuSans Mono Italic

author : 

Curtis wrote this article while concerned that he might be a drone bee - then he remembered how often he is producing something and went back to typing hip lines into his full screen, green and black word processor while dreaming that he brought his headphones so he could listen to the awesome Beirut album he downloaded in the BlazingCloud.net Office. 

Some nice text

CrashPlan and you

I was looking for a backup solution for my servers. I needed it to not run as root - and to give me the option to not background the process.

Daemontools gives us a nice way to monitor jobs that stay in the foreground.

The instructions on crashplan’s support site are on how to connect to the engine on the server.

http://stgsupport.crashplan.com/doku.php/how_to/configure_a_headless_client


I also wanted to have another copy of the application for running on my local machine.
I made a copy of the CrashPlan.app on my Mac - the folder was locked - with good reason as /Library/LaunchDaemons/com.crashplan.engine.plist references the directory name.
This file is installed so that MacOSX can keep the engine running and bring it back alive if it crashes. ( Like daemontools on gnulinux/unix).
After modifying the directory path /Applications/CrashPlan.app to /Applications/CrashPlanLocal.app i restarted the job.
# note - the first time i tried this - i installed the LaunchDaemon in my local user# launchctl - I’m glad i can do that - but it would take further configuration to get the# OS X version running that way. I’m not as concerned about a potential backdoor on # my dev machine - on my production machine - i’m glad to be able to run as a non-# privaleged user#sudo launchctl load /Library/LaunchDaemons/com.crashplan.engine.plist

CrashPlan is really well written software for the average mac, windows, linux, opensolaris user - It’s also delightful to be able to change small things (like the startup script on linux to not fork and the engine port.

Some nice text

What is with prototype?

You’ll find when you start learning javascript that there are a few different ways to encapsulate code. Many different libraries use many different ways to emulate object oriented behavior.

Javascript is a prototype oriented language - which is to say - there is an instance that is created by the new operator - this instance is connected to a constructor attribute (what is invoked by new) and a prototype attribute (the start of a chain of where to look for functions if they do not exist on the current instance).

One of the ‘sharp, pointy edges’ of javascript has to do with the looseness of the language spec, the myriad ways of implementing javascript pseudo OO programming.

For this reason I am presenting a general survey - as continued with much more care and attention - by douglas crockford. 

http://javascript.crockford.com/prototypal.html

Some nice text

— A common pitfall in Ruby’s regular expressions is to match the string’s beginning and end by ^ and $, instead of \A and \z.

Some nice text

I deleted my .git - now i backup better.

The command i wanted to run:

$ find . -name '*.bak' -delete

The command i typed in :

$ find . '*.bak' -delete

The results:

$ ls -al                                [8:40:34]
total 0
drwxr-xr-x   2 o_o  staff   68 Feb 24 08:40 .
drwxr-xr-x  26 o_o  staff  884 Feb 24 08:40 ..

I’ve had to undelete or get files of damaged disks before - the thing about doing this for music is that the entire file is the data.

When working with code however - a file is just a tiny part of the whole application and the directory is just as important as the filename. This means that all the tools that are designed to show you ‘recently deleted files’ are going to be able to show me thousands of ruby files, none with names, and none with directories. Instead of solving my problem - it creates another problem.

What can you learn from my mistake?

First simple thing to do - Setup git so commits create a remote branch This is written for zsh and i have this in my ~/workflow.zsh file which I load in .zshrc via the command ‘source ~/workflow.zsh’. This should also work without change in ‘bash’ - in ‘sh’ i am not sure. This command rewrites the ‘git commit’ command to also push to a remote branch with the current branches name

GIT=/usr/local/bin/git

function git {
  case $1 in
    commit)
        echo ">Git Commit" $*
        $GIT $*
        vbranch=`git branch | grep '*' | awk '{print $2}'`
        echo ">Commiting to remote" $vbranch
        $GIT push origin $vbranch
        ;;
    *)
        $GIT $*
        ;;
  esac
}

There are two missing parts to this solution

  1. Offsite backups
  2. No internet backups

This problem can be solved with one solution incorporating

  • crontab
  • rsync
  • dropbox

for rsync - run this now so that your crontab is fast - it will only update changes

$ rsync -aRuP --partial-dir=PARTIAL ~/Work ~/Dropbox/RSYNC

for crontab (from crontab quick reference )

*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)

Run crontab with -e to launch your editor

$ crontab -e

put in this

*/10 * * * * bash -l -c 'rsync -aRuP --partial-dir=PARTIAL ~/Work ~/Dropbox/RSYNC'

In 10 minutes this will run - Dropbox will do it’s job - you can do yours.

HOWTO : NO COMPROMISE DESIGN   WHY (HOW,WHAT) CUCUMBER? (RUBY,BDD)