{"id":586,"date":"2008-05-30T14:57:32","date_gmt":"2008-05-30T18:57:32","guid":{"rendered":"http:\/\/www.uvm.edu\/~waw\/blog\/?p=586"},"modified":"2008-05-30T14:57:32","modified_gmt":"2008-05-30T18:57:32","slug":"migrate-landscape-change-project-to-macmini-server","status":"publish","type":"post","link":"https:\/\/blog.uvm.edu\/waw\/2008\/05\/30\/migrate-landscape-change-project-to-macmini-server\/","title":{"rendered":"Migrate Landscape Change Project to MacMini server"},"content":{"rendered":"<p>&nbsp;On paper, this seems easy. Just move 70 GB of images and a dozen database tables to a brand new mac, and we&#8217;re done.<\/p>\n<p>Well, not quite&#8230;<\/p>\n<h2>Step 1: prepare the mac out of the box<\/h2>\n<p>This was mostly straight-forward; however, I did a couple of things a little different hoping it would minimize problems down the road.<\/p>\n<p>&nbsp;<\/p>\n<p>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.<\/p>\n<p>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).<\/p>\n<p>Changing the UID for glcp was easy, using System Preferences=&gt;Accounts=&gt;Advanced, as was assigning the primary group ID. But I still needed to create a group that matched. So, open terminal and type<\/p>\n<p style=\"margin-left: 40px\"><b>sudo&nbsp;dscl . -create \/Groups\/glcp gid 199976<\/b><\/p>\n<h2>Step 2: Reconfigure web services, part 1<\/h2>\n<p>The Mac will run Apache and php right out of the box; however, not quite the way we want it.<\/p>\n<p>First, create new top level folder \/landscape . Everything (code, HTML, data) will go here. Set owner and group to glcp:glcp<\/p>\n<p>Now, edit \/etc\/apache2\/httpd.conf:<\/p>\n<ul>\n<li>uncomment&nbsp;#LoadModule php5_module &nbsp; &nbsp; &nbsp; &nbsp;libexec\/apache2\/libphp5.so<\/li>\n<li>change document root to &nbsp;<b>DocumentRoot &quot;\/landscape&quot;<\/b><\/li>\n<li>change&nbsp;<b><\/b>&nbsp;to&nbsp;<b><\/b><\/li>\n<li>change&nbsp;&nbsp;&nbsp; &nbsp;<b>AllowOverride All<\/b><\/li>\n<li>change&nbsp;&nbsp;&nbsp; &nbsp;<b>DirectoryIndex index.html index.php<\/b><\/li>\n<\/ul>\n<h2>Step 3: Set up and populate mySQL<\/h2>\n<p>First, download mySQL OS X install package. Install the server and the Startup package.<\/p>\n<p>Out of the box, will only index words &gt;=4 characters. So create a little file \/usr\/local\/mysql\/my.cnf and insert these lines<\/p>\n<p style=\"margin-left: 40px\"><tt>[mysqld]<br \/>\n<\/tt><tt>ft_min_word_len=3<\/tt><\/p>\n<div>Now start the server from terminal<\/div>\n<div>&nbsp;<\/div>\n<div><b>sudo&nbsp;\/Library\/StartupItems\/MySQLCOM\/MySQLCOM start<\/b><\/div>\n<div>&nbsp;<\/div>\n<div>Need to change root user password, get rid of anonymous users, add glcp user<\/div>\n<div>&nbsp;<\/div>\n<div>From command line, start mysql<\/div>\n<div>&nbsp;<\/div>\n<div style=\"margin-left: 40px\"><b>\/usr\/local\/mysql\/bin\/mysql -uroot msql<\/b><\/div>\n<div>&nbsp;<\/div>\n<div>use following commands<\/div>\n<div>&nbsp;<\/div>\n<div>\n<div><tt>update user set Password=password(&quot;xxxxxx&quot;) where User=&quot;root&quot;;<\/tt><\/div>\n<div><tt>delete from user where User=&quot;&quot;;<\/tt><\/div>\n<div>\n<div><tt>flush privileges;<\/tt><\/div>\n<div><tt>create database GLCP_1;<\/tt><\/div>\n<div><tt>grant all on GLCP_1.* to glcp@&quot;%&quot; identified by &quot;yyyyyyy&quot;;<br \/>\n<\/tt><\/div>\n<div>quit<\/div>\n<\/div>\n<div>&nbsp;<\/div>\n<div>Transfer the current database, again via terminal (note: all one line)<\/div>\n<\/div>\n<div>&nbsp;<\/div>\n<div style=\"margin-left: 40px\"><b>\/usr\/local\/mysql\/bin\/mysqldump -hwebdb.uvm.edu -pxxxxxxx -uglcp GLCP_1 | mysql -uglcp -pxxxxxxxx GLCP_1<\/b><\/div>\n<div>&nbsp;<\/div>\n<h2>Step 4: Get the code and other files<\/h2>\n<p>We can suck up the code from zoo using rsync, but we can&#8217;t get everything in one bite, nor do we want everything. Create a text file&nbsp;<span class=\"Apple-style-span\" style=\"font-weight: bold\">\/Users\/glcp\/rsync_excludes.txt&nbsp;<span class=\"Apple-style-span\" style=\"font-weight: normal\">&nbsp;of stuff we don&#8217;t want<\/span><\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin-left: 40px\"><tt>CVS\/<br \/>\n<\/tt><tt>INTERNS\/<br \/>\n<\/tt><tt>Jamie\/<br \/>\n<\/tt><tt>WORKING_FOLDER\/<br \/>\n<\/tt><tt>bak\/<br \/>\n<\/tt><tt>maintenance\/<br \/>\n<\/tt><tt>old_learn\/<br \/>\n<\/tt><tt>temp_store\/<br \/>\n<\/tt><tt>asset_store\/<br \/>\n<\/tt><tt>Archived Images tif\/<br \/>\n<\/tt><tt>bulk_store\/<br \/>\n<\/tt><tt>learn_dev\/<\/tt><\/p>\n<div>run rsync<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin-left: 40px\"><b>rsync -av &#8211;delete &#8211;rsh=ssh &#8211;exclude-from=\/Users\/glcp\/rsync_excludes.txt &#8211;progress glcp@zoo.uvm.edu:\/&#8230;\/uvm.edu\/fs\/geology\/landscape \/<\/b><\/p>\n<p>Cool, so we&#8217;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<\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin-left: 40px\"><b>rsync -av &#8211;delete &#8211;rsh=ssh &nbsp;&#8211;progress glcp@zoo.uvm.edu:\/&#8230;\/uvm.edu\/fs\/geology\/landscape\/asset_store\/00 \/landscape\/asset_store<\/b><span class=\"Apple-style-span\" style=\"font-weight: bold\"><br \/>\n<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>It would be nice to script this, but alas, each iteration requires a password, unless one employs SSL keys. But alas, SSL keys don&#8217;t work when connecting to zoo, so we need to make the connection from zoo to the mac Mini.<\/p>\n<p>Creating the keys and what-not was gleaned from <a href=\"http:\/\/troy.jdmz.net\/rsync\/index.html\">this document<\/a>, 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<\/p>\n<p>&nbsp;<\/p>\n<p style=\"margin-left: 40px\"><b>rsync -av &#8211;delete -e &quot;ssh -i \/users\/g\/l\/glcp\/.ssh\/glcp-zoo-key&quot; &#8211;progress \/:\/geology\/landscape\/asset_store\/00 glcp@132.198.xxx.yyy:\/landscape\/asset_store<\/b><\/p>\n<div style=\"margin-left: 40px\">&nbsp;<\/div>\n<p>&nbsp;<\/p>\n<p>I need to work on that script a bit, make it iterate over all exiting asset_store folders.<\/p>\n<p>&nbsp;<\/p>\n<p>Took maybe 17 hours to send the 70+ GB of data<\/p>\n<h2>Step 5: Edit code<\/h2>\n<p>Most of the editing is in global.h.php, changing master paths and URLs. Also, many references the $GLOBALS[&#8216;SERVER_NAME&#8217;] apparently need to be changed to $_SERVER[&#8216;SERVER_NAME&#8217;]. Also, need to change path for parser.php in those .htaccess files that contain that reference.<\/p>\n<h2>Step 6: test and explore dead-ends<\/h2>\n<p>Now we can test, and see what we missed.<\/p>\n<p>The first thing missing was GD graphics support in PHP. Apparently, this doesn&#8217;t come with the php distributed with Leopard. We need it to draw maos and graphs. I tried following <a href=\"http:\/\/downloads.topicdesk.com\/docs\/Adding_GD2_to_PHP_on_OS_X_Server_10_5_Leopard.pdf\">these instructions<\/a>&nbsp;(for 64 bit CPUs), which enabled GD support, but the Freetype libraries don&#8217;t seem to work, causing severe server errors when drawing text on images.<\/p>\n<p>Another issue is Google Maps interface: complains that the key used is not registered, but probably doesn&#8217;t matter since it won&#8217;t work without real network connection<\/p>\n<p>And that&#8217;s where we sit today. Will try getting a whole new php package using Fink, or maybe even rebuild from source, and try again.&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;On paper, this seems easy. Just move 70 GB of images and a dozen database tables to a brand new mac, and we&#8217;re done. Well, not quite&#8230; Step 1: prepare the mac out of the box This was mostly straight-forward; &hellip; <a href=\"https:\/\/blog.uvm.edu\/waw\/2008\/05\/30\/migrate-landscape-change-project-to-macmini-server\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38506,6517,8025,8026],"tags":[],"class_list":["post-586","post","type-post","status-publish","format-standard","hentry","category-landscape-change","category-projects","category-scriptingprogramming","category-systems-and-servers"],"_links":{"self":[{"href":"https:\/\/blog.uvm.edu\/waw\/wp-json\/wp\/v2\/posts\/586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.uvm.edu\/waw\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.uvm.edu\/waw\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.uvm.edu\/waw\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.uvm.edu\/waw\/wp-json\/wp\/v2\/comments?post=586"}],"version-history":[{"count":0,"href":"https:\/\/blog.uvm.edu\/waw\/wp-json\/wp\/v2\/posts\/586\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.uvm.edu\/waw\/wp-json\/wp\/v2\/media?parent=586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.uvm.edu\/waw\/wp-json\/wp\/v2\/categories?post=586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.uvm.edu\/waw\/wp-json\/wp\/v2\/tags?post=586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}