February 26, 2007

Geek

Irrits

I had a couple of must-do items before I started the Minx beta tests:

  • Switch from the built-in CherryPy session storage to a MySQL back-end
  • Not run the darn thing as root
I've spent the past five hours on these two items.

They should be simple.

In the case of the CherryPy session storage, the CherryPy docs are (a) incomplete and apparently (b) wrong. It looks like the only way to plug in your own session storage module is to directly hack the CherryPy source. It's not supposed to be that way, but if I have to, I can do that.

In the case of not running as root, well, there's a couple of ways to do it. The main problem is that Minx has to listen on port 80, and only root can listen on port 80, and running as root is a Bad Idea.

One way around this is to change the userid after startup, when the port is already established. I'm not sure why, but this causes Minx to lock up after the first request. Another is to use Apache and mod_proxy, but there's no way in hell I'm going to all that trouble. I'm doing all this in large part to get away from frigging Apache. Another way is to use a reverse proxy like Pound. I tried that, and it kind of worked. (It looked like it was broken, but that was actually due to the lockup problem I mention above. I expect if I try it again it will work flawlessly... Yep. Okay, so that at least isn't time wasted; Pound could well prove useful as we roll out more servers.)

Another way is to use iptables redirects. This is the simplest and most reliable way, and doesn't bloody work on my system. It works fine on my other Linux box, but not on the Minx test box, and not on the Minx production box. Why, I don't know. But iptables dnat does work, as it turns out, two hours of intense frustration later. I'm guessing that the redirect was redirecting to the wrong IP - localhost, or something. Minx binds itself to a specific IP so that I can run multiple instances per server, so that I can balance across the CPUs. (Python is multi-threaded, but only one thread can be executing Python code at any time. OS calls are multi-threaded, but the data crunching isn't. So to get the most out of Minx on our multi-processor servers, I'm using multiple instances of Minx and round-robin DNS.)

Uh, anyway. Currently working in a secured environment with file-based sessions. That will do for the beta test, and allows me to check off item 0 on my bug list. That leaves 22 items, plus one marked "bah".

Update: Bandwidth logging, which required using CherryPy callbacks, something I hadn't used before, worked second go. Much better.

Posted by: Pixy Misa at 09:15 PM | Comments (15) | Add Comment | Trackbacks (Suck)

1 Hello. That's very nice site but I've seen this before here:
[url]http://bb2.inguaro.com/04c3018c9a64529a68e4bdc26d018b94[/url]
04c3018c9a64529a68e4bdc26d018b94

Posted by: Deshawn at March 18, 2009 04:49 PM (jl21o)

Hide Comments | Add Comment






Processing 0.01, elapsed 0.0076 seconds.
16 queries taking 0.0038 seconds, 23 records returned.
Page size 9 kb.
Powered by Minx 0.8 beta.