-
Notifications
You must be signed in to change notification settings - Fork 4
Installation and Setup
These instructions were tested under OS X Lion 10.7.4 and Xcode 4.3.3
- Boot from a Lion Install USB drive
- Choose Disk Utility; click Continue
- Use System Preferences to partition it into 2 partions (Partition Map Scheme: GUID Partition Table; Format: Mac OS Extended (Journaled))
- name the first one after the hostname (e.g. "osx-build-machine")
- name the second one "NEWLY_IMAGED"
- Click Apply
- Cmd-Q to quit Disk Utility.
-
Select Reinstall Mac OS X; Click Continue.
-
Splash screen, click Continue.
-
Click Agree.
-
Click Agree, again.
-
Select the Persistent partition; click Install (takes ~7-30 minutes).
-
Select Country, e.g. United States; click Continue.
-
Select keyboard layout, e.g. U.S.; click Continue.
-
Select Don't transfer now; click Continue
-
Enter Your Apple ID
-
Type in your Apple ID, e.g. [email protected]
-
Type in the password, e.g. Loves2dance
-
Click Continue
-
Review your Registration; click Continue
-
Fill out the Create Your Computer Account
-
Full Name: e.g. pivotal
-
Account Name: e.g. pivotal
-
Password: e.g. loves2dance
-
Verify: e.g. loves2dance
-
Uncheck Allow my Apple ID...
-
Password Hint: e.g. How do you feel about dancing?
-
Click Continue
-
Click Start Using Lion
-
Log in as user
-
Bring up a terminal
-
Type curl -LO https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg
-
Type *sudo installer -package .pkg -target /
-
Type in your password
-
Click on the App Store icon in the dock.
-
Type Xcode in the search bar; press return.
-
Click on the gray Free button in Xcode. It will turn into a green Install App button; click that.
-
Enter your App Store userid & password (i.e. your Apple Id).
-
Click on the Xcode Icon
-
Click Agree to Xcode License Agreement
-
Click Install to Xcode Component Installation
-
Type in your password; click Install Software
-
Click Start Using Xcode
-
Click Xcode → Preferences → Downloads → Components
-
Select Command Line Tools; click Install
-
Press Cmd-Q to quit Xcode.
-
In your terminal window
-
Type sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
-
Type sudo softwareupdate -i -a
-
Bring up Address Book; remove the entry corresponding to the Appstore user (to avoid Chrome using that information to pre-populate address fields) (we want to minimize the personally-identifiable information)
- Click Apple Icon → Restart; click Restart
- Hold down the Option key while rebooting.
- Select the DeployStudio Netboot. You have set up a DeployStudio NetBoot server, haven't you?
- Click Create a master from a volume
- Press the Play button (looks like an arrow).
- On the Hard Drive dropdown, select NEWLY_IMAGED
- Image name, e.g. 10.7.4_4.3.3_12.07.06_23.21
- Press the Play button (looks like an arrow).
- When it's finished, you'll need to create a symbolic link on the DeployStudio server, in the Masters/HFS subdirectory, e.g.
ln -s 10.7.4_4.3.3_12.02.23_23.30.i386.hfs.dmg lion_mostly_pristine.i386.hfs.dmg - The machine will reboot when it has finished.
- Click Restart on the login screen.
- Hold down the Option key while it reboots.
- Select Persistent. Click the ↑.
VMWare Fusion does not allow netbooting (as of 4.1.3). If that is the case, you can still create the mostly-pristine image on the DeployStudio server, but the process is more complex:
- Boot from the Install image, again.
- Bring up Disk Utility
- Select NEWLY_IMAGED
- Click Restore
- Drag-and-drop Persistent to Source:
- Drag-and-drop NEWLY_IMAGED to Destination:
- Click Restore
- Click Erase
- Click on the Apple in the upper-left-hand corner
- Click Startup Disk...
- Select the first Persistent partition
- Click Restart...
- When it reboots, log in
- Bring up Terminal
- Type sudo diskutil rename /Volumes/Persistent\ 1 NEWLY_IMAGED
- Mount the DeployStudio server's hard drive.
- Type DESTFILE=10.7.4-4.3.3-$(date +%y.%m.%d-%H.%M).hfs.dmg
- Type sudo hdiutil create -srcfolder /Volumes/NEWLY_IMAGED /Volumes/DeployStudio/Masters/HFS/$DESTFILE
- Type sudo asr imagescan --allowfragmentedcatalog --source /Volumes/DeployStudio/Masters/HFS/$DESTFILE
- Type cd /Volumes/DeployStudio/Masters/HFS/; ln -sf $DESTFILE lion_mostly_pristine.i386.hfs.dmg
- Boot the OS X Build machine
- System tweaks:
- System Preferences → Energy Saver → Computer Sleep → Never
- System Preferences → Energy Saver → Display Sleep → Never
- System Preferences → Energy Saver → Put the hard disk(s) ... → Unchecked
- System Preferences → Desktop & Screen Saver → Screen Saver → Start Screen Saver: Never
- System Preferences → Screen Sharing: Checked
- System Preferences → Remote Login: Checked
- System Preferences → Users & Groups → Automatic login: pivotal
- System Preferences → Users & Groups → pivotal → Login Items → +
Add the network share where the DeploySutdio masters are located.
- Fix sudo
- Bring up a terminal
- sudo visudo
- append the following line to the sudoers:
%staff ALL=(ALL) NOPASSWD: ALL
- Set up ssh
- ssh-keygen -f ~/.ssh/id_apple_orchard -N ''
- cp ~/.ssh/{id_apple_orchard.pub,authorized_keys}
- scp ~/.ssh/id_apple_orchard jenkins_user@jenkins_server:.ssh/
- Append id_apple_orchard.pub to the end of the DeployStudio server's userid's .ssh/authorized_keys
- Test:
ssh -i ~/.ssh/id_apple_orchard deploy_userid@deploystudio_server
Jenkins is an extendable open source continuous integration server. This is how to set up Jenkins to kick off an automatic build of a new image every time a change is committed to the build cookbook(s).
- Set up ssh's config
- vim ~/.ssh/config
Host osx-build-machine
IdentityFile ~/.ssh/id_apple_orchard - test: ssh osx-build-machine
- Install Jenkins
- Add the Git Plugin
- Access Jenkins from its web interface
- Job name: Apple Orchard Image
free-style software project - Description: Creates images to be used by DeployStudio
- Source Code Management
- Select Git
- URL of repository: git://github.com/pivotalexperimental/apple_orchard.git
- Build Triggers
- Check Poll SCM
- Schedule * * * * *
- Build
- Select Execute Shell
- Execute shell Command: Use this shell script as a template, modifying the shell variables to suit your setup.
- Project name: Apple Orchard Trigger
- Source Code Management
- Select Git
- URL of repository: [email protected]:pivotal/pivotal_workstation.git
- Build Triggers
- Check Poll SCM
- Schedule 1,16,31,46 * * * *
- Build
- Execute Shell
We found that caching downloaded software on the Jenkins server and pre-populating the build machine had a number of advantages, the greatest of which was reduced fragility (i.e. a build was more likely to complete because, for example, it wasn't dependent on being able to download source code from a server off the coast of Spain). It also greatly speeded up the build process, and reduced Internet bandwidth usage.
sudo chown -R $USER /Volumes/NEWLY_IMAGED/var/chef/cache/
- sudo mkdir -p /var/chef/cache
- sudo chown -R user /var/chef/cache
- rsync -avH --delete --stats osx-build-machine:/Volumes/NEWLY_IMAGED/var/chef/cache /var/chef/
- sudo mkdir -p /Library/Caches/Homebrew
- sudo chown $USER /Library/Caches/Homebrew
- rsync -avH --delete --stats osx-build-machine:/Volumes/NEWLY_IMAGED/Library/Caches/Homebrew /Library/Caches/