In Part IX of this series, we deployed the datastore usage sample function into our appliance. In this post, we discuss how to build the appliance OVA from source code. This blog post would not have been possible without William Lam spending his valuable time teaching the VEBA team about the build process.
The VEBA appliance is built periodically, when enough features have been added to warrant a release. However, changes are committed frequently to the development branch. Sometimes, you want to deploy a new feature but don’t want to wait for a new release. Or, in my case, I wanted to make a change to the options shown while deploying the OVA. This requires rebuilding the appliance. Everything you need to package the appliance for use is available in the event broker repository.
Step 1 – Build machine
First, you need a build machine. You cannot use Windows for this task. I run a Windows laptop, so I ended up building a Ubuntu build server in my homelab. Here are all of the packages I added in order to be able to build an OVA.
#Git
apt install git-all
#Unzip
apt install unzip
# OpenFaas command line utility faas-cli
curl -sSL https://cli.openfaas.com | sudo sh
#Packer utility from Hashicorp
wget https://releases.hashicorp.com/packer/1.5.6/packer_1.5.6_linux_amd64.zip
unzip packer_1.5.6_linux_amd64.zip -d /usr/local/bin
#Download ovftool from My VMware
#https://my.vmware.com/group/vmware/get-download?downloadGroup=OVFTOOL440
# I used WinSCP to copy the file to the Linux VM. I’m beginning to see why lots of # #developers like Macs
chmod 744 VMware-ovftool-4.4.0-15722219-lin.x86_64.bundle
./VMware-ovftool-4.4.0-15722219-lin.x86_64.bundle
#Install PowerShell 7.0
# https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7
# The documentation tells you to do the following commands:
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
apt-get update
add-apt-repository universe
apt-get install -y powershell
#But the commands result in this error:
#Reading package lists… Done
#Building dependency tree
#Reading state information… Done
#Some packages could not be installed. This may mean that you have
#requested an impossible situation or if you are using the unstable
#distribution that some required packages have not yet been created
#or been moved out of Incoming.
#The following information may help to resolve the situation:
#The following packages have unmet dependencies:
#powershell : Depends: libssl1.0.0 but it is not installable
#Depends: libicu60 but it is not installable
#E: Unable to correct problems, you have held broken packages.
# This problem is fixed in RC https://github.com/PowerShell/PowerShell/releases/tag/v7.0.0-rc.1
# Download the release candidate code, extract it, and add a path to $PATH
# Install PowerCLI
install-module vmware.powercli
# Configure Git
root@build01:~# git config –global user.name “Patrick Kremer”
root@build01:~# git config –global user.email “pkremer@vmware.com”
# Configure git password cache for github
# https://help.github.com/en/github/using-git/caching-your-github-password-in-git
git config –global credential.helper cache
git config –global credential.helper ‘cache –timeout=86400’
# Clone my fork, add the upstream repo
git clone https://github.com/kremerpatrick/vcenter-event-broker-appliance.git
git remote add upstream https://github.com/vmware-samples/vcenter-event-broker-appliance.git
Step 2 – Clone the repo
You need to clone the development repo. If you are not familiar with git, take a look at Part V. If you’ve been following the examples and have the code, but just need to make sure you have the latest copy of the development branch, look at Part VI.
Step 3 – Build an ESXi host
If you’ve still got a 6.7 host around, you’re in luck. But as of the date of this blog post, you cannot build the VEBA appliance against a 7.0 host. The build process relies on VNC, which was removed from ESXi in 7.0. My lab is on 7.0, so I had to build a nested ESXi. I know for a fact that I’ve gotten the native MAC learning feature working in my lab, but I could not get it to work nesting 6.7 inside 7.0. I’m not sure why it wouldn’t work, so I ended up reverting to the tried-and-true promiscuous mode for the outer portgroup, and an untagged portgroup for the inner one. In this screenshot, esx03 is a VM running on physical hosts in cluster CL1, but I added it as a host outside the cluster in vCenter.
Step 4 – Edit JSON files
In the root of the vcenter-event-broker-appliance directory are photon.json and photon-builder.json. You must edit them to match your environment
root@build01:/var/git/vcenter-event-broker-appliance# cat photon-builder.json
{
"builder_host": "192.168.30.14",
"builder_host_username": "root",
"builder_host_password": "VMware1!",
"builder_host_datastore": "sm-vsanDatastore",
"builder_host_portgroup": "VM Network"
}
builder_host is the nested ESXi 6.7 host. Make sure to enter the correct datastore, it’s easy to make a typo so consider copy-pasting the value. You need to keep the portgroup “VM Network”, so you will need to put a portgroup named “VM Network” on your nested ESXi host. Otherwise your own portgroup name will be built into the appliance. Also, the automation scripts in the /test folder will break because they’re looking for “VM Network” to be in the appliance.
Now look at the top of photon.json. Adjust the file to point to the vCenter managing your nested ESXi host.
root@build01:/var/git/vcenter-event-broker-appliance# more photon.json
{
"variables": {
"veba_ovf_template": "photon.xml.template",
"ovftool_deploy_vcenter": "192.168.30.200",
"ovftool_deploy_vcenter_username": "administrator@vsphere.local",
"ovftool_deploy_vcenter_password": "VMware1!"
},
You can also look at photon-version.json – unless you work for VMware, you probably won’t be releasing VEBA, so you won’t really need to adjust this file. But it’s important to note that the output of the build process will look like an official build. If you build the OVA straight out of the development branch, you’ll end up with a appliance name like vCenter_Event_Broker_Appliance_v0.4.0.ova – this of course does not match the actual release v0.4.0, so don’t get yourself confused with binaries downloaded on your machine.
root@build01:/var/git/vcenter-event-broker-appliance# cat photon-version.json
{
"version": "0.4.0",
"description": "Photon Build for vCenter Event Broker Appliance",
"vm_name": "vCenter_Event_Broker_Appliance",
"iso_checksum": "f6619bcff94cef63d0d6d7ead7dd3878816ebfa6a1ef5717175bb0d08d4ccc719e4ec7daa7db3c5dc07ea3547fc24412b4dc6827a4ac332ada9d5bfc842c4229",
"iso_checksum_type": "sha512",
"iso_url": "http://dl.bintray.com/vmware/photon/3.0/Rev2/iso/Update1/photon-3.0-a0f216d.iso",
"numvcpus": "2",
"ramsize": "8192",
"guest_username": "root",
"guest_password": "##FILL-IN-SECURE-PASSWORD##"
}
We start the build with build.sh
build.sh release
It will take some time the first time to download photon your system. It caches the iso so future builds aren’t as slow.
The script will also sit for some time on the ‘Starting HTTP server’ message. If you look at your nested host you will eventually see a disk being built
This is what is running behind the HTTP server – the build script has created a PXE boot host
The VM will eventually start booting
If you want to see the PXE boot happening live, you will quickly need to establish a console session on the VM as it boots. You will see packer typing PXE boot commands over VNC. The VM will PXE boot, run commands, then reboot into Photon and end up at a command prompt
The script completes the rest of the configuration via SSH.
The build will progress until completion.
The OVA file will be in the output-vmware-iso folder. You can see here that I renamed it with my initials so I don’t get confused by the official 0.4.0 ova.
root@build01:/var/git/vcenter-event-broker-appliance/output-vmware-iso# ls -al
total 1232992
drwxr-xr-x 2 root root 4096 May 15 23:49 .
drwxr-xr-x 16 root root 4096 May 18 20:43 ..
-rw——- 1 root root 1262570496 May 15 23:44 vCenter_Event_Broker_Appliance_v0.4.0-pk.ova
That’s it for building VEBA. In the next post we will look at the underlying change that made it necessary for me to build the OVA – how to change the options in the deployment GUI.
VMware Event Broker Appliance – Part XI – Changing options in the OVA installer | Patrick Kremer
[…] Part X, we talked about building the VEBA OVA from source code. In this post, I will explain the change I […]