Apple Time Capsule as a Service with vRA/vCAC and VMware Photon

True story, recently my car was broken into and my Mac Book was stolen. Not a total loss as I keep most of my files synced to VMware Horizon data. However I did invest a lot of time setting up my Mac just the way I like it. So it dawned on me that I should probably start backing up my Macs. I looked into a Time Capsule from Apple and they are not cheap. Around $300. Essentially it is just a network attached drive so I started researching if I could just create one. This resulted in my previous blog post here. Now let’s take it a step further and setup vRA and Project Photon to provide this as a service.

Pre-Reqs

You will need a working Photon Blueprint by following my guide here

Your Photon Blueprint will need to be configured with enough storage to back up your MAC

The Photon Base image will need internet access to pull the time-container image

A quite place to work where you will not be interrupted

Disclaimer

Warning! This solution uses some open source software and is used as an education tool to learn how to use vRA/vCAC and experience VMware’s project Photon. There is no support, guarantee or warranty provided by myself, VMtoCloud.com or VMware. USE AT YOUR OWN RISK!

Start by powering on your Photon base image and creating a /mybackups directory

Now type the following to start Docker

systemctl start docker

Now type the following so Docker always starts when the VM boots up

systemctl enable docker

Now type the following and press enter to get the time machine image

docker pull bobrik/time-container

Now type docker images and press enter to verify the image is there

Now create the following shell script by typing vi /capsulecreate.sh

echo "docker run -d -p $1:548:548 -v /mybackups:/share -e AFPD_LOGIN=$2 -e AFPD_PASSWORD=$3 -e AFPD_NAME="Backup" -e AFPD_SIZE_LIMIT=8000 --name TimeCapsule bobrik/time-container" >> /capsulestart.sh
chmod u+x /capsulestart.sh
sh /capsulestart.sh

You should end up with only three lines in the file, the first line is long, I know!

Press esc and then Shift ZZ to save it then type chmod u+x /capsulecreate.sh and press enter to make the file executable.

chmod u+x /capsulecreate.sh

Now type shutdown now and press enter to power down the Photon VM

Now take a new snapshot of your Photon VM and name it TimeCapsule

Now login to vRA as an administrator and go to the infrastructure tab, then computer resources, compute resources then hover over your vCenter Cluster and click

Click to request an inventory scan

Now login to vRealize Orchestrator and import the package I created. (Remember to unzip it first!)

Download Package Here org.vmtocloud.PhotonTimeCapsule

Locate the new workflow you just imported and right click and select edit

Go to the general Tab and change the vmUsername and vmPassword to whatever you set when you deployed your Photon VM

Save and close the workflow then copy the workflow ID to the clipboard

Now login to vRA as cloudadmin and go to the infrastructure tab, then Blueprints, then Build Profiles and create the following build profile

Now go to blueprints and create a new vSphere Blueprint

Enter the following for Blueprint Information

Enter the following for Build Information (Remember to choose your TimeCapsule snapshot!)

Enter the following for properties then press OK.

Publish and entitle your catalog item. Here is the icon I used in mine!

apple-logo-small

Fire off a new request

Go to the items view and open your new VM and go to the network tab to get the IP address

Open Finder and press Command K and enter the address to your Photon VM like below

Enter the user name and password you set in the script file we created earlier and click connect

Open time machine preferences and select the Backup disk we just connected

Turn on time machine and enjoy!

Note: Again this is for learning purposes. It is not meant for real production use. Some issue you may run into are the fact that the container is not persistent. Meaning if the VM reboots for any reason it is not configured to start the time capsule container. Data integrity has also not been fully tested. Use this at your own risk.

Remember sharing is caring!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.