Mac Mini 2018 as Build Server

I’ve long had a longing to have a Mac Mini as build server in my technics room. After Apple finally updated it to (now) fashionable space grey, it was a must purchase for my company.

It took me a while to decide the specs to go for, because the base configuration should have been totally fine for my needs. But my lust and anticipation got the better of me, and so I sprang for the 6-core CPU, 16 GB or RAM and the 512 GB SSD.

I thought that I would be able to use my old Apple Thunderbolt monitor for setting up the Mini, but it turns out that it only has the USB-C style “Thunderbolt 3” plugs — and I don’t have an adapter for that. Fortunately the TV in our guest room has HDMI, and so I was able to do the initial setup there.

After having Apple Remote Desktop enabled in the Sharing pref panel, I could move the Mac Mini into my server rack and continue controlling it from my office.

The second confusing thing for me — was that there is still documentation on Apple’s website speaking of Mac OS X Server, but this is nowhere to be found for Mohave. Instead Xcode Server is built into Xcode since version 9. You can simply turn it on there, on the right-most tab of the preferences.

The second thing to setup was a GitLab Runner, which would be available to Continuously Integrate, when my other macs are sleeping. A few learnings from this process:

  • On Mohave there was no /usr/local/bin folder. I created it.
  • I also needed xcpretty, installed via gem install
  • Created a new ssh key
  • Needed to do a clone once from the command line, so that the host key would be accepted
  • The runner showed as locked (whatever that means). You can change the state either via web UI or by specifying — locked=false during registration
  • Needed to copy my Mac development certificates (plus private keys) into the Mini’s keychain
  • Needed to accept codesign’s access to the private keys a couple of times with the Always option

Then to create a bot in Xcode to try out the Xcode server:

  • Under Product — Create Bot
  • Select a Server. Since there is none yet, Add New Server.
  • Choose the Mac Mini, enter username and password
  • Got a ton of “The Server SSH fingerprint failed to verify” — needed to trust the key for all git submodules, then also confirm the authentication for all

I went initially with an integration every hour — which seems to be the default — but then I realised that this would result in way to many integrations without changes. So I changed the setting to only integrate on new commits.

Bots can be managed and their results viewed on the “Reports Navigator”. This is the tab in Xcode with the speech bubble icon. You need to select By Group to see the build servers below your apps. Below the build server you see the bots running on it and you can modify the settings via right-click.

Then for the bonus activity… setting up Windows 10 in VirtualBox. I have a configuration tool by my home automation system, which is only made for Windows. It feels right at home there. It was quite simple to install. You only need to configure a virtual machine and then you can install Windows from the ISO image which you can get from the Microsoft website. I think at some point in the future, Microsoft will want some money from me for the license.

During the Windows setup process, I would chuckle multiple times because there were some dialogs which Microsoft seems to have gotten inspired to by Apple. For example one that asks if you want to share your unique advertisement identifier to get more personalised ads.

So far so good, I’ve setup my totally over-powered Mac Mini for use with Xcode bots, as a GitLab runner and created a virtual machine for Windows.

Conclusion

It was fun to set up and it’s great that this computer can be running while all my other Macs are sleeping. This way integrations via GitLab CI can still occur when clients of mine — from other time zones — push commits to my GitLab.

What other things might I be putting on my Mini…

My time machine has lately been complaining that it is running out of disk space. Maybe I could plug an external hard disk into the Mini and use it as time machine server, too?


Originally published at Cocoanetics.