I've been using WebFaction for my hosting for a while now, and have been extremely pleased with them. In addition to the fantastic service I've received, I've been very impressed with the intelligent way they have their servers setup. They've clearly done a lot of work to make things as modular as possible which makes it insanely easy for me to run multiple sites with very different requirements seamlessly on the same server.
Basically what they've done is segment out all of your different websites into 'applications'. Each application in represented as a directory in your ~/webapps/ directory, and is essentially a self-contained environment with it's own apache instance, and, in the case of a Django app, it's own $PYTHONPATH. The end result is that even though all the websites are being stored and run from within my home directory, they're entirely modular, can have different, or different versions of the same, dependencies installed, and can be shut down and restarted independently of one another. On top of all this is a fantastically simple custom web-based control panel that I'm pretty sure is built with Django.
I've been so impressed with how well this setup works, that I've decided to duplicate it on my home server for development purposes. Currently I do pretty much all my development work on my Gentoo Linux powered ThinkPad. To that end I've installed Apache, MySQL, PostgreSQL, SQLite, Python, PHP, &c.; to allow me to mimic the live sites as closely as possible and to allow me to continue working when I don't have internet access (such as when I'm flying or visiting Jessi's family out beyond the reach of broadband). This works very well, but as I'm just using a basic Apache install, without any VirtualHosts, it's not nearly as flexible and means I can really only work on a single site at a time with some work necessary to switch back and forth between projects. Of course most of the time I just use Django's built-in development server when working with Django, but I do end up relying on Apache sometimes, and I'd like to set up my home server as a more complete development environment for both myself and some friends I can grant VPN access to. So to that end I've been looking into WebFaction's setup with the idea of re-implementing it myself.
Turns out it's pretty simple. Simple enough that I almost feel like I should have thought of it myself. Basically, WebFaction's setup scripts create a new 'app' in your ~/webapps/ directory, and populate it, most importantly with a copy, owned by your user, of the Apache executable, some scripts to start, stop, and restart that executable, and an httpd.conf file that sets the (in the case of a Python-based app) $PYTHONPATH variable to include a ~/webapps/yourappname/lib/python2.5/ directory allowing each site to maintain it's own dependencies independently (you can also put things in your ~/lib/python2.5/ for global dependencies if you want). Oh, each application also gets it's own copies of the necessary Apache modules to the same effect. Each application's Apache instance(s) is set up to listen to a different (non-80) port. The end result of this is an extremely simple, extremely modular setup that works fantastically.
Obviously I've left out a step here. If each Apache isntance is listening to a different, non-80, port, how does your traffic get to your actual site? This is the one part that I can't really just peek into the configuration files for, because it doesn't (as far as I can tell, which makes sense) live on the same server as my sites. I assume that what's happening is that WebFaction's name servers are simply pointing requests to (for example) joshourisman.com:80 at my.webfaction.server:portnumber. Again, a simple, yet elegant solution that allows for easy customization and expansion.
I haven't yet tried to implement this setup myself (I first want to move my server from FreeBSD to Linux (which now that I'm using full-time again I'm just much more familiar with), but there's nothing about it that's particularly tricky. Really, the routing is probably going to be the hardest part, but I'm planning on replacing our rather lackluster TrendNet wireless router with a Linux box which will give me much greater control and (hopefully) better reliability.
Google Analytics tells me that my post on problems with MobileMe is currently one of my most popular, so I thought I'd write a little more about that.
As I said before, I had been having some big problems with MobileMe. For a while, my iPhone simply wasn't syncing at all. Since I do a lot of work at home where I have access to my iMac, but also do a lot of work elsewhere on my Thinkpad this was a bit of a problem. Initially I got around this by migrating to Google Calendars. But, to be honest, this didn't last for long. My approach was to import my iCal calendars into Google, then subscribe to them in iCal via CalDAV. This worked decently well, and allowed me to keep my calendar in sync on Google, iCal, and, via syncing through iTunes, my iPhone. It was a bit more cumbersome, but at least I had full access to my calendar wherever I went. The main problems with this were that on my iPhone, the Calendar app didn't have write access, I'd have to go into Safari and edit the calendar that way if I wanted to do it on my iPhone (a process which I don't really like; I'm not a huge fan of web apps in general). The other problem was being tied to syncing through iTunes again. In the brief time that MobileMe worked propertly, I got very attached to my over the air syncing, and didn't really like giving it up.
Long story short, it didn't take that long for MobileMe syncing to start working again, and I switched back and have been very happy since. Since I can still access me.com/calendar in Firefox on Linux by simply changing my user agent (and it works perfectly), I really have no motivation to use anything else. So for the foreseeable future I intend to stick with MobileMe for my calendaring needs. If apple offered some sort of hosted MobileMe the way Google does with Gmail I might even switch to that so that I could have full integration of all my tools (it's annoying that the address book on my mac and my iPhone isn't the same as my gmail address book, and the syncing between the two is so horrible that I have no desire to touch it ever again).
Another alternative I'm somewhat considering is Zarafa. Zarafa offers a drop-in Exchange replacement that, basically, exactly duplicates all of Exchange's functionality including the ActiveSync that iPhones now support. Even better, they just open-sourced it. This is actually a fairly attractive possibility as it would give me everything I like about MobileMe, plus all the other advantages that an Exchange solution would offer except for the licensing costs (and hopefully some of the annoying design decisions, though I don't know enough to really say yet). The downside, of course, is that I'd have to maintain my own server (or pay for a hosted solution, if such a thing exists). But I do know a number of other small business owners who could probably benefit from such a thing, so I could probably go in with them on a server to run Zarafa for all of us (and maybe even get them to pay me to maintain it and such). It's certainly worth considering at any rate. I may try and set it up on either my Gentoo-powered Thinkpad or my FreeBSD server at home and give it a whirl.
View Comments
Tags:
apple,
calendar,
email,
freebsd,
gentoo,
iphone,
mobileme,
push email,
sync,
thinkpad,
zarafa
A couple of weeks ago, Memorial Day Weekend actually, Jessi and I finally got a TV. I had been planning on a 42" Olevia 720p display with no tuner, because it was an incredibly good deal on Newegg, but then I found an even better deal at Best Buy, and was able to get a 42" Insignia 1080p display with a tuner for just about $100 more. So we've now got a 42" 1080p TV hooked up to some cheap rabbit ears I picked up at Radio Shack. It's pretty awesome just for the irony factor of that alone, but with those cheap rabbit ears we're able to pick up a good 20 digital stations, about half of which are in HD as well as a number of analog stations. So we'll be able to watch, for example, the Olympics in all their HD glory without the need for cable or satellite.
As I've mentioned before, my intention has been to set up some sort of HTPC to manage the content for the TV. I went back and forth before deciding on ElGato's EyeTV on a Mac Mini over MythTV on a PC, but in the meantime I didn't really want to spend the $500+ on a mini, so I set up an old gaming PC I built a couple years ago and hooked it up to the VGA input on the TV. At first, just to try and get things going quickly I installed Ubuntu on it. This proved to not really work at all. Ubuntu could see, but not use the integrated sound card on my motherboard, and video without sound isn't very fun. I probably could have fixed that with a little tweaking, but there was a bigger problem: my 5-ish year old Athlon 64 3000+ just didn't appear to be up to the task of playing HD video. I decided to give it a real test: a 1080p rip of the BluRay version of The Fifth Element in a matroska container using H.264 encoding. Basically, it just didn't work at all. So I decided to scrap that idea and just set it up with MythTV for now so we can at least watch TV with basic PVR options.
I threw an Gentoo on it, and got MythTV running (with sound!) and started planning out the new system to replace it. Then I figured, what the hell, my entirely system from the kernel to mplayer has been compiled from source and optimized for the Athlon 64 architecture, I might as well give the HD video another shot. Amazingly, mplayer opened the 1080p matroska video and played it. Success! It did have some issues with the audio going out of sync, but some command line flags fixed that ('-cache 8192 -autosync 1' is what ended up working). So, it appears, a 1.8 GHz single core Athlon 64 can decode 1080p H.264 in real time! This discovery vastly dropped the minimum hardware requirements, and thus the cost, of a MythTV based HTPC so I decided to give that option another look. A bit of research later, and I was able to spec out a full HTPC with HDMI output and all that good stuff for just about $200.
It's hard to argue with those numbers, so it looks like I will be going with a MythTV solution after all. I'll be using a 2.2 GHz dual-core Athlon 64 X2, which my experiment suggests will be more than adequate for what I need and, of course, powering it all with a fully optimized Gentoo install. I'm going to keep the old gaming PC running as my backend for all the storage so I don't need to cram too much into the tiny little case I'm getting for the HTPC, and trying to figure out the final design for that system is proving to be an interesting problem in it's own right, but I'll write more about that later in what I'm sure will be a fascinating exposition on the relative merits of various advanced filesystems and the several different UNIX-like operating systems that love them.
I've been working away from home more and more often lately, and the 13" screen on my MacBook has been feeling more and more restrictive. So I decided to replace it with a something bigger. Obvoiusly my first thought was a MacBook Pro, but they're just so expenssive that it's hard to justify the cost. So instead, I bought a ThinkPad. I got a T61 with a 15" WSXGA+ screen, 802.11n, dual-layer dvd burner, 2.5 GHz Core2Duo... basically the exact same features (and even hardware probably) as a MacBook pro. The biggest difference? I spent less than $1000 dollars on it.
This is actually my second ThinkPad; I had an x61 that I bought in college and actually used as my main computer when I first moved to Boston because my PowerMac was in-transit and I didn't have anything else. I've also been impressed with the ThinkPad line, the higher end ones have very nice build quality, and they're popular enough with the Linux crowd to have good Linux support. So, for the second time in my life, I'm running Linux as my main OS (specifically Gentoo Linux on kernel 2.6.25 with the tuxonice patches).
The biggest issue with using Linux was finding the appropriate replacements for my commonly used apps. Most of them were Easy: Firefox stays the same, I use Google Apps to host my email so no problems there either. For instant messaging I was planning on using Pidgin, but ended up going with Kopete because after trying it out, I just like it better (that's right, I'm using KDE, 3.5 for now). The biggest challenge, was trying to find something to replace TextMate for coding in. I absolutely love TextMate, and take advantage of a lot of its advanced features all the time. Fortunately, back when I was a CS student, I got nice and familiar with Emacs, and was well aware that, even if the functionality I wanted wasn't built in, someone's probably created an add-on for it, and if not it would be pretty simple for me to do it myself. Turns out I was right.
I haven't completed all my Emacs modification yet, but so far just two little scripts have given me most of what I was looking for. First was yasnippet, which provides a snippet feature that works in pretty much the exact same was as TextMate's. Someone even wrote a script that will download TextMate bundles directly from the repository and covert the snippets they contain to work with yasnippet. You can't do much better than that. I'm also using emacs-textmate which provides an Emacs minor mode that emulates some more of TextMate's behaviors; specifically, it adds in the ability to automatically insert paired characters, so if you type '(' it automatically inserts ')', and handles deleting them gracefully as well.
There were a few other features that I use extensively in TextMate as well that weren't provided by either of these add-ons. Fortunately, it was relatively simple for me to implement them myself (with a little help from a friendly Emacs guru on the Gentoo forums) and patch emacs-textmate to provide it. Specifically, I duplicated TextMate's auto indent feature by adding an extra keybinding to emacs-textmate to bind the return key to the built-in Emacs function newline-and-indent. I also bound M- to a new function of my own creation defined thusly:
(defun open-next-line()
(interactive)
(move-end-of-line nil)
(newline-and-indent))
This duplicates the behavior of command-return in TextMate, which is pretty much the same as 'o' in vi[m]. I'm still working on how to duplicate command-shift-return, which inserts the appropriate line ending character based on language (';' for C and C-like languages, ':' for Python, &c.;) and then opens and goes to the next line. But I don't think that will be too hard once I learn a little more elisp. After that I just need to figure out how to duplicate Textmate's tag closing function, which is a huge time-saver when coding HTML.
All in all, I'm quite happy with my new computer. Things may not be quite as pretty as in OS X, but they can be if I just put a little work in to making them so (I've already got e17 installed, which comes close and with some more tweaking may replace KDE as my default environment). As much as I love Mac OS X, there is definitely a strong argument to be made for Linux, at least for people who aren't afraid to get their hands dirty with the command line and a good old text editor. Even with just a couple days spent adjusting the system, I think it's already at a point where I could see using it full time, maybe even prefer it to OS X. Which is really saying something when you consider that I've been a Mac user for about 24 years.
This will be my second post written from my iPhone. I'm currently in the middle of nowhere in Illinois at Jessi's mom's house. We'll be here until the 30th, which means I'll have some work to do on the trip. On my previous visits here there was always a wifi network available from one of the neighbors who was kindly sharing his sattelite Internet connection with the rest of the town (it's a very small town and they can't get cable or DSL out here). Sadly it turns out that someone had been using up his monthly bandwidth allotmen so that's no longer available to me. Hence me writing this entry from my iPhone.
Fortunately, I came prepared to work without Internet access. I had planned to do some work on the flight over here, so before I left I created a new Parallels virtual machine and installed a copy of Gentoo Linux in it, and set up a lighttpd server with PHP and Python running in FastCGI as well as SQLite and MySQL so I could do both PHP and Django development without having to only guess at whether or not it would actually work (technically this wasn't necessary for Django since it comes with a lightweight development server built-in, and OS X comes with SQLite installed standard, but I figures I might as well).
I also tried setting up Tinyproxy on my iPhone so I could share my iPhone's EDGE connection with my laptop for browsing, but for some reason it doesn't seem to be working even though I had no problem with it at home.
The end result is that, even though I have no real Internet access to speak of, I can still do my work. I can even keep in touch with everyone thanks to my iPhone and meebo, and, if the need were to arise, I could always set up an SSH tunnel through my iPhone and get SFTP access to my webserver (or any other, for that matter) that way. So even way out here where they don't even have DSL, I'm still fully connected. This is one of those times where, even though I spend pretty much all my time working with technology, I'm still completely amazed by it.
Now, I believe, it's time for dinner.