Getting started with Anka Build Cloud On Mac OS

Set up your Anka Build Cloud on Mac OS.

Welcome! this tutorial will guide you through setting up your Anka Build Cloud on Mac OS.

Necessary hardware

  1. Mac running Mac OS to install Anka Controller + Registry.
  2. At least one Mac running Mac OS to install Anka CLI as a Node.

You can complete this tutorial with only one machine running Mac OS, but it's less recommended.

What we will do in this tutorial

  1. Create your first VM
  2. Install Anka Controller and Registry
  3. Add one or more Macs as Nodes
  4. Start a VM instance using the Anka Build Cloud web interface

Step 1. Create your first VM

Perform the following steps on the machine that is intended to be the Node.

Install Anka CLI

Download latest Anka PKG

Download the file from Anka Build Download page.

curl -L -o Anka.pkg https://veertu.com/downloads/ankabuild-latest

Install Anka PKG

cd to the directory containing the file (if you are in another directory), then run:

sudo installer -pkg Anka.pkg -tgt /

Verify installation

Verify the installation by running anka version command.

anka version

Anka Build Basic version 2.1.2 (build 112)

License activation

Activate your license using the anka license command and your license key:

sudo anka license activate <key>

Download MacOS installer

Using the App Store

Use the App Store to download a MacOS install package of your choosing.
Here's a link to the MacOS Mojave install page - https://itunes.apple.com/us/app/macos-mojave/id1398502828?ls=1&mt=12 .

After the download is complete the files will be at /Applications/Install macOS Mojave.app (different MacOS versions will be called differently).

Using a script

You can use the “installinstallmacos.py” script from this Github repository (requires python installed).

Download and run the script:

curl --fail --silent -L -O https://raw.githubusercontent.com/munki/macadmin-scripts/master/installinstallmacos.py
sudo chmod +x installinstallmacos.py
sudo ./installinstallmacos.py --raw

The script downloads a disk image or a dmg, so further steps are necessary in order to create an Anka VM. Create a directory for the app:

mkdir -p /tmp/app

Attach the image using hdiutil (assuming $IMAGE_PATH is the path to the image you downloaded):

hdiutil attach "$IMAGE_PATH" -mountpoint /tmp/app

Copy the files to the Applications folder

sudo cp -r "/tmp/app/Applications/Install macOS Mojave.app" /Applications/

Detach the image:

sudo hdiutil detach /tmp/app -force

Delete the downloaded Image:

rm -f "$IMAGE_PATH"

After downloading the MacOS application you can now create your vm!

Create the VM

Use anka create command to create macOS VMs from the .app installer app.

anka create --app /Applications/Install\ macOS\ Mojave.app/ mojave-base

The VM creation should take around 30 minutes or so.

For more commands and options, see Command Reference. While you wait for the VM creation, continue and perform step 2.

Step 2. Install Anka Controller and Registry

Perform the following steps on the machine intended to run the Controller and Registry

Download the package

Download the file called “Cloud Controller & Registry (Run on Mac)” from Anka Build Download page . If you are more comfortable with the command line, you can download the file with curl:

curl -L -o AnkaControllerRegistry-1.5.2-ce0d3271.pkg https://veertu.com/downloads/ankacontroller-registry-mac-latest

The file name is constructed like this - AnkaControllerRegistry-VERSION-HASH.pkg. We follow semantic versioning so the version number is divided to MAJOR, MINOR and PATCH.

Install

For UI installation - just open the file you downloaded and follow the instructions. Or install the package using the command line -

sudo installer -pkg AnkaControllerRegistry-1.5.2-ce0d3271.pkg -target /

Verify your installation

Using the command line, execute the controller status command:

sudo anka-controller status

The response should be:

Anka Controller is Running

Anka Controller should be listening on port 80 (http). Try pointing your browser to the machine's ip or host name. You can use localhost or 127.0.0.1 when using the machine the server is installed on.

Your new dashboard should look like the picture below

How your new dashboard looks like

Orientation

Running Applications

Let's take a look on what is now running on your machine.

  1. Anka Controller serving web UI and REST API on port 80.
  2. Anka Registry serving REST API on port 8089.
  3. ETCD database server serving on ports 2379 and 2380. This server is used internally by the Anka Controller

Configuration and scripts

Anka Controller and Registry start-stop executable script is at /usr/local/bin/anka-controller. To see what functions it has, execute the script with root privileges.

sudo anka-controller
usage: /usr/local/bin/anka-controller [start|stop|restart|status|logs]

Anka Controller and Registry run script is at /usr/local/bin/anka-controllerd. This file acts as a run script and configuration file. Launchd Daemon is at /Library/LaunchDaemons/com.veertu.anka.controller.plist. When sudo anka-controller start is executed the script will use launchd to load to daemon. The daemon will then call /usr/local/bin/anka-controllerd.

Logs

Logs are written to /Library/Logs/Veertu/AnkaController by default. You can view the INFO log using tail:

tail -f /Library/Logs/Veertu/AnkaController/anka-controller.INFO

Press Ctrl+C to exit.

You can also view logs using an anka-controller command:

sudo anka-controller logs

Press Ctrl+C to exit. The log level is a number starting with 0 as the lowest, the higher the log level means more verbose. The default log level is 0.

Great! now that we have our Anka Controller and Registry up and running let's add Nodes!

Step 3. Add Nodes

Perform this on the machine you created your first VM on

Configure the Registry

We will configure the registry on this machine, so we can push the VM to it. Saving the VM on the Registry makes it possible to download and run it from other nodes. When executing the commands replace 192.168.1.10 with IP of the machine running your Registry. Assuming you haven't changed the default port configuration, your Registry is serving requests on port 8089.

Execute the registry add command to add your Registry to Anka CLI.

anka registry add MyRegistry http://192.168.1.10:8089

Verify the configuration:

anka registry list  # this command should succeed

anka registry list-repos
++
++

MyRegistry (default)

+--------+---------------+
| host   | 192.168.1.10 |
+--------+---------------+
| scheme | http          |
+--------+---------------+
| port   | 8089          |
+--------+---------------+


Push the VM

Assuming your VM is called mojave-base, execute the registry push command:

anka registry push mojave-base -t base

After the push is finished you should be able to see your new Template in the “templates” section.

Your first template

Add a Node to the cloud

We'll use 192.168.1.10 as the IP for the machine running the Controller. Replace 192.168.1.10 with the real IP or host name of your machine.

Run the Anka Agent daemon:

sudo ankacluster join http://192.168.1.10
Password:
Testing connection to controller...: Ok
Testing connection to the registry...: Ok
Ok
Cluster join success

The command should hang for a few moments before printing Cluster join success. In that period of time if any errors occur they will be printed out.

Repeat this process on other machines that you want to join as Nodes (Anka CLI needs to be installed)

Step 4. Start a VM instance using the Anka Dashboard

Go to your Anka dashboard and click on the “Instances” tab.

Your instances view

Click on “Create Instance(s)", the “Create New Instances” view will open.

new instances view

Select your template and click “Start”. the “Create New Instances” view will close and return you to the “Instances” view. You should see an Instance in “Scheduling” or “Started” state.

a scheduling instance

After the “Scheduling” period, the VM will start on one of the Nodes and Instance will be “Started”.

a started instance

Great! Your VM Instance is started.

Where to go next?

Browse Anka CLI Command Reference.
Connect your cloud to a CI server.
Find out how to use the Controller REST API.
Learn how to work with USB devices


Last modified January 9, 2020 : moved partial files (26fbf87) by asafg6