Installation and Setup under VMWare Fusion and Mountain Lion - pivotal-sprout/sprout-orchard GitHub Wiki
These instructions were tested under VMware Fusion 5.0.3, OS X Mountain Lion 10.8.4, and Xcode 4.6.2
- Start VMWare Fusion
- Cmd-N to start a new virtual machine
- Click Continue without disc
- Use operating system or disc image (choose a disc or disc image); click Continue
- Select the ML install disk image (probably InstallESD.dmg); click Continue
- Set Version to closest available match; click Continue
- Click Customize Settings
- Select a save location for the VM
- Hard Disk: 80GB
- Set Processors & Memory:
2 processor cores
4GB - Network Adapter:
select Connect directly to the physical network (Bridged)
Advanced options → Mac Address: click Generate - You'll probably want to create an entry for this machine in your DNS server and add the created MAC address to your DHCP server.
- Fire up the VM
- Choose your language
- Choose Disk Utility; click Continue
- Partition into 2 partions, one 45GB, the other the remaining (Partition Map Scheme: GUID Partition Table; Format: Mac OS Extended (Journaled))
- name the 45GB Persistent
- name the other one NEWLY_IMAGED (must use this exact string, currently lots of hardcoded dependencies in the scripts)
- Click Apply; click Partition
- Disk Utility → Quit Disk utility (don't use Cmd-Q to quit Disk Utility; you'll quit VMware Fusion instead)
- Select Reinstall Mac OS X; Click Continue.
- Splash screen, click Continue.
- Click Agree.
- Click Agree, again.
- Select the Persistent (40GB) 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 Not Now; click Continue
- Click Enable Location Services if you want, click Continue
- Click Skip; click Skip
- Click Continue; click Agree
- 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
- Password Hint: e.g. How do you feel about dancing?
- Click Continue
- Confirm timezone; Click Continue
- Click Skip to Skip registration; click Skip again
- Click Start Using your Mac
- Bring up Finder; eject Mac OS X Install disk
- VMware → Virtual Machine → Update VMware Tools
- Click Install to connect the Tools installer CD
- Click OK to continue anyway
- Double-click Install VMware Tools; go with defaults
- Click Restart to finish installing the software
- Log in as user
- 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
- Applications → Xcode
- Click Agree; click Install; enter your password; click Start Using Xcode
- Click Xcode → Preferences → Downloads → Components
- Select most-recent IOS simulator; click Install
- Select second-most-recent IOS simulator; click Install
- Select Command Line Tools; click Install
- Xcode → Quit Xcode
- System Preferences → Software Update → Check Now
- Install all available updates
- App Store → Quit App Store
-
Go to the Virtual Machine → CD/DVD(SCSI) → Connect CD/DVD.
-
System Preferences → Startup Disk → Choose Mac OS X Install ESD
-
Click Restart...; click Restart
-
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
-
Disk Utility → Quit Disk Utility
-
Utilities → Terminal to bring up terminal
-
Type diskutil rename /Volumes/Persistent\ 1 NEWLY_IMAGED
-
Click on the Apple in the upper-left-hand corner
-
Click Startup Disk...
-
Select the Persistent partition
-
Click Restart...
-
When it reboots, log in
-
Bring up Terminal
-
Mount the DeployStudio server's hard drive. Check Remember this password in my keychain
-
Type DESTFILE=10.8.5-4.6.3-$(date -u +%Y-%m-%d-%H:%M).i386.hfs.dmg
-
(note: the following steps are perhaps overly cautious; shouldn't need to unmount/fsck/mount-read-only)
-
Type sudo diskutil unmount /Volumes/NEWLY_IMAGED
-
Type sudo fsck_hfs -r $(diskutil info NEWLY_IMAGED | grep Node | awk '{ print $3 }')
-
Type sudo diskutil mount readOnly $(diskutil info NEWLY_IMAGED | grep Node | awk '{ print $3 }')
-
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 ML_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 after: Never
- System Preferences → Sharing → Screen Sharing: Checked
- System Preferences → Sharing → Remote Login: Checked
- System Preferences → Users & Groups → Login Options → Automatic login: pivotal
- System Preferences → Users & Groups → pivotal → Login Items → + (not the "+" under Login Options)
Add the network share where the DeployStudio masters are located.
- Fix sudo
- Bring up a terminal
- sudo visudo
- append the following line to the sudoers:
%staff ALL=(ALL) NOPASSWD: ALL - sudo mdutil -i off /
- Set up ssh (note: if you have multiple Apple Orchard builds, e.g. one VM to build Lion, a different VM to build Mountain Lion, we suggest using the same set of ssh keys across the VMs)
To complete the next steps you need to have already set-up Jenkins, if that hasn't been done yet, please do that before proceeding.
- ssh-keygen -f ~/.ssh/id_sprout-orchard -N ''
- cp ~/.ssh/{id_sprout-orchard.pub,authorized_keys}
- scp ~/.ssh/id_sprout-orchard jenkins_user@jenkins_server:.ssh/
- [Pivotal Labs only: install ssh-keys to access private cookbooks]
- Append id_sprout-orchard.pub to the end of the DeployStudio server's userid's .ssh/authorized_keys
- Test passwordless ssh from the build VM to the DeployStudio:
ssh -i ~/.ssh/id_sprout-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_sprout-orchard User osx-build-machine-user - test password-less ssh & sudo: ssh osx-build-machine sudo id
- Install Jenkins
- Add the Git Plugin
- Access Jenkins from its web interface
For convenience, we have copied the Jenkins XML configuration into the repo.
- Job name: Apple Orchard ML Image
free-style software project - Description: Creates images to be used by DeployStudio
- Source Code Management
- Select Git
- URL of repository: git://github.com/pivotal-sprout/sprout-orchard.git
- Build Triggers
- Check Poll SCM
- Schedule 1,16,31,46 * * * *
- Build
- Select Execute Shell
- Execute shell Command: Use this shell script as a template, modifying the shell variables to suit your setup.
- Click Save
- Job name: Apple Orchard Workstation Trigger
free-style software project - Click OK
- Description: Triggers a new build of Apple Orchard when the chef cookbook has been modified.
- Source Code Management
- Select Git
- URL of repository: https://github.com/pivotal-sprout/sprout-wrap.git
- Build Triggers
- Check Poll SCM
- Schedule * 1,16,31,46 * * *
- Post-build actions
- Check Build other projects
- Projects to build Apple Orchard ML Image
- Click Save
- ssh into the DeployStudio server as the deploy user: e.g. ssh deploy@deploystudio
- cd into the Masters directory, e.g. cd /Shared\ Items/DeployStudio/Masters/HFS/
- Create a symbolic link to the pristine image: ln -s ML_mostly_pristine.i386.hfs.dmg ML_HEAD.i386.hfs.dmg
- Create 10.8 Recovery HD Creation.pkg using Der Flounder's recipe.
- Put the resulting .pkg into DeployStudio's packages directory (e.g. /Shared Items/DeployStudio/Packages/ )
- Open DeployStudio Admin
- Enter the Server address, User name, and Password; click Connect
- Select Workflows from the left hand navbar
- Click the + button at the bottom (not the one that's grayed-out)
- Enter the information:
- Title, e.g. 1 - ML HEAD
- Description, e.g. Mountain Lion (OS X 10.8) HEAD
- Click the + next to "Drop Tasks Here"
- Drag-and-drop Partition over to the tasks
- Configure the Partition:
- Target Volume: First Disk Available
- Checked: Automate
- Drag-and-drop Restore over to the tasks, after "Partition"
- Configure the Restore:
- Target volume: First disk available
- Image: HFS, use the dropdown to select ML_HEAD.i386.hfs.dmg
(you might need to restart the DeployStudio daemon to pick up the ML_HEAD dmg) - Checked: Automate
- Drag-and-drop Package Install over to the tasks, after "Restore"
- Target volume: Previous task target
- Package: 10.8 Recovery HD Creation.pkg
- Checked: Automate
- Drag-and-drop Software update over to the tasks, after "Package Install"
- Click Save
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 jenkins-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/