Archive for June, 2009

RabbitMQ on RHEL5 x86_64

Thursday, June 25th, 2009

Want to install RabbitMQ on RHEL5 but running into hideous erlang crashes? Chances are it is an issue with dual installations of erlang, one i386 and one x86_64.

Here’s how to fix it:

$ yum erase erlang.i386
$ rm /usr/bin/erl
$ rm /usr/bin/erlc
$ rm /usr/bin/escript
$ ln -s /usr/lib64/erlang/bin/erl /usr/bin/erl
$ ln -s /usr/lib64/erlang/bin/erlc /usr/bin/erlc
$ ln -s /usr/lib64/erlang/bin/escript /usr/bin/escript
$ service start rabbitmq-server
> Starting rabbitmq-server: SUCCESS

Let’s test:

bash-3.2$ irb
>> require 'bunny'
=> true
>> b = Bunny.new
=> #<:client:0x2b04beb0b038>
>> b.start
=> :connected
>> exec "echo YOU WIN"
YOU WIN
bash-3.2$

And as always, remember:

chkconfig rabbitmq-server on

I’m paranoid about chkconfig now!

Switched to PowerDNS

Thursday, June 25th, 2009

I’ve now switched to PowerDNS, running on a MySQL backend, and controllable using the pretty-damn-good .

Reasons for switching:

  • I am sick and fucking tired of editing and backing up countless arcane zone files. It might be “hard core” and “old school” but it’s also annoying as hell, and I can never remember the syntax or forget something stupid like updating the serial, or whatever.
  • A database is the natural storage container for numerous data files of the same syntax and consistent references, and is far more convenient. I can take snapshots of my entire DNS setup, one file, ready to import at a moment’s notice elsewhere.
  • Furthermore, a database is amenable to controlling with a web interface, which is far more convenient (and less prone to error) than ssh’ing in and editing files manually
  • I have one less thing to back up (actually, about 30 less things)
  • BIND has a terrible security record
  • PowerDNS has some neat other features such as dynamic lookup that I am eager to start playing with.

I’ve been considering this for a while, decided to make the jump today. First I got it set up and running perfectly on an unprivileged port; then turned off BIND and turned on PowerDNS. Total downtime: under 5 seconds.

Here are the steps to install on RHEL5:

$ yum install pdns pdns-backend-mysql pdns-backend-pipe pdns-backend-sqlite
# create a mysql user & db "powerdns"
# edit /etc/pdns/pdns.conf to increase port, add gmysql backend and add db credentials
# create the dir to put powerdns-on-rails in, go to it
$ git clone git://github.com/kennethkalmer/powerdns-on-rails.git
# enter DB creds into config/database.yml and create the DB
$ rake db:migrate
$ rake db:seed
# import zone files
# note: you may need to temporarily cp them to /var/named/
$ zone2sql --named-conf=/var/named/chroot/etc/named.conf --gmysql > zones.sql
# import the sql into MySQL via whatever means customary
# start and test powerdns at this point, see the docs
# then revert the port
# add the web app in Apache or whatever you use, log in, bingo
$ service named stop
$ service pdns start
$ chkconfig named off
$ chkconfig pdns on # make sure mysqld is on too ...

There are some more tips if you want to have a look.

Compiling PowerDNS on OSX 10.5.7

Wednesday, June 24th, 2009

Want to play with PowerDNS? On a Mac? You’ll need to do something like this. Make sure you read all the way to the end before continuing.

1. Download boost from sourceforge. The link for the version I used, 1.39.0, is here.

2. Extract the file somewhere. Mine was just in downloads.

3. Download and extract the source (at the top) of PowerDNS. I used version 2.9.22, from here.

4. navigate to the PowerDNS directory and execute the following commands. Change the reference to MySQL to something relevant to your local copy:

$ CXXFLAGS=-I/Users/sho/Downloads/boost_1_39_0 ./configure --with-mysql-includes=/usr/local/mysql-5.0.45-osx10.4-i686/include
$ make
$ sudo make install

That’s it! Built and installed perfectly. Now run pdns_server, and watch it fail with Cannot create semaphore: Function not implemented, because OSX is not fully POSIX compliant. Now wasn’t that a great way to waste time? I certainly thought so. Told you to read all the way to the end.

Fun with Growl

Wednesday, June 24th, 2009
(1..100).each {|num| Growl.new(:message => "I am number #{num}!").run}

Change the number to 1000, as I did, and don’t plan on seeing your desktop for a while. Add :sticky => true for extra “fun”.

What’s holding open that port on OSX

Tuesday, June 23rd, 2009

Since I always, ALWAYS forget this, here’s the command to find the process which is holding open, say, port 1900 on osx:

$ lsof -i -P | grep 1900
uTorrent  50937 sho   13u  IPv4  0xaf49b10      0t0    UDP 10.1.1.8:1900

Fucking uTorrent, why the hell is it sitting on 1900? That’s the SSDP/UPnP server-side port, ie. the router should be listening on 1900. Unless it’s planning on advertising SSDP services it can provide, it doesn’t need that port. Wonder what it’s doing.

Oh btw it only shows your processes, sudo if you wanna see ‘em all.

Snow Leopard only has Ruby 1.8.7

Monday, June 22nd, 2009

A bit of a disappointment – I’d been hoping they’d go with 1.9.1.

Recent Recommended Reading

Monday, June 15th, 2009

Why I Joined The Three Hundred

That Alien Message

The Fable of the Dragon-Tyrant

Twitter was useful just then

Wednesday, June 10th, 2009

Wow, I finally found a use for Twitter. RubyForge was (is) down once again, and a confirmed I am not the only person experiencing the problem, perhaps saving me a few minutes of tinkering.

I don’t mind this usage pattern; people “tweeting” about disasters, downtime or other anomalous events is useful. It’s the everyday crap and people using the service as a particularly crappy RSS feed that I don’t like.

Anyway, RubyForge is crtical infrastructure in the Ruby world and shouldn’t be going down like this. Hope they make higher availability a priority. Imagine if you were doing an emergency server reinstall right now. Who knows how long you’d have to wait?

UPDATE: It’s been down over 7 hours now, a really serious failure. Thinking about creating my own mirror when it comes back up, wonder what the storage requirement would be?

Keynote reactions

Tuesday, June 9th, 2009

Yesterday’s WWDC keynote was a welcome return to form for APPL – especially since the ARAT penalty for having the gall to live in Australia has dropped to “only” 10-15% or so. The new laptops look fantastic and it’s good timing; I’ll need a new one pretty soon. Needless to say, my single favourite features is the support for 8GB of memory. Sounded like I’m far from alone, too – the audience practically gave Schiller a standing ovation when he mentioned that.

Snow Leopard continues to impress and I’m particularly interested in GCD, and if/how it can be exploited in everyday applications. If it can be of use in “normal” tasks such as, say, compressing a video, or rendering a 3D scene, the next obvious question is – can the OSX machine be augmented by something like nVidia’s Tesla, to create the most powerful nearly-general-purpose machine available?

Some other features in snow leopard that I’m looking forward to include the new cocoa finder (FINALLY), the chinese character input mode, the bettter file sharing and of course the general “snappiness” improvements. One long-overdue feature which I am less hopeful for is the Quicktime “reboot”; I feel this is too little too late, at least in terms of the new “revolutionary” HTTP streaming, which of course is what Flash et al have been doing for years. HTML5 is imminent and I can’t help but think it will be the victor in any upcoming internet media reshuffle; open standards win, or should win, every time. If Apple really wanted to “take back the web” a complete open sourcing of the entire platform would be the only real option at this stage, especially with all the new linux netbooks and what not. Also no word on Windows (and Linux!) releases of even the updated client software; there’s little use in new internet technology if only Macs can use it.

Last but not least – the Exchange support, which is probably the single feature most likely to boost mac sales out of the whole ensemble. Many mac users and open source devotees spurn Exchange, and I can understand why, but having worked in corporate IT it’s hard to overstate just how important it is. Exchange is the heart and soul of any “Microsoft Shop”, and even many non-MS companies use it – it’s won the “corporate messaging, addresses and meetings” war pretty decisively, and honestly recent versions are not bad for what they do. Getting that into the OS opens the door to OSX usage in literally tens of millions of businesses – running Outlook or such junk in a VM was never a serious option – and I predict will do more for the platform’s marketshare than all the other enhancements put together.

Anyway, much to be excited about, both hardware and software, and not even much profiteering to be found. I’m starting to like Apple in “recession mode”!