Rock the Fat Knot was recently migrated from WordPress to
Byteflow. This migration also included moving the site to a Joyent Accelerator
running OpenSolaris. I wanted a good way to develop and test things out locally, so I created an OpenSolaris virtual machine on my Mac using VirtualBox.
I used an OpenSolaris 2008.05 disk for the install. It’s a newer build than what’s running in my Accelerator, but I’m OK with a close approximation for
this work. I was more concerned with running the same Python, mod_python, Apache, and MySQL builds. I followed this guide to get OpenSolaris up and running in a virtual machine. I had difficulties getting the VM’s network connectivity working.
I tried changing the VM’s network adapter to “Intel PRO/1000 MT Desktop (NAT)” and it worked. (Note: I’m using about a one year old Mac Mini. PC Net may work for others.) To get name resolution working, I had to add the entries from my mac’s /etc/resolv.conf to the /etc/resolv.conf in the VM.
I wanted to be able to access my Apache test server from the Mac, so I used VirtualBox’s VBoxManage program to setup some port forwarding. I ended up mapping
host ports 2222 for SSH and 4444 for http (no particular reason for choosing those ports).
I called my VM “OpenSolaris2008.05”, so I ran these commands from a terminal to configure the port mapping.
VBoxManage setextradata "OpenSolaris2008.05" \
"VBoxInternal/Devices/e1000/0/LUN#0/Config/httpd/GuestPort" 80
VBoxManage setextradata "OpenSolaris2008.05" \
"VBoxInternal/Devices/e1000/0/LUN#0/Config/httpd/HostPort" 4444
VBoxManage setextradata "OpenSolaris2008.05" \
"VBoxInternal/Devices/e1000/0/LUN#0/Config/httpd/Protocol" TCP
VBoxManage setextradata "OpenSolaris2008.05" \
"VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/GuestPort" 22
VBoxManage setextradata "OpenSolaris2008.05" \
"VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/HostPort" 2222
VBoxManage setextradata "OpenSolaris2008.05" \
"VBoxInternal/Devices/e1000/0/LUN#0/Config/ssh/Protocol" TCP
These commands map port 4444 on the Mac to port 80 of the OpenSolaris VM.
Likewise, port 2222 on the Mac is mapped to port 22 of the VM.
Now, I can test the site from Safari and Firefox on the Mac by navigating to
http://localhost:4444. I can also ssh to the vm using a command like this:
ssh -oPort=2222 vmuser@localhost
With a VM up and running, I exported my Wordpress blog data to a WordPress eXtended RSS (WRX) file.
Using WXRImporter.py from Greg Heartsfield
(see this thread on the byteflow-users list for usage),
I imported my blog data in the WXR file into my byteflow database.
To ensure that people didn’t lose my RSS feed, I added a few lines to my Apache configuration:
RewriteEngine On
#Redirect Wordpress RSS Feed to Byteflow
RewriteCond %{QUERY_STRING} ^feed=rss2$ [NC]
RewriteRule ^/$ feeds/rss/blog? [R=301,L]
This ensures that people using my old feed URL still find the latest posts.
I also added this rewrite rule in my dev VM for sanity (I seemed to be getting strange name resolution problems without it):
RewriteCond %{HTTP_HOST} ^localhost$ [NC]
RewriteRule ^(.*)$ http://127.0.0.1$1 [R=301,L]
The dev VM setup has been working out very well for me.
So far, I’ve not run into any issues when deploying changes out to my Accelerator. Testing things out locally, in a VM that’s pretty close to my Accelerator, is very nice. I’ve also been using VirtualBox at work to run a Windows VM. It’s shaping up to be a very nice product. It includes a nice set of command line utilities.
Anyone out there got tips for developing/testing apps that are deployed on a Joyent Accelerator? I know Joyent probably wouldn’t mind selling you a development accelerator, too.