Dr Nic

What is *jour and why they are killer apps for RailsCamp08

what is *jour?
Uploaded with plasq’s Skitch!

RailsConf 2008 was a few weeks ago, and I didn’t go. I made babies instead. But if you ignore the whoohaa of MagLev and DHH’s Surplus talk, there was one piece of genuine, new awesomeness that came out of RailsConf. This awesomeness, plus Twitter created at least 6 new projects in the last month. These apps are going to make RailsCamp awesome.

That is if RailsConf never happened this piece of delicious coding happiness never would have occurred. It was built at RailsConf, by RailsConf attendees. It was built to solve a problem that only happens at conferences. Crappy internet.

The answer is gitj… no wait, I have more introductory story. [skip it]

Instead of going to RailsConf this year I “get” to go to RailsCamp, which is like a conference for Rails developers, but without the conference part. What’s left without the conference? Hacking, Guitar Hero3, rejectconf-esque talks, and alcohol. Its’ the Lord’s way of saying “you’re in the right profession.”

RailsCamp has two minor drawbacks, since it is held out in the country. One, there is no internet connection. Two, there is no internet connection. Now I know that is only one draw back but I thought it was such a big one it was worth mentioning twice [oh I miss Red Dwarf].

So, 6 months ago we solved one internet-related problem: we turned to Git and git-svn clone to take all our svn repositories with us camping. 6 months on, git has taken over the Ruby OSS world, thanks mostly to GitHub which made remote hosting of git repos easy peasy. But, Github won’t be with us at RailsCamp. So we’re back to where we were 6 mths ago – being gumbies at hosting remote git repos.

So the question to be solved: how do you host a git repository, or indeed, lots of git repositories from your development machine; and conversely, how do you find someone else’s git repositories on their machine and clone it?

And whilst we’re at it… how do you easily share the RubyGems you have installed on your machine with other people, and how do you easily find gems on other people’s machines that you don’t currently have, if you don’t have access to rubyforge.org or github.com to get them?

And furthermore… if you’re running a fun little web app off your dev machine, how can you easily advertise it and other people find it and use it? “Hey, what’s your machine’s name?” “drnic-mac” “Thanks. ..pause… Um, what port’s the app on?” “4050”…

Same problem. Local devs, running local services, but how to share with everyone in the room?

Bonjour

The core solution is a technology created by the boffins at Apple that is now completely open-source (afaik): Bonjour. From wikipedia:

Bonjour, formerly Rendezvous, is Apple Inc.’s trade name for its implementation of Zeroconf, a service discovery protocol. Bonjour locates devices such as printers, as well as other computers, and the services that those devices offer on a local network using multicast Domain Name System service records.

In the Ruby world there are two RubyGems to integrate Bonjour into your app: dnssd and net-mdns. The former is only for Mac OS X, and the latter is a Ruby-only implementation that can be used anywhere. Bingo.

gitjour

So, Chad Fowler, Evan Phoenix, Rich Kilmer and a cast of others started a humble project to solve the first problem: sharing git repositories across a local network, called gitjour.

This project became a happy hack place for many many people.

one or two additions to gitjour
Uploaded with plasq‘s Skitch!

NOTE: I’ve included all the installation instructions that should work. If they don’t then try building the gems from src.

On OS X:

    sudo gem install dnssd
    sudo gem install gitjour

    or from source

    sudo gem install dnssd
    git clone git://github.com/chad/gitjour.git
    cd gitjour
    rake install_gem

On Linux/Windows:

    sudo gem install net-mdns
    sudo gem install_gem nogoth-gitjour --source=http://gems.github.com

    or from source

    sudo gem install net-mdns
    git clone git://github.com/nogoth/gitjour.git
    cd gitjour
    rake install

The gitjour project uses dnssd gem, with mac os x dependencies, and GitHub user ‘nogoth’ has ported the project to use the net-mdns gem for Linux/Windows.

Now, open up two terminal windows so you can emulate both sides of “serving” and “finding” a git repository.

Window 1:

    cd a/git/project
    gitjour serve

Window 2:

    gitjour list
    gitjour clone project

In Window 1, you can also serve an entire folder of repositories. Lots of them all at one time. Go into your project’s parent folder and run gitjour serve and you’ll see it Registered dr_nic_magic_models on port 9418. Starting service. a lot. In Window 2, you just gitjour clone xxx the project you want.

See, genius. No mucking around with Apache or setting up local “remote” repositories in your public folder so people can pull from it. Just run gitjour serve from your parent folder and you are instantly hosting ALL of your git repositories. Top Tip: move any private work into another folder first wink

So, that’s the git-sharing problem fixed.

pastejour

After RailsConf, twitter was alive with the coolness of gitjour, and very quickly John Barnette created pastejour to publish and find single pastie’s of code, given that without the internet you don’t have pastie websites.

To install on OS X:

    sudo gem install dnssd
    sudo gem install jbarnette-pastejour --source=http://gems.github.com

    or install from src:

    sudo gem install dnssd
    git clone git://github.com/jbarnette/pastejour.git
    cd pastejour
    rake install

On Linux/Windows:

    sudo gem install net-mdns
    sudo gem install nogoth-pastejour --source=http://gems.github.com

    or install from src:

    sudo gem install net-mdns
    git clone git://github.com/nogoth/pastejour.git
    cd pastejour
    rake install

Pastejour publishes a single block of text until one person retrieves it. Essentially, you yell at the person that there is a paste for them and they get it.

Window 3:

    pastejour <<< "Hello Window 2"

Window 4:

    $ pastejour -f
    Searching for servers (3 seconds)
    Found pastejour at 'drnic'
    $ pastejour drnic
    (drnic from drnic-mac.local.:42424)
    Hello Window 2

gemjour

After John’s announcement on Twitter, I asked “do we have a gemjour yet for sharing gems?”

Later that day, Evan Phoenix replies with “@drnic Enjoy! http://github.com/evanphx/gemjour/tree/master

three-jours
Uploaded with plasq’s Skitch!

This gem serves up all your gems to anyone who wants to install them from you. Don’t have merb but want to try it? Grab it from someone else.

To install on OS X:

    sudo gem install dnssd
    sudo gem install evanphx-gemjour --source=http://gems.github.com

    or install from src:

    sudo gem install dnssd
    git clone git://github.com/evanphx/gemjour.git
    cd gemjour
    rake install

On Linux/Windows:

    sudo gem install net-mdns
    sudo gem install nogoth-gemjour --source=http://gems.github.com

    or install from src:

    sudo gem install net-mdns
    git clone git://github.com/nogoth/gemjour.git
    cd gemjour
    rake install

Window 5:

    gemjour serve

Window 6:

    gemjour list
    gemjour list someuser
    gemjour diff someuser  -- shows diff btw you and them
    sudo gemjour install someuser newgem -- install newgem from someuser
    sudo gemjour install_diff someuser -- installs all gems from someuser you don't have

Go around the room and steal everyone gems in a few minutes.

appjour

Room full of people hacking up cool things? Publish and find them easily with appjour, written by Lachie Cox

To install on OS X:

    sudo gem install dnssd
    sudo gem install lachie-appjour --source=http://gems.github.com

    or install from src:

    sudo gem install dnssd
    git clone git://github.com/lachie/appjour.git
    cd appjour
    rake install

To use it, after you’ve started a web app that you want to publish, open another window to run appjour:

Window 7:

    cd some/web/app
    script/serve -p 4000  # or whatever for your framework
    appjour leet_app 4000

Window 8:

    $ appjour
    Searching for servers (3 seconds)
  found web app called 'leet_app'

  $ appjour leet_app
    ... app loaded into browser

Mongrel publishing bonjour events

Courtenay hacked in a few lines to mongrel_rails so that each mongrel publishes itself to Bonjour.

The magic of this is that mongrels, or the applications behind them, could use Bonjour to self-discover each other within a mongrel cluster, and then talk to each other.

One man’s solution is another man’s problem

As new people join the circus, new gems, git repositories, web apps and pasties are added and the new problem is: how to keep in touch with the newness?

First solution: publish them to Growl with dejour by Aaron Patterson, tagged “Discover awesome services near you.”

On Mac OS X:

    sudo gem install dnssd
    sudo gem install aaronp-dejour --source=http://gems.github.com

    or install from src:

    sudo gem install dnssd
    git clone git://github.com/aaronp/dejour.git
    cd dejour
    rake install

There is no fork of dejour for Linux/Windows yet.

Window 9:

    $ dejour

All your current services should appear as Growl notifications (from Windows 1, 3, 5 and 7 above).

But Growl notifications fly-by pretty quickly. How to keep track?

Finally, *jour to the rescue (starjour)

I really felt that this problem was best solved with a GUI. Mostly cause I was keen to try out RubyCocoa. I don’t think I did productive work for a week, whilst I read books, tutorials and anything I could find on RubyCocoa, Cocoa, Xcode + Interface Builder, Objective-C and after trying and failing a few times starjour was created. By Lachie Cox (who also wrote appjour).

Starjour - panels branch
Uploaded with plasq’s Skitch!

F@#$@#.

Really, I just couldn’t get my head around Cocoa Bindings at the time, but my experience of using RubyCocoa was very positive, once I’d learnt the underlying framework and the thinking-patterns of a Cocoa developer. Best book to read to learn Cocoa/RubyCocoa? The book is by Aaron Hillegass – Cocoa Programming for Mac OS X (3rd ed). After struggling with other people’s books and tutorials this one was wonderful. The “CollectionView” message in the image above was me telling Lachie that I’d figured out and used CollectionViews to replace his TableView. Now i just need to bind the bonjour message type (gitjour/gemjour etc) to an image. And more.

But, nonetheless, starjour (read: *jour as all these apps were collectively named on Twitter) did one job: it sat there showing which services were currently available.

Unlike all the others, this one used the native Cocoa framework for Bonjour, fwiw, and is doomed as an OS X-only app.

On Mac OS X, we don’t really have a place to download and run it, so grab it from src:

    git clone git://github.com/lachie/starjour.git
    cd starjour
    rake run

This requires Xcode and RubyCocoa (available on OS X Leopard or via rubycocoa.com on sourceforge)

Wow! What just happened last month?

Chronologically: gitjour, pastejour, gemjour, dejour, starjour and appjour. And I think there are others. Its incredible.

Firstly, it is going to be an awesome RailsCamp – these tools are killer apps for an internet-less hackfest like RailsCamp, or massive internet-starved conferences like RailsConf.

Secondly, it has been very exciting to watch the creation of these projects over the last few weeks, with the *jour meme bubbling through twitter and irc. Another happy month for our open source communities.

Related posts:

  1. Unit Testing iPhone apps with Ruby: rbiphonetest Everything to love about Ruby: the concise, powerful language;...
  2. Create and deploy command line apps with RubyGems RubyGems have many things going for them: they are a...

42 Responses to “What is *jour and why they are killer apps for RailsCamp08”

  1. The *jour app meme is so full of win that it *is* win.

    Awesome write-up, Nic. Can’t wait to play with these for real on the weekend!

  2. Ironically, hacking on gitjour was my intro to both git and github. Yay confhacks!

  3. Brad Wilson says:

    So if I install startjour, do I need to install all the other gems too? I think I do…. right?

  4. Dr Nic says:

    @Brad Wilson [via] – no; it uses Cocoa’s Bonjour libraries, not the dnssd gem; it should work alone. If that’s useful :)

  5. Brad Wilson says:

    That’s good to know but I think I answered my own question:
    “No, starjour does not include gitjour, etc.”

  6. Brad Wilson says:

    Erm I mean I answered it in my own head. That quote is a quote of a thought of mine. I am confusing myself now :-(

  7. There’s only one *jour your missing.

    iChat bonjour so you can talk to everyone at RailsCamp08 with ease.

  8. Dr Nic says:

    @Gareth Townsend [via] – and if someone brings along a printer then we’re well covered.

  9. Linux/Windows version of appjour is up at http://github.com/crnixon/appjour. The conversion is super-easy.

  10. Chin Chau Low says:

    Awesome stuff!

    BTW, when installing gitjour from source, I had to use “rake install_gem” instead of “rake install” .

  11. Eric says:

    There’s a small typo above, in the introductory section on Bonjour.

    I spent a few minutes trying to find “net-mdsn”, when the actual library is “net-mdns”, and it looks like it’s part of the rubyforge project here:

    http://rubyforge.org/projects/dnssd/

    Regardless, thanks for the great writeup :)

  12. Dr Nic says:

    @eric – ahh a legacy of my .NET days perhaps (MSDN). Oh wait that’s different again. Nonetheless, thx + fixed.

  13. Dr Nic says:

    @Chin Chau Low – oops, thx.

  14. Dr Nic says:

    *jour #7 – injour by Arun Thampi. For sharing + observing status messages via Bonjour. Very cool.

  15. Ken Hoxworth says:

    I’m really glad to see there is some interest in MDNS-SD emerging in the ruby community, as I have been working with the DNSSD library for a couple of years now. I think that more eyes on the subject can make a lot of progress happen.

    The DNSSD library is built to work with apple’s mdnsResponder, which obviously is available on OSX but is also available in some flavors of Linux. Avahi, the competing Linux bonjour library, has an apple mdnssd comparability library that can be installed to allow the DNSSD library to compile (this won’t help windows users, unfortunately).

    The reason I am advocating the DNSSD library over the net-mdns library is because the former is incomplete; last I checked it did not provide the modification of text records, which can enable additional capabilities with bonjour. I have been considering looking into either making the net-mdns library fully compliant with the bonjour spec or extending the DNSSD library to support avahi; if there is any interest in this please let me know.

    In addition I have worked on a small utility library to make registering and responding to bonjour events as simple as passing a proc object to a method; I’ll look over the codebases for these projects to see if it would make sense releasing this library.

  16. Dr Nic says:

    @ken – ultimately I’d like to see the pure ruby net-mdns library be complete and the “go to” gem; if you’re looking for +1s :)

  17. nice toys, thanks for the article Nic!

  18. Arun says:

    Hey Dr Nic – Thanks for the Injour plug :) We’ve begun to use it internally here at Wego.com and already there are more featured being planned.

  19. [...] Dr Nic » What is *jour and why they are killer apps for RailsCamp08 Chronologically: gitjour, pastejour, gemjour, dejour, starjour and appjour. And I think there are others. Its incredible. (tags: gems apps git github macosx osx ruby bonjour rails jour) [...]

  20. [...] What is *jour and why they are killer apps for RailsCamp8 – I’ll never go to a RailsCamp,but hooking up git and gem and stuff to Bonjour is an interesting idea anyhow. [...]

  21. Chris Ryland says:

    @Gareth: You know iChat already works in Bonjour mode under OS X, right?

  22. [...] mind blowing. The latest ohmyfsmthatissocool revelation is that some gnarly geeks created a Bonjour-based server for git called gitjour, so if you’re out and about you can share your git code with anyone with almost zero pain. [...]

  23. Too bad about github being down. This looks unbelievably pleasant for office git-use.

  24. [...] Dr Nic » What is *jour and why they are killer apps for RailsCamp08 [...]

  25. [...] [stueccles] Dr Nic » What is *jour and why they are killer apps for RailsCamp08 (tags: ruby) [...]

  26. Vladimir says:

    guys, U really rock! It’s awesome for our small startup-team.

  27. [...] What is *jour and why they are killer apps for RailsCamp08 Share git repositories across a local network with Bonjour (tags: git mac software admin runner_project bonjour howto @toread) [...]

  28. Phil says:

    Very nice.

    BTW; the non-OS-X gitjour instructions should have “sudo gem install” instead of “sudo gem install_gem”

  29. [...] DHH??s Surplus talk, there was one piece of genuine, new awesomeness that came out of RailsConf. Thttp://drnicwilliams.com/2008/06/18/what-is-gitjour-gemjour-starjour/Read “RE: Your opinion on private servers… – Page 12 – Unofficial World of Warcraft Forums” at [...]

  30. Ben Kruger says:

    This is some good shit! Thank you for the write up.

  31. [...] What is *jour and why they are killer apps for RailsCamp08 [...]

  32. [...] Twitter (Mmmmmhhh, Stille!), Rubyforge und Rails-Docs (oha!), dafür aber mit Twetter (rockt!), Gitjour, Gemjour, Appjour, Pastejour, Dejour (rockt!), reichlich frischer Luft, englischen Köstlichkeiten, belgischem Bier – und vor allem: [...]

  33. [...] gem is inspired by Dr Nic post on RailsCamp08 and *jour. A lot of fun stuff can be build using [...]

  34. Martin says:

    I tried gitjour on Windows but got a “No such file or directory” error at line 91 of nogoth’s gitjour Application.rb when trying to run “gitjour serve”

    It looks like this is trying to run git-daemon (which makes sense) but I am missing this since I’m using the msysgit version of git – from http://code.google.com/p/msysgit/ – which doesn’t include this.

    Looks like the Cygwin stack is a prerequisite for getting some of this working – unless there’s another option?

    Just thought I’d mention it in case anyone runs into a similar issue.

  35. sesli chat says:

    I tried gitjour on Windows but got a “No such file or directory” error at line 91 of nogoth’s gitjour Application.rb when trying to run “gitjour serve”

  36. Phil says:

    The dnssd gem has been updated so it works with avahi now; it no longer requires Mac OS X. So you should be able to use that set of instructions for GNU/Linux systems as well.

  37. [...] Dr Nic’s What is *jour and why they are killer apps for RailsCamp08 "Local devs, running local services, but how to share with everyone in the room?" Answer: rebuild all your tools to work across Bonjour. Slightly bonkers but very cool. (tags: git ruby bonjour networking collaboration gitjour gems tools utilities programming ) [...]

  38. SesliSohbet says:

    I tried gitjour on Windows but got a “No such file or directory” error at line 91 of nogoth’s gitjour Application.rb when trying to run “gitjour serve”

  39. free mmorpg says:

    The DNSSD library is built to work with apple’s mdnsResponder, which obviously is available on OSX but is also available in some flavors of Linux. Avahi, the competing Linux bonjour library, has an apple mdnssd comparability library that can be installed to allow the DNSSD library to compile (this won’t help windows users, unfortunately).

  40. [...] Dr Nic ’s What is *jour and why they are killer apps for RailsCamp08 drnicwilliams.com/2008/06/18/what-is-gitjour-gemjour-starjour – view page – cached Personal weblog for Dr Nic Williams — From the page [...]

  41. muhabbet says:

    BTW; the non-OS-X gitjour instructions should have “sudo gem install” instead of “sudo gem install_gem”