Tuesday 28th February 2012

 

Today's a bit of a quiet day, so I'm going to have a go at scratching a bit of a personal itch.

Campfire is a really rather sexy HTTP based chat system provided by 37 signals.

I've found a clone-type application written by @maccman on Github, called Holla.  

I'm gonna have a go at installing it on Ubuntu 10.04.  It requires Ruby 1.9.2, which isn't installed by default, so that's the first hurdle. 

I'm gonna need to build it from source, probably. 

It looks like there's no backport for Lucid.  So, yeah.. Source it is.  :(.  I might have a go at wrapping it up with FPM later on. 

Here's a tutorial for 1.9.2 on 10.04.  Note: I only did it as root, because that's the default login for this VM Image I was using.  Normally I'd do it as me, but meh. Complications.

[email protected]:~# apt-get install zlib1g zlib1g-dev build-essential libcurl4-openssl-dev
...

stuff happens....

We're gonna grab the 1.9.3 stable recommended snapshot from www.ruby-lang.org/en/downloads (specifically, this snapshot), and hope for the best.  I'm assuming that 1.9.3 will work, if 1.9.2 was recommended.This could be my undoing.  We shall see.

I'm aware that I could have used RVM, but as this is a server, I'd rather have native packages, or at least natively built sources.  

[email protected]:~# mkdir sources
[email protected]:~# cd sources/
[email protected]:~/sources# wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz

...

[email protected]:~/sources# tar xzvf ruby-1.9.3-p125.tar.gz 

...

[email protected]:~/sources# cd ruby-1.9.3-p125
[email protected]:~/sources/ruby-1.9.3-p125# ./configure

.... Lots of Stuff ...

[email protected]:~/sources/ruby-1.9.3-p125# make

.. This bit took ages...

[email protected]:~/sources/ruby-1.9.3-p125# make test

... This bit took ages too...

[email protected]:~/sources/ruby-1.9.3-p125# make install
[email protected]:~/sources/ruby-1.9.3-p125# ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]

Woot.

Right.. Next bit.

Prerequisites

Ruby 1.9.2 [*] - Done

Bundler [ ]

Redis [ ]

[email protected]:~/sources# gem install bundler 
/usr/local/lib/ruby/1.9.1/yaml.rb:56:in `':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
^CERROR:  Interrupted
[email protected]:~/sources# gem install psych
/usr/local/lib/ruby/1.9.1/yaml.rb:56:in `':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
Fetching: psych-1.2.2.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing psych:
ERROR: Failed to build gem native extension.
        /usr/local/bin/ruby extconf.rb
extconf.rb:7: Use RbConfig instead of obsolete and deprecated Config.
checking for yaml.h... no
yaml.h is missing. Try 'port install libyaml +universal' or 'yum install libyaml-devel'
...
[email protected]:~/sources# apt-get install libyaml-dev
[email protected]:~/sources# gem install psych
...
Successfully installed psych-1.2.2
[email protected]:~/sources# gem install bundler
Fetching: bundler-1.0.22.gem (100%)
Successfully installed bundler-1.0.22
1 gem installed


Bundler [*]

Redis [ ]

We'll install Redis like this, perhaps. 

I found a decent Github gist, and forked it to modify it slightly so that it works.

I only had to add `useradd` redis to make it work.. 

It even uses Upstart! <3 The gist contains a decent redis-server.conf file for upstart.

[email protected]:/etc/init# vim redis-server.conf
[email protected]:/etc/init# start redis-server
redis-server start/running, process 8388
[email protected]:/etc/init# status redis-server
redis-server start/running, process 8388

Woot.

Redis [*]

Right.  The blogpost also says it requires Juggernaut, a node.js application server, so let's go ahead and figure out node.js for Ubunu 10.04 while we're here.

Here's someone elses blogpost on the subject. 

I'm quietly horrified that these searches "Installing on Ubuntu 10.04" doesn't automatically return someone's PPA, or public apt repo. - It looks like it's available for Oneiric and Precise from launchpad PPAs, but not for Lucid. 

So, again.. Source it is? :(

 

[email protected]:/etc/init# apt-get install g++ curl libssl-dev apache2-utils
[email protected]:/etc/init# apt-get install git-core
[email protected]:~/sources# git clone git://github.com/ry/node.git

Fuck that.  It's huge.

[email protected]:~/sources# wget http://nodejs.org/dist/v0.6.11/node-v0.6.11.tar.gz

./configure, make, make install.. and so on.

 

Apparently these are required.

gem install juggernaut
npm install -g juggernaut

 

[email protected]:~/sources# cd ..
[email protected]:~# mkdir app
[email protected]:~# cd app
[email protected]:~/app# git clone https://github.com/maccman/holla.git
[email protected]:~/app# cd holla/

 

Now dependencies.. libxml2 and libxslt and libsqlite3-dev

[email protected]:~/app/holla# apt-get install libxml2 libxml2-dev libxslt1-dev libxslt1.1 libsqlite3-dev
[email protected]:~/app/holla# bundle install

 

... Stuff happens...

This bit took ages for me.

It was trying to install some Bundle/debug shite, so i killed that off, and edited the Gemfile to remove the Debug lines.

[email protected]:~/app/holla# start redis-server
[email protected]:~/app/holla# rake db:migrate
[email protected]:~/app/holla# rails server thin
[email protected]:~/app/holla# gem install rails
[email protected]:~/app/holla#  rails server thin

 

Right.  Now there's an instance of Holla running on port 3000 on 0.0.0.0.  Excellent.

If you head over to your holla server (mine's just http://holla:3000/ thanks to DNS being ace)

and View Source, you'll see that there's something expected on port 8080 of "localhost".  This is because there's a bit of lame config that's not actually a) documented, or b) shown for production usage.

I put the Holla git clone-down in /srv/holla.

Head over there, and you need to find a line that contains "localhost", as that's where the config lives, for that bit of insanity.

grep localhost -R .
./config/initializers/juggernaut.rb:ActionView::Helpers::AssetTagHelper.register_javascript_expansion :juggernaut => ["http://localhost:8080/application.js"]

Ah ha!

Just need to change "localhost" to the hostname of your Holla server, save it and restart the rails app.

Good stuff.

At this point, it worked for me, except Juggernaut (the push server) wasn't running.. 

In /etc/init (upstart's config directory), i made a couple of files "holla-app.conf" and "holla-push.conf"

holla-push.conf 

description "holla push server"
start on runlevel [2345]
stop on shutdown
exec /usr/local/bin/juggernaut --port 8080 
respawn

and

holla-app.conf 

description "holla push server"
start on runlevel [2345]
stop on shutdown
chdir /srv/holla
exec /usr/local/bin/rails server thin
respawn

 

[email protected]:~# start holla-app
[email protected]:~# start holla-push

And the server's working on 0.0.0.0:3000, with push message support.

Excellent.

I tried after this to run it with Passenger and mod_rails.  It wasn't particularly successful, so I ditched it, and instead modified the line 

exec /usr/local/bin/rails server thin

in /etc/init/holla-app.conf

to 

exec /usr/local/bin/rails server thin -p 80

So that it runs on port 80.  Not secure.  Not recommended. etc.. But it does run. 

 

Site Search

Sharing

Random String

Some say he can divide be zero; and he was the cause of the big bang.

Blogish RSS Feed

Links