/ #automation #devops 

Getting started with VMware AppCatalyst

Released as a technology preview during the latest DockerCon (June 2015), VMware AppCatalyst is an API and Command Line Interface (CLI)-driven Mac hypervisor that is purpose-built for developers. Once installed, VMware AppCatalyst allows to quickly and easily deploy Linux container hosts based on VMware Project Photon.

[...] VMware AppCatalyst offers developers a fast and easy way to replicate a private cloud locally on their desktop for building and testing containerized and microservices-based applications. The tool features Project Photon, an open source minimal Linux container host, Docker Machine and integration with Vagrant.

AppCatalyst leverages the same hypervisor that ships in Fusion. However, don’t try to find a GUI as only the CLI and the API are exposed to rapidly deploy and operates instances. :)

From the AppCatalyst community, we learn that:

AppCatalyst is offered as a free download, and is optimized for developer workloads. To do so, AppCatalyst focuses on API- and command-line interface access, ships with a container runtime, and is designed to provide an environment consistent with that in the production stack. In short, AppCatalyst makes it easy for developers to write, test, and ship code.

By using AppCatalyst’s CLI (or API), you can create/clone Photon instances from the template provided, generate a list of all named VMs available to the logged in user, start those Photon instances, get their IP, ssh to the instances and launch containers. With this model, AppCatalyst handles the VM creation, power-on, etc so the developer can focus on building, running, and testing their app.

The installation procedure is very straightforward: download the AppCatalyst .dmg file, launch the installer, and follow the usual steps (accept EULA, choose destination folder, and so on).

To start doing some awesomeness, navigate to /opt/vmware/appcatalyst/bin (you can add this directory to the path for easier future interaction) and execute appcatalyst to get a list of available commands. As you can see in the screenshot below, the CLI is quite basic but adequate! :)

VMware AppCatalyst: commands list

VM listing (I had already a VM named deathstar):

rdecker@rdecker-mbpr ~/Documents/AppCatalyst$ appcatalyst vm list
Info: VMs found in '/Users/rdecker/Documents/AppCatalyst'
deathstar

VM creation:

rdecker@rdecker-mbpr ~/Documents/AppCatalyst$ appcatalyst vm create milleniumfalcon
Info: Cloned VM from '/opt/vmware/appcatalyst/photonvm/photon.vmx' to '/Users/rdecker/Documents/AppCatalyst/milleniumfalcon/milleniumfalcon.vmx'

List all powered-on VM:

rdecker@rdecker-mbpr ~/Documents/AppCatalyst$ appcatalyst vmpower list
Info: No powered-on VMs found in '/Users/rdecker/Documents/AppCatalyst'

Start a VM:

rdecker@rdecker-mbpr ~/Documents/AppCatalyst$ appcatalyst vmpower on deathstar
2015-08-04T11:20:47.696| ServiceImpl_Opener: PID 35717
Info: Completed power op 'on' for VM at '/Users/rdecker/Documents/AppCatalyst/deathstar/deathstar.vmx'
rdecker@rdecker-mbpr ~/Documents/AppCatalyst$ appcatalyst vmpower on milleniumfalcon
2015-08-04T11:21:00.293| ServiceImpl_Opener: PID 35775
Info: Completed power op 'on' for VM at '/Users/rdecker/Documents/AppCatalyst/milleniumfalcon/milleniumfalcon.vmx'

When a Photon container host is created and started, you only have to connect to the VM via SSH and launch containers: Docker is already installed, configured and started. To connect via SSH, you need first to get the IP address of the VM with appcatalyst guest getip.

rdecker@rdecker-mbpr ~/Documents/AppCatalyst$ appcatalyst guest getip deathstar
192.168.85.129

SSH to the VM using the private key stored in AppCatalyst installation folder:

rdecker@rdecker-mbpr ~/Documents/AppCatalyst$ ssh -i /opt/vmware/appcatalyst/etc/appcatalyst_insecure_ssh_key photon@192.168.85.129
The authenticity of host '192.168.85.129 (192.168.85.129)' can't be established.
RSA key fingerprint is 77:e8:6e:02:72:a2:13:98:f3:36:00:ba:c1:06:ae:22.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.85.129' (RSA) to the list of known hosts.
Last login: Fri Jun 19 20:51:42 2015 from 192.168.217.1

photon [ ~ ]$ sudo docker info
Containers: 0
Images: 0
Storage Driver: overlay
 Backing Filesystem: extfs
Execution Driver: native-0.2
Logging Driver: json-file
Kernel Version: 3.19.2
Operating System: VMware Photon/Linux
CPUs: 1
Total Memory: 489.8 MiB
Name: photon
ID: 3BAY:KC43:24HE:7KSG:JEVM:2FY7:RVX7:TZPQ:XGR3:VSGH:NX72:IY7J
photon [ ~ ]$ sudo docker version
Client version: 1.7.0
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 0baf609
OS/Arch (client): linux/amd64
Server version: 1.7.0
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 0baf609
OS/Arch (server): linux/amd64
photon [ ~ ]$

Finally, you can launch the container of your choice to validate the installation, such as the usual Nginx image available in the vmwarecna repository.

photon [ ~ ]$ sudo docker run -d -it -p 80:80 vmwarecna/nginx

Start a browser  and enter the IP address of your Photon VM to see the Nginx container running…or do something more fancy! :)

photon [ ~ ]$ sudo docker run -it ubuntu sh -ic "apt-get update -q && apt-get install cmatrix && cmatrix"

VMware AppCatalyst and Photon: welcome to the Matrix

Notes:

  • Ensure that VMware Fusion is not running before installing AppCatalyst.

  • By default, all VMs will be cloned from the Photon template (/opt/vmware/appcatalyst/photonvm) and placed into the default directory (~/Documents/AppCatalyst/).

  • Retrieving the guest IP address can take a few seconds, patience you must have my reader.

  • Remove the concerned folder to remove a VM. There is currently no command implemented for this action.

  • If the Power ON operation is impossible for an instance, verify first that VMware Fusion is not running. In last resort, you can try a reboot. I had a dependency mismatch that resolved itself with a reboot.

To download the latest build, seek assistance, and provide feedback, please visit the AppCatalyst community site: http://www.vmware.com/go/communities-appcatalyst.

Author

Romain

Staff Architect & Member of the CTO Ambassador Program at VMware, focusing on NSX and Cloud-Native Applications. He is a double VCDX (DCV and NV, #120), VCDX panelist, frequent VMUG/VMworld speaker and contributor to the community via this blog or social media (follow him on Twitter @woueb).