Migrate Landscape Change Project to MacMini server

 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

[mysqld]
ft_min_word_len=3

Now start the server from terminal
 
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
 
Need to change root user password, get rid of anonymous users, add glcp user
 
From command line, start mysql
 
/usr/local/mysql/bin/mysql -uroot msql
 
use following commands
 
update user set Password=password("xxxxxx") where User="root";
delete from user where User="";
flush privileges;
create database GLCP_1;
grant all on GLCP_1.* to glcp@"%" identified by "yyyyyyy";
quit
 
Transfer the current database, again via terminal (note: all one line)
 
/usr/local/mysql/bin/mysqldump -hwebdb.uvm.edu -pxxxxxxx -uglcp GLCP_1 | mysql -uglcp -pxxxxxxxx GLCP_1
 

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

 

CVS/
INTERNS/
Jamie/
WORKING_FOLDER/
bak/
maintenance/
old_learn/
temp_store/
asset_store/
Archived Images tif/
bulk_store/
learn_dev/

run rsync

 

 

rsync -av –delete –rsh=ssh –exclude-from=/Users/glcp/rsync_excludes.txt –progress glcp@zoo.uvm.edu:/…/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 glcp@zoo.uvm.edu:/…/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 glcp@132.198.xxx.yyy:/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. 

 

 

About Wesley Wright

Born on a mountain top near New York City, Craziest state in the land of the pretty. Raised in the woods so's he knew every tree, Killed him a bear when he was only three.
This entry was posted in Landscape Change, Projects, Scripts - Programming, Systems and Servers. Bookmark the permalink.

Leave a Reply