Installing Holla - Ruby HTTP Campfire Clone
Installing Holla - Ruby HTTP Campfire Clone
Join the DZone community and get the full member experience.Join For Free
Campfire is a really rather sexy HTTP based chat system provided by 37 signals.
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.
root@holla:~# apt-get install zlib1g zlib1g-dev build-essential libcurl4-openssl-dev ...
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.
root@holla:~# mkdir sources root@holla:~# cd sources/ root@holla:~/sources# wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
root@holla:~/sources# tar xzvf ruby-1.9.3-p125.tar.gz
root@holla:~/sources# cd ruby-1.9.3-p125 root@holla:~/sources/ruby-1.9.3-p125# ./configure
... Lots of Stuff ...
... This bit took ages ...
root@holla:~/sources/ruby-1.9.3-p125# make test
... This bit took ages too...
root@holla:~/sources/ruby-1.9.3-p125# make install root@holla:~/sources/ruby-1.9.3-p125# ruby -v ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
Right.. Next bit.
Ruby 1.9.2 [*] - Done
Bundler [ ]
Redis [ ]
root@holla:~/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 root@holla:~/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' ... root@holla:~/sources# apt-get install libyaml-dev root@holla:~/sources# gem install psych ... Successfully installed psych-1.2.2 root@holla:~/sources# gem install bundler Fetching: bundler-1.0.22.gem (100%) Successfully installed bundler-1.0.22 1 gem installed
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.
root@holla:/etc/init# vim redis-server.conf root@holla:/etc/init# start redis-server redis-server start/running, process 8388 root@holla:/etc/init# status redis-server redis-server start/running, process 8388
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? :(
root@holla:/etc/init# apt-get install g++ curl libssl-dev apache2-utils root@holla:/etc/init# apt-get install git-core
root@holla:~/sources# git clone git://github.com/ry/node.git
F*ck that. It's huge.
root@holla:~/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
root@holla:~/sources# cd .. root@holla:~# mkdir app root@holla:~# cd app root@holla:~/app# git clone https://github.com/maccman/holla.git root@holla:~/app# cd holla/
Now dependencies.. libxml2 and libxslt and libsqlite3-dev
root@holla:~/app/holla# apt-get install libxml2 libxml2-dev libxslt1-dev libxslt1.1 libsqlite3-dev
root@holla:~/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.
root@holla:~/app/holla# start redis-server root@holla:~/app/holla# rake db:migrate root@holla:~/app/holla# rails server thin root@holla:~/app/holla# gem install rails root@holla:~/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 .
Just need to change "localhost" to the hostname of your Holla server, save it and restart the rails app.
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"
description "holla push server" start on runlevel  stop on shutdown exec /usr/local/bin/juggernaut --port 8080 respawn
description "holla push server" start on runlevel  stop on shutdown chdir /srv/holla exec /usr/local/bin/rails server thin respawn
root@holla:~# start holla-app root@holla:~# start holla-push
And the server's working on 0.0.0.0:3000, with push message support.
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
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.
Published at DZone with permission of Tom O'connor , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.