UPDATE: Re-posted for the RailsConf Europe attendees. Thanks for the warm welcome; great crowd. Hope the end wasn’t TOO abrupt. ;-)
Thanks to everyone who came out to my talk yesterday at RailsConf. That has to have been my favorite speaking engagement of the last year. Great crowd at a great show.
I got several requests for the slides and source code. The slides themselves are kind of useless; I don’t believe in writing slides that make people read. Slides are there for either entertainment or reminder purposes only. However, you can download them here if you might find them helpful.
On the other hand, source code is a much more useful take-away from a technical talk. You can download the code here. However, that source code is going to be useless without some background.
Things you will need to install
There are a variety of things you will need in order to get the sample to run. Most are gems, but one is a Java library. None of it is too hard.
RubyCas Server
First, head over to the QuickStart guide, which will walk you through downloading and installing the gem. In particular, go and look in the config file and modify it to match your specific configuration. For the purposes of my demo, I used the webrick server settings, and put it on port 80 with no SSL. However, if you want to test with SSL on, webrick is still the easiest solution since it supports SSL out of the box; if you go Mongrel, you’ll have to front it with Apache, and for local testing, that’s overkill.
You will then need to set up two databases; one for rubycas-server itself, and one for user accounts for the authenticator. Here’s what my settings look like:
database:
adapter: mysql
database: casserver
username: root
password:
host: localhost
authenticator:
class: CASServer::Authenticators::SQL
database:
adapter: mysql
database: campus_users
username: root
password:
server: localhost
user_table: users
username_column: username
password_column: password
Don’t forget to actually create those databases. ;-)
The projects require rubycas-client, which you can install as a gem, but is embedded in the source code as a plugin.
UPDATE: Don’t forget to actually start rubycas-server.
> sudo rubycas-server
ActiveMQ
For the Rideshare part of the application, I used ActiveMQ as the back end messaging system. I used the 5.1.0 release for the demo; it runs on the JDK that is installed on the Mac without problem, no need to fiddle with your JDK install. Other platforms, just read the release notes and make sure you have the right bits.
ActiveMQ is configured to work on standard local ports out of the box, and the Stomp connector is enabled by default, so all you should have to do to get it up and running for the sample app is navigate to the root directory of the exploded tarball and execute:
> bin/activemq
That’s it. You will, however, have to install the Stomp gem for the sample to work.
> sudo gem install stomp --include-dependencies
To get it all running
- Install RubyCas server and its databases. Populate the rubycas central user data with some accounts that have the same logins as the cas_user values in the fixtures from the application. For example, in the users.yml fixtures, there are records with cas_user=jgehtland. Make sure the RubyCas server authentication table has a user with login=jgehtland.
- Install ActiveMQ and get it running.
- Unzip the source code.
- Create the databases for the two apps and load their fixtures into the development environment.
- Run the Enrollr application on port 3000.
- Run the DormPickR application on port 3001.
- Point another browser window at localhost:3001/sender/send_ride_notice?city=Atlanta to pump messages into ActiveMQ. You can change the city and resend to create multiple pending messages.
That’s pretty much it. Drop a comment if that isn’t working for you (it is absolutely possible I forgot a required step or gem; if so, I’ll fix the instructions).
I’m also planning on writing up the talk as a series of posts starting later today that address each of the major areas in much more detail, so check back when you can.
Thanks again if you came to the talk!
Comments
First off… Thank you for the awesome talk. I’d wanted to roll some parts of our application out into a separate app for a while but never knew how to tackle it.
I think you want the localhost:3000/sender/send_ride_notice?city=Atlanta to be to port 3001, since the DormPickR app is running on 3001 and it is the one with the sender controller.
When I do get it to redirect me to the login page I get hit with a “Server cannot be found” I have all the databases and tables set up, I have ActiveMQ up and running with your configuration and I am using webbrick to fire up the 2 apps. Any idea where I could be screwing up, or have something misconfigured?
Howdy!
Thanks for the great talk! This talk provided the most practical, take-home kinda learning i got all conference. Definitely “relevant”. :) Many thanks for the quality material, presented well (and the follow-up blog posting!).
As i’m thinking about implementing this in a site i’m working on, I have a question…
What is the down side to having more overlapping databases/tables? In your example, both apps share the preferences database. How about it just calling it “shared_data” and putting in as many tables as are needed? What are the downsides to this approach?
Shane—Did you start up rubycas-server? The way I read it, your apps are up, but the login page is what is giving you the error, which means you haven’t started the rubycas-server app. It should be as simple as:
If I’m reading your question wrong, or that doesn’t help, let me know. I’m updating the blog to mention that.
brookr—the only major downside is limiting the total throughput gains you might achieve. Every time you have two apps hitting the same database, you have a single point of failure/bottleneck for both apps. So you are only getting half the benefit of the separation. There is no problem making a single shared database (“shared_data”) but you want to minimize how much is shared, and how often you access it.
I sure did forget to start up the rubycas server :)
I have it working now, but there still seems to be some issues with the source download. Most noticeably there is no dorms dir in the views directory of dormpickr which makes the index of that app fail giving a missing template error.
Once again thanks for the help and the awesome presentation, I can’t wait to build up a prototype using this technique
Hah! First comment from RailsConf Europe on this talk! :-)
That was by far the best talk on the entire conference so far.
Your subject is very hot, and you have a very engaged way of delivering the message. Thanks!
- Carsten
As others have already said: Thanks for a very entertaining and infomative presentation.
I agree with Carsten Gehling – that was by far the best talk I’ve attended during this conference.
Lots of fun and very relevant. Problem is, it made me realise that I need to go setup rubycas now and integrate it with company’s intranet apps :-)
Thanks for this great presentation at RailsConf Europe 2008 – it was a really highlight for me!
Just one question – doesn’t the usage of a central CAS (for SSO) and a single MessageQueue imposse single points of failure?
I’d like to get some hint on how to cluster / hot-failover those two components ?
Thanks! Rene
Hi Justin,
thank you for this excellent and very funny talk. It was the best talk on the conference. Looking forward to hear see you around next year ;)
Greetings from Berlin, Marcel
Great performances Justin, congrats!