Monthly Archives: April 2013

Building a Kick-Ass Mac Mini Build/Integration Server for iOS, Android, Blackberry and Mac Development, Part I

 

This is the first of a series of blog posts where I walk you through the process of turning an old mac mini into a kick ass swiss army knife build integration/scm server.

Introduction

Several years ago, I purchased a mac mini to run as a dedicated web server.  The server worked well, but issues with my ISP caused me abandon self hosting and move my virtual domains to the cloud.  Since then, the mac mini has been quietly sitting on the shelf, until now.

A few weeks ago, I purchased a Synology RS812 NAS appliance and quickly moved all of my subversion and git repositories to it.  However, I started to wonder if having my life’s work stored on the NAS was really a good idea.  If the drives got corrupted, I would loose everything.

I started to spec out a new server to throw in my 12U rack.   I spend hours poring over specs for server cases and power supplies looking for the quietest ones I could find.  I quickly came to the conclusion that a passively cooled system would be slower than my existing mac mini.

I pondered.  Maybe I could use the mac mini as a subversion server, mirrored to the subversion repositories on the NAS.  Then idea struck me – why not turn the mac mini into a dedicated build server? 

I purchased OS X Server ($20) and then I started to realize how incredibly useful this mac mini could be. By spending $20 for OS X server and $139 for a new disk drive I get all of the following:

•    Software Update Caching.  Right now each of my macs will poll the apple server to check to see if there is a software update.  If there is one, it will download it directly from apple, for each mac.  OS X Server has a service that will download the updates exactly once, and each of your macs will install the update from the server, saving bandwidth on your Internet connection.

•    LDAP.  With the LDAP server, you can have a single network login for all of your mac, mac books, etc.

•    Provisioning.  The server can control iOS devices and macs, pushing down developer certificates.  This is a big win for an iOS developer.

•    Source code repositories.  The mini will host subversion and git source code repositories.  The subversion repositories will be mirrored to the NAS, so at any point I have two copies of my subversion repositories in sync.

•    Build server.  With the mac mini, I will be able to build mac, iphone, ipad, blackberry and android applications.  More importantly, with Jenkins, I can also have a build slave running on Windows.

•    And lastly, you get a crap wiki server.

Upgrading the Hardware (the Path to Hell is Paved with Good Intentions)

After upgrading the mac mini to Mountain Lion, the performance was terrible.  Granted, the mac mini’s performance was never great to begin with, by any measure, but I needed more speed.

So, I drove to the store and picked up a 1TB Seagate Solid State Hybrid Hard drive (SSHD). I cracked open the mini, admired the delicate craftsmanship, and then installed the drive.  That is when my plan nearly derailed.

I went searching through my boxes for the original DVDs that came with the mac mini and installed the OS.  However, I forgot that the app store didn’t come out until after Snow Leopard was released.  Therefore, if I wanted to upgrade to Mountain Lion, I’d have to upgrade to Snow Leopard first. The only problem was that after several hours of searching for the Snow Leopard installation DVDs, I simply couldn’t find them.
I downloaded the Lion installation package and copied it to the mini and tried to install.  The installer refused, stating that the OS was too old, I would have to upgrade to Snow Lion first.

After another futile attempt to find the missing installation DVDs, I tried to use the migration assistant (which doesn’t copy the operating system files).  Time machine was no good either.

It a fit of desperation, I was able to burn the installer to a USB key.  With that, I was able to boot and finally install Mountain Lion on the mac mini. 

Each step above wasted several hours, and when you can only devote several hours a night to this side project, this adventure took nearly a full week to run its course. 

Now, I can honestly say that purchasing the Seagate SSHD was well worth it.  It may not be the fastest drive on the market, but it is bounds and leaps faster than the 5400rpm Toshiba drive.  The system boots fast and is actually usable now.

The only problem is, I broke the heat sensor connector when reinstalling the drive.  The connector sheared off the board.  I was able to solder the sensor cable directly to the pads, but the fan is running wide open now.   There are two options to fix this, which I will cover later when I finish building the server and come back to it.

Installing OS X Server, XCode

Next, I installed the $20 OS X server app.   This app overlays on top of your operating system. 

Turn on the caching server and then update your system from within the Server app.  Launch the appstore and update software.  You will start to see that the caching service starts downloading the files and starts using disk space.

Next, I downloaded XCode.  Once XCode is downloaded, run the app and then go to the XCode->Preferences and click on the downloads icon.  Download the command line tools.

Once this has finished, take a moment to admire what you now have done.   The following software packages have been installed without needing to compile anything: subversion, git, perl, php, ruby, python, and of course, apple’s XCode compilers.

That is enough for now, next time we can start setting up the Subversion server to mirror to another repository.

Review: Synology RackStation RS812


A while back I started looking at building a NAS or buying a NAS appliance.  My requirements were simple:  it had to be rack mountable, it had to be very quiet, and I wanted it to be power efficient.

After scanning the landscape for rack mountable NAS appliances, I was stunned at the prices.  The prices were astronomical and most generated ear-splitting jet engine sound levels.  Expensive and loud.

Plan B was to purchase a passively-cooled motherboard and a 1U rackmount case and make my own NAS, but 1U server cases are almost always expensive and trying to figure out how many decibels a power supply will put out is nearly impossible without contacting the vendors.

I had almost given up when I saw Synology’s RackStation RS 812 NAS Appliance.  Because there were so few reviews I was more than a little wary.  In the end, I decided to take a chance and slapped down $612, including free shipping.

After 2 weeks with it, I can honestly say I like it.  It is very quiet, works wonderfully, and I’m thinking about installing the PBX software on it to see how well it will handle it.  The NAS, running full tilt, uses about 37 Watts of power.

At first, the performance was absolutely terrible.  After some troubleshooting I figured out that my home made ethernet cable was bad.  Once I swapped it out with a cat 6 patch cable, the NAS started to work flawlessly.  No more problems.

The Synology RS 812 has 512MB DDR3 memory which cannot be upgraded.  You can slap in up to four disk drives, and attach an eSata expansion bay for a grand total of eight disk drives.  You can also attach an external USB drive to add even more capacity, although the NAS wants you to format the external drive.

While I purchased the NAS to be a simple NAS and Subversion server, I was pleasantly surprised to see that it can be used for so much more than just a network drive.  It has a two USB connectors and supports a variety of UPSes.  It can also act as a print server with a limited number of USB printers.  It also has a serial console port which I will connect to my console server.

Time machine is supported out of the box.  Simply create a user account, assign a quota and configure time machine of each of the macs on your network and presto.  Done.

I also have it setup as a syslog server, which will email me when there is a critical or alert log message logged by any of the macs on my network.  Setting up the email was painless, even to send through gmail.  The only down side (if it is at all) is that because of the smtp authentication works with Google’s GMail server the email will appear to be from your account.

So far the subversion server is working wonderfully.  Git over ssh, however can be sluggish.  It took quite a bit of CPU when commiting to the server.

 

Windows PC Sales Slump; Pundits Argue about Windows 8

Before I say anything else, I will tell you up front that I absolutely hate Windows 8 — It is one of the worst user interfaces ever created for business users.  While I see the benefit of having a unified user interface on tablets, mobile phones and on the desktop, I absolutely loathe Windows 8.

I first had exposure to Windows 8 while developing applications for Windows.  It was like the idiots who invented the annoying clippy, the Microsoft office assistant , was promoted and given free reign to destroy Microsoft from within.

This week, some analysts correctly pointed out that Windows 8 was hurting PC sales, and Apple’s PC sales increased.  Why?  Because Apple doesn’t force you to purchase something you don’t want.

Today, there was an article in that stated that it wasn’t Window 8, but tablet PC sales which are hurting PC sales.

I would have to disagree.

Most PC users use their PCs to do work; edit spreadsheets, play games, edit databases.  Windows 8 is built for information consumers who don’t work.

Windows 8 forces a consumer-only interface down upon the users, which forces them to take several steps to get to run a desktop to run applications.

I will not purchase a PC with such a horrible operating system.  If I did, I would install Linux or turn it into a Hackintosh in a New York Minute.

screen-shot-2013-02-25-at-12.57.36-pm_130x100

Setting up git on Synology NAS

I just finished setting up my brand new Synology Rackstation 812 NAS.  I quickly installed subversion and next up, git:

1. Configure ssh in the DSM if you haven’t already done so.  Log into the web interface (DSM) and select Control Panel –> “Terminal”  and check the “Enable SSH service check box.  Click the Apply button.

Screen Shot 2013-04-03 at 9.03.00 PM

2. Create a user account for yourself.  Create a file share in DSM and give both admin and your user read/write access.  Mine is aptly named “git”  This will create a /volume1/git directory.

3. Log into the Synology NAS via ssh as root.  The root password will be your admin password that you set when you first installed DSM.

4. If you haven’t already done so, figure out what the CPU is in your NAS and install ipkg.  Follow the steps HERE.  Once you have installed ipkg, use ipkg to install git:

syn > ipkg install git

 

If you get an error saying git not found, update ipkg and try again.  This will install git.  To test to make sure git is working:

syn > su user1  #<-- your user name that you created.
syn > cd /volume1/git
syn > mkdir test
syn > cd test
syn > git init . --bare

 

4. Make sure you enabled the user home service, which should create your /home/<user> directory.  This is in Control Panel –> Users –> Home.

Screen Shot 2013-04-03 at 9.26.40 PM

5. Next, we have to configure sshd so that git+ssh works.  Trying to clone our repository we just created will fail:

git clone ssh://192.168.0.29/volume1/git/test
Initialized empty Git repository in test/.git/
sh: git-upload-pack: not found
fatal: The remote end hung up unexpectedly

This means that git logged into the NAS via ssh, but couldn’t find the “git-upload-pack” command in the PATH, because the path omits the /opt/bin directory where ipkg puts downloaded executable files.  There are several ways to fix this.  Since sshd for BusyBox was configured not to parse the /etc/profile or ~/.profile of the user, we can try to set the path in a ssh environment file, or we can simply create symbolic links.

As root:

cd /usr/bin
ln -s /opt/bin/git* .

 

You should now be able to clone a git repository and check files in.

RS812_thumb.jpg

In Search of a Network Attached Storage (NAS) Nirvana

RS812When I first purchased my eight-core Mac Pro, I envisioned a beast of a development workstation with multiple virtual operating systems running simultaneously.  I wanted one computer that I could use to develop software in any language, for any operating system or embedded device.  I paid a small fortune for the best workstation I could get my hands on at the time.

For the most part, it worked fantastically well.  It allowed me to get rid of several PCs, and the detritus that accumulates when you continuously build and upgrade computer systems on a regular basis.  I no longer regularly trip over salvaged PC chassis and no longer have a stack of cables and drives on my bookshelf.

Better yet, I don’t have to save disk drives with boot images on it, or agonize about reformatting and blowing away an operating system that I previously installed (or fiddle with grub for multi-boot).  If I need to install a new Red Hat, Ubuntu, Gentoo, CentOS, or Windows box, I just provision a new virtual server in minutes and I’m done.  When I no longer need it, I can delete the virtual image.

However, there have been some problems with this setup. While the Mac Pro has been a workhorse, it hasn’t been totally pain free.  In the last five years I’ve had crashes, memory DIMM parity errors, freezes, a blown out ATI video card and lately, the desktop would hang.

For I while, I’ve planned on purchasing the next generation Mac Pro, which hasn’t been released yet.  I haven’t made any computer upgrades or purchases for well over a year waiting for the next Mac Pro, which may never come to pass.  My plan was simple, purchase the new Mac Pro and re-provision the existing Mac Pro as a file server, build server, code repository and more.

I’ve decided not to wait any longer and get a dedicated server appliance.

Requirements

Rack mount.  I’ve run out of office space and have decided to pay a premium for rack mount hardware.  I have a 12 U Middle Atlantic wood laminate rack with some 2U shelves for most of my networking equipment.  In the future I planning on a full scale rack after we move to a new house.

Host source code repositories.  Most of my old source code projects have been mostly converted to git repositories.  I have both git and subversion repositories on my Mac Pro.  I want to move them to another server which is backed up frequently, which scripts to push up my git repositories which are hosted at GitHub.

Automated backup of Linux, Mac, and Windows machines. For our Mac machines, this means Time Machine support and AFP; for Linux rsync+ssh.  For windows, it means Samba support.

RAID support with the ability to expand.  Although I’m not 100% sold on the benefits of RAID for small businesses or home use, especially with desktop drives, I want RAID.

Power efficient.  I want the entire server to draw less than 60 watts.

Whisper quiet.  My rack is a laminate box with rack rails sitting two feet away.  I cannot tolerate a jet engine screaming server.

NAS Appliance Versus Server (Build Versus Buy)

The first decision was whether I wanted to setup a full blown server with a chassis that could accommodate a bunch of drives, or simply purchase a commercial NAS appliance.

In the past, I would have automatically opted for the more fun route – search the darkest corners of the internet for parts, assemble them and spend days fidgeting with a Dremel, installing Gentoo, cross compilers, and ultimately beaming with pride, after a healthy dose of profanity and self-inflicted pain.

After searching for passively cooled main boards and quiet rack mount chassis, I figured out pretty quickly that it would cost more and take more time for me to do it myself.

If power and noise wasn’t an issue, I would have a lot more options.

Decision: Off the shelf NAS appliance.

Which NAS?

Next, I got down and started researching NAS appliances, both rack mount and desktop.

Over the years, I’ve looked at NAS appliances and haven’t been keen to what I have seen.  Most were horrifically slow and overpriced.  However, in the last several years the performance and features have gone up and prices have gotten down to a level where I’m almost comfortable in slamming my money down on the table.

Drobo was plagued with problems with a large number of bad reviews floating around.  Some are happy, but others have suffered greatly at the hands of the proprietary BeyondRAID. I’m willing to bet that most of the problems probably have to do with users using desktop drives that don’t support TLER.  Worse yet, the performance reviews show the Drobo, like many NAS appliances, is pitifully slow.  Finally, the Drobo 5N is listed at $568.99 on Amazon.com, without drives.  The 8-baby version is a whopping $1,599.99 on Amazon.  And the tray to rack mount the device is another $200.  Too expensive.

Next, I narrowed the field down to QNAP and Synology.  It would appear as these are the two most revered NAS appliance companies, judging by the recommendations and reviews.

After exhaustive searches and weeks of analytical paralysis, I finally ordered  a Synology Rackstation 4-Bay 1U NAS, for $617.98.