Friday, March 22, 2013

How Not to Install Makahiki on OS X

Task 1: Install Makahiki Locally

I was tasked with installing Makahiki locally, on my Mac. Having worked with databases like DB2, Megastore, and Memcached, as well as many more from my current class, I was able to breeze through most of the Makahiki installation guide. Later, though, preexisting installations of Memcached and Postgres would trip me up big time.

Trouble presented itself first with the configuration of PostgreSQL, already installed on my system. I couldn't find the pg_hba.conf file, at first. The Finder's "Find" tool didn't find it, nor did my incorrect use of the terminal's find command. The Postgres docs didn't help, nor did googling to find where the "cluster data directory" might've been located by default. On terminal, it was tricky. The correct syntax includes the base directory in the command, and it has to be run as root:

    $ sudo find / -name pg_hba.conf

I still don't know where my root "cluster data directory" is, because I found three copies of the config file on disk. Not caring to hunt it down, lazily I changed all three files.

When the installer still wouldn't work, I came to realize that I hadn't created the "postgres" user from the psql prompt, within the database. Finally, after much wrangling and re-installing, the Makahiki installer quit complaining about the DB. Still, the installer would throw stack traces and fail.

It turned out that the database configuration problems were only part of the problem. I didn't realize Pip had failed earlier. The dependencies were giving me trouble. I had to go back to do a full reinstall again. This bit from one of many stack traces was helpful:

building '_pylibmc' extension

clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -DUSE_ZLIB -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _pylibmcmodule.c -o build/temp.macosx-10.8-intel-2.7/_pylibmcmodule.o -fno-strict-aliasing

clang: warning: argument unused during compilation: '-mno-fused-madd'
In file included from _pylibmcmodule.c:34:
./_pylibmcmodule.h:42:10: fatal error: 'libmemcached/memcached.h' file not found
#include
         ^
1 error generated.
error: command 'clang' failed with exit status 1


----------------------------------------
StackOverflow helped me install the pylibmc library that was needed, here. My original libmemcached install from Google App Engine was either not to be found or nonexistent. That was all I finally needed. Makahiki then installed beautifully on my local host. If the Makahiki docs included finding the Postgres config file in OS X, it might have saved me a little time. Checking from within Postgres to make sure the "postgres" user existed would also have helped, but perhaps that would be obvious to someone better at databases.


Task 2: Install Makahiki in Heroku
Everything but S3 setup went smoothly, thanks to a couple of typos in the environment variables. First, I reversed the hyphenated bucket name. Trying to access URLs to static files gave me a "no such bucket" error from S3. It felt safer to re-deploy Makahiki to Heroku, which took another 20 minutes or so. After that, the S3 error was "access denied." I had given an incorrect secret access key to Heroku because of a bad copy-and-paste. The takeaway lesson: it is wise to double check all environment variables before you deploy Makahiki. I re-deployed again, taking another twenty minutes and finally A3 served the static files. Huzzah!

By comparison, the remote install was a breeze. Now, what to do with it?

No comments:

Post a Comment