Today was a Thomas “all the ways it won’t work” Edison day. I learned fifty ways to break a DSpace installation. At least. Warning: heavy tech talk coming. I’m not sure I understand half what I’m about to say.
The problem I’m trying to solve actually shouldn’t be that hard. I wanted to kill the 8080 port number out of the DSpace install’s URL, and have the server make believe that the DSpace install lives at http://stageserver.mpow.edu (no, that’s not the real URL; all y’all don’t need to be trampling around my staging server) instead of at http://stageserver.mpow.edu/dspace/ where it actually lives).
You. Would not. BELIEVE. How hard. This really is.
The basic problem is that none of the DSpace, Tomcat, or JBoss docs are written for OS X Server. Whatever little haxxie I try, I have to translate into OS X’s view of the world, which isn’t the same as Linux’s or Solaris’s or anybody else’s. I spent a lot of time today messing with files that had nothing to do with anything. Moreover, a lot of the out-of-the-box config files contain commented-out stuff that may have worked three years ago but surely doesn’t now.
First I tried a Tomcat config hack emailed me by a friend, which didn’t work (I think) because it didn’t take JBoss into account. Next I tried getting mod_jk set up, since much of the work looked to have been done already. I failed. Wow, did I fail. I failed so regularly and so often that my poor boss had to move his weblog off the machine because I was bringing the server up and down so often testing new variations. (He was a perfect gentleman about it, I must say. I felt awful.)
I tried messing with iptables briefly, only to find that OS X has very particular notions of these things, and I don’t know enough to set it up correctly. More breakage, lots more.
At some point I had it auto-redirecting to port 10680 because of a VirtualHost directive that I think managed my boss’s blog. This is probably how I fried the blog in question. (Well, one way, anyway.) Fixed that by putting another VirtualHost on port 80.
I do have half the problem solved. On a tip from the DSpace wiki, I put ProxyPass and ProxyPassReverse directives into the port 80 VirtualHost that did indeed kill the port number dead. What I couldn’t make them do was cope with the /dspace/ directory; if I put /dspace/ onto the end of the rule, I got to the front page, but every other link (CSS files, image files, links to the interior of DSpace) was dead broken, I think because it was looking for things in /dspace/dspace, which obviously doesn’t fly. I tried fixing the URL in dspace.cfg to account for this, but it didn’t work.
So when I undid those “fixes,” http://stageserver.mpow.edu/dspace/ worked right beautiful, but http://stageserver.mpow.edu/ brought up the Tomcat default page. (I spent a quarter-hour figuring out where the Tomcat default page actually was on the server. I really did.)
I tried mod_rewrite, but I was getting pretty punchy by this time, and couldn’t make it work. I think the issue may be that mod_rewrite takes precedence over mod_proxy, so I can’t rewrite the /dspace/ directory without blowing the port-8080 redirection. The other possibility is that I wasn’t writing the right RewriteRule (say that three times fast).
The aforementioned wiki page has a JSP haxxie which I got to work (after much futzing), but it doesn’t do a nice silent URL rewrite, oh, no. It says “Oh, you want stageserver.mpow.edu? Well, here’s stageserver.mpow.edu/dspace/.” Which is exactly what I’ve already got and don’t want. I mean, it’ll do, because anyone who goes to http://stageserver.mpow.edu/ will get to DSpace, but there’s got to be a better way.
I’m pretty much out of ideas. Anybody else got any?