So as I was building my #HomeLab Horizon infrastructure (again), I decided to go with the latest 2103 release. As mentioned previously, I planned to host my events database in a Kubernetes-hosted database server. I was getting ready to deploy the MS SQL Server pod when I came across an interested note in the Release Notes (emphasis added):
You can configure VMware Horizon to record events such as end-user actions, administrator actions, alerts, and statistical sampling to a database. Supported types of databases are: Microsoft SQL Server, Oracle, and PostgreSQL.
Did I read that right? PostgreSQL is now a supported DB? Yep. Sure enough, they added official support for PostgreSQL with this release.
For those interested, I once developed an open source home inventory web app based on PostgreSQL called PgWebInventory–back when Freshmeat (pre-Sourceforge) was where all the cool kids hosted open source projects. I have ALWAYS been a fan of the PostgreSQL project and love to use it whenever possible. So, f-yeah I’m going to use it for my Horizon Events DB!
On the official VMware Interoperability Matrix, the following PostgreSQL releases are supported in versions 2103 and 2106:
|PostgreSQL Version||Compatible VMware Horizon Release|
|12.4||2103 / 2106|
|12.5||2103 / 2106|
|12.6||2103 / 2106|
|13.0||2103 / 2106|
|13.1||2103 / 2106|
Of course, I’m one to push the limits. I found the most current PostgreSQL Docker Image is 13.2, so that is the one I tried. (Spoiler Alert: It works!) I have uploaded the manifest files to my Github account for you to pull if you’d like to try this at home. As far as the resource requirements go, I went much bigger than I needed, but VMware did not list any specific requirements. I went with the following requests and limits:
- 512 MiB Memory
- 0.5 Kubernetes CPU
- 1 GiB Memory
- 1 Kubernetes CPU
I plan to monitor these resources to see what is actually needed in my environment. Since I will have maybe 1 or 2 desktop and application pools in use, I see my Events DB being filled with mostly housekeeping information rather than user logs.
Once the Kubernetes deployment is up and running, time to configure Horizon. Log into the Horizon Administration Console. Once your on the Dashboard, click on the “Event Configuration” link. It’s in the “Settings” section. I’ve circled the area of the dashboard below:
Once you’re on the Event Configuration page, click on the “Edit” button shown here:
Now, one of the items you will need to proceed is the IP address and port for the PostgreSQL Kubernetes service. As you can see on the image below, you use the “get services” sub-command. It will list all of the services your Kubernetes cluster is currently publishing in the default namespace. If you used the manifests I provided, it will be named “pgsql-horizon-svc” and be of type LoadBalancer. You will need the “External IP” and Port (the part before the colon) for the Horizon configuration. If your response from the cluster shows the “External IP” as “Pending”, it means you do not have a Load Balancer configured for your cluster. I’m using MetalLB on mine. Check out their project page, it’s great for small deployments.
Once you have the required information, you’re ready to fill in the event db configuration page. On the drop-down for “Database Type”, here are the options you are presented with:
Here’s what the full config for my deployment looks like:
Click “Ok” when you’re done and Horizon can verify a good connection with the database, you will be returned to the previous page.
That’s it! You’re now storing Horizon events in a PostgreSQL database hosted in a Kubernetes cluster. How cool is that??? You can click on the “Events” menu item under “Monitor” (circled below) to see various administrative, security, and troubleshooting events stored in your database:
If this was useful or helpful, please like and share! If there’s a topic you would like to see something more on, please let me know!