Sunday, October 4, 2015

Rinse and Repeat

This week starts what I call my "silly" season.  Except this year it is more crazy than normal.  

Each year I deploy my Competition Manager product to support the state wide North Carolina Nazarene Youth International Teen Talent Festival. 

Besides doing this, I also continue working on my existing apps, and this year I also have a second web app I am working on (more on that in a later post).

Competition Manager uses Ruby on Rails for the server side, JQuery UI for the client side and MySQL for the database layer. It is used to manage the registration, scoring, accounting, and reporting for the event.  Pretty much any aspect that could be automated it does.

Fortunately, each year (we are going on 6 years now) I learn steps to streamline the process.  This year those gains have helped out as the organizers want the system up and running two weeks earlier than normal.  I just found this out last week, yikes!!

I have gotten the steps down to these five:

  1. Deploy the production server with last year's image
  2. Configure my development machine with last year' code and data
  3. Make and test any requested changes on my development machine
  4. Deploy changes to the production server and do a sanity test
  5. Hand control to event organizers and provide any necessary training
 I got through the first step with ease.  Probably the easiest I have ever done.  So I figured the next steps would go as smoothly. 

I was wrong.

The night before, I had upgraded my dev machine to the latest version of OSX, El Capitan.  I had heard about it adding stricter security settings but I figured that was for the normal user, Apple wouldn't do anything to hinder a developer, right?

Over my years I have used Windows, Linux and OSX systems for development and I have come to the (very opinionated) opinion that OSX is the best operating system for my development needs.  

It gives me the robustness and configurability of Unix under the hood should I need it while also giving me the 'GUI-ness' of windows without all the hacks and quirky setups the Linux windowing environments have.

I absolutely hate administering a computer when I should be developing. 

Don't get me wrong, over time each OS has advanced in features and usability.  But for me, as long as I can afford it, I will stay with OSX for my development needs.

At any rate, I figured "what could go wrong?", I'll just install El Cap, and start off fresh and new with standing up this year's version of Competition Manager.

Well, it turns out the security settings that El Cap comes with don't allow you to change some files, like those in /usr/lib.  

The problem I had was the mysql2 rails gem was looking for a mysql dynamic library in /usr/lib but it was in /usr/local.  

The traditional fix for this is to setup a symlink from /usr/local to /usr/lib.  No problem I thought, I'll just do that. 

ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
Operation Not Permitted
What! I can't do something this basic! But I have sudo privileges!  
The first Google entries I found dealt with this problem back when El Cap was in beta.  Their solution was to turn off the security settings, but there was also a caveat mentioned that this ability would not be allowed in the gold release.  
Arggh, I found instructions on how to reboot the machine and do this in recovery mode. But it didn't look like something I really wanted to do. Not to mention I didn't want to waste the time.  I wanted to program!! 
Right before I was about to reboot into recovery mode I decided to search one more time and I found a more recent solution saying that I should just reinstall MySQL using homebrew.
So rather than take the time to change my security settings and go through all that rigamarole I decided to try the second suggestion first.  I fully expected it not to work.  But wouldn't you know, after about 15 minutes, it was loaded and I was back in business.
Whew!, I dodged a bullet there.  Anyway, from there it was all down hill. By the end of the day on Saturday I had plowed through steps 1 through 3 and I am just about ready to finish steps 4 and 5 up and release it for production.
A good weekend's work!!  Till next time.  





No comments:

Post a Comment