Install Trac on Dreamhost

I’ve just installed Trac on a sub-domain on Dreamhost. The best information I could find on this is at natmaster.com but the information does have one issue.

The instructions cause the required Python libraries to be installed in two places – some go into lib/python and others into lib/python2.3/site-packages. To make the installation work for me, I needed to add both locations to the PYTHONPATH environment variable in all the locations that define it.

becomes

It took me an hour to track down the error when running trac-admin.

SFTP Error with Deprec on Windows

Anyone who’s using Deprec from Windows is likely to run into a problem where they get a strange SFTP StatusException error. The stack looks something like this:

The bug is in a method called su_put that puts configuration files on the server using sudo. The temporary file name for this process is incorrectly generated if a /tmp directory does not exist on the client. This code should check for the /tmp directory on the server, not the client.

To workaround this, just create a directory called tmp in the root of the drive your project is on.

Ubuntu server on Virtual PC

Earlier this week, I was installing Ubuntu server 6.06 as a virtual machine on Microsoft Virtual PC 2007. When this OS boots, the screen freaks out and goes into a screen resolution that makes it impossible to do anything useful.

If you search for this in Google and others, all the information you find will point you towards X Windows configuration changes. Ubuntu server doesn’t have X Windows installed so none of that information is useful.

The only place I found that was useful was the What Works page for Virtual PC. Here is the relevant section:

At Grub press ESC and edit the kernel line to include the option vga=0×314. To make it permanent edit /boot/grub/menu.lst

Apache authentication Rails plugin

Do you use Apache to perform your authentication and want to hook this into your Rails app? Me too! I’ve just published a simple plugin that uses the REMOTE_USER variable set by Apache authentication modules to load up your User model and ensure the user is authenticated for the controllers and actions you care about.

Check out the Authenticate As Remote User plugin page for more info.

Action Cache plugin bug fixes

I’ve just checked in three fixes for the action_cache plugin.

I’ve also added a specific page to this site for details about the action_cache

Thanks to Paul Haddad and Timur Vafin for bug reports.

My best post on Rails page caching

I was going to write a great post about Rails page caching, but then I found Gregg’s post about page caching

There are two points I’d like to make to add to the Rails page cache knowledge base.

Firstly, if you use paging in your cached actions, then you must use the FileUtils method for sweeping these pages (unless you want to write code that checks for every possible page number and expires that page with expire_page, and you really don’t)

Secondly(?), if you are going to use the FileUtils to remove files from the cache, you don’t need to move the cache location. You only need to move the cache location if you want to delete the entire cache in a single call.

Rails page caching and monitor services

This evening, I added page caching to a Rails app I’m building. I want to cache the top page of the site (the index action), so I added the caches_page :index to the correct controller.

All was going well until I deployed to a ‘production’ server.

Doing a View/Source on my web page, I see urls that looked like http:// /foo/bar with a space replacing the server name. This isn’t good.

It took me a few minutes of looking at the Rails production log to see that, about every 60 seconds, something was hitting my site without a server name. What hits my site every 60 seconds? Monit does!

RedHat clever security system (where 'clever' is stupid)

So I’m getting my Rails app working on Apache on my virtual RedHat server, when something strange happens. The proxy to Mongrel works great and the app is running, but my static files aren’t coming down from the server – no images, CSS or javascript. These should be easy for Apache to serve up – what’s going on?

After looking in the Apache error log, I see that there’s a permission error for those files. No problem, set the flags with chmod and I’ll be onto the next thing.

No such luck.

With some quick Googling of the error, it seems that SELinux may be the issue.

My Favorite Rails Plugins

Ben has updated his plugin directory to allow you to mark plugins as favorites. I’ve added mine from my previous post on the subject

Ben details what he’s done here

Now if only I could get a list of these plugins as a widget for my sidebar – RSS would work, as Wordpress has a plugin for that.

Ben’s doing real work with OpenID too. Works great in this application (I think its going to take a while for real users to get used to having a URL for their identity, but programmers don’t have that problem)

Fun with Red Hat

I installed Red Hat for the first time this week. I’ve done Debian a number of times, but this was my first go around with the King of Linux. Here’s my thoughts on why Red Hat has yet to achieve world domination.

During install, you get to pick which packages to install. Under UI, I unchecked all the graphical UI options, cause I want to run a server. On first login after the install, the login system comes up in with a graphical UI.

The fix here is to boot in Single User mode and change a 5 to a 3 in /etc/inittab.

During install, I was asked for a root password, but never a user account. At the graphical login prompt, it informs me that root is not allowed to login. Now I have a system I can’t get into. Nice job.