On paper, this seems easy. Just move 70 GB of images and a dozen database tables to a brand new mac, and we’re done.
Well, not quite…
Step 1: prepare the mac out of the box
This was mostly straight-forward; however, I did a couple of things a little different hoping it would minimize problems down the road.
First, run Setup Assistant and create admin account. called it glcp, just to match what was on original host site. Since all the original files were owned by this user, it seemed a nice convention.
Now tricky part: files will be transferred by rsyc, which preserves UIDs and GIDs. So, I needed to create a new group (glcp) and give it and the glcp user the same numeric IDs found on the original host (uid=56774, gid=199976).
Changing the UID for glcp was easy, using System Preferences=>Accounts=>Advanced, as was assigning the primary group ID. But I still needed to create a group that matched. So, open terminal and type
sudo dscl . -create /Groups/glcp gid 199976
Step 2: Reconfigure web services, part 1
The Mac will run Apache and php right out of the box; however, not quite the way we want it.
First, create new top level folder /landscape . Everything (code, HTML, data) will go here. Set owner and group to glcp:glcp
Now, edit /etc/apache2/httpd.conf:
- uncomment #LoadModule php5_module libexec/apache2/libphp5.so
- change document root to DocumentRoot "/landscape"
- change to
- change AllowOverride All
- change DirectoryIndex index.html index.php
Step 3: Set up and populate mySQL
First, download mySQL OS X install package. Install the server and the Startup package.
Out of the box, will only index words >=4 characters. So create a little file /usr/local/mysql/my.cnf and insert these lines
Step 4: Get the code and other files
We can suck up the code from zoo using rsync, but we can’t get everything in one bite, nor do we want everything. Create a text file /Users/glcp/rsync_excludes.txt of stuff we don’t want
Archived Images tif/
rsync -av –delete –rsh=ssh –exclude-from=/Users/glcp/rsync_excludes.txt –progress firstname.lastname@example.org:/…/uvm.edu/fs/geology/landscape /
Cool, so we’ve got the code. Now the asset_store. Turns out it is too big to get all at once, so we do it folder by folder
rsync -av –delete –rsh=ssh –progress email@example.com:/…/uvm.edu/fs/geology/landscape/asset_store/00 /landscape/asset_store
It would be nice to script this, but alas, each iteration requires a password, unless one employs SSL keys. But alas, SSL keys don’t work when connecting to zoo, so we need to make the connection from zoo to the mac Mini.
Creating the keys and what-not was gleaned from this document, which hopefully will remain on the web for a while. When following the recipe, consider zoo as the local machine and the mini as the remote machine. Now, we can create a script with commands like this
rsync -av –delete -e "ssh -i /users/g/l/glcp/.ssh/glcp-zoo-key" –progress /:/geology/landscape/asset_store/00 firstname.lastname@example.org:/landscape/asset_store
I need to work on that script a bit, make it iterate over all exiting asset_store folders.
Took maybe 17 hours to send the 70+ GB of data
Step 5: Edit code
Most of the editing is in global.h.php, changing master paths and URLs. Also, many references the $GLOBALS[‘SERVER_NAME’] apparently need to be changed to $_SERVER[‘SERVER_NAME’]. Also, need to change path for parser.php in those .htaccess files that contain that reference.
Step 6: test and explore dead-ends
Now we can test, and see what we missed.
The first thing missing was GD graphics support in PHP. Apparently, this doesn’t come with the php distributed with Leopard. We need it to draw maos and graphs. I tried following these instructions (for 64 bit CPUs), which enabled GD support, but the Freetype libraries don’t seem to work, causing severe server errors when drawing text on images.
Another issue is Google Maps interface: complains that the key used is not registered, but probably doesn’t matter since it won’t work without real network connection
And that’s where we sit today. Will try getting a whole new php package using Fink, or maybe even rebuild from source, and try again.