My recent blog post on setting up a custom vSphere Content Library on my Synology gave me another idea that I had been thinking about regarding Project Keswick, which was announced back at VMware Explore Las Vegas.
If you have network connectivity to the Keswick Cloud Service, you can easily associate a Git repository, which is used for host configurations and workload deployments using GitOps using Github or even a privately managed Gitlab instance. For organizations that have additional compliance, security or air-gapped requirements, using the Keswick Cloud Service may not be an option. With that said, Project Keswick also supports an advanced deployment option where the association of a Git repository, such as GitLab, can also be accomplished without requiring the use of the Keswick Cloud Service.
While I have had experience using both Github as well as GitLab, which VMware uses to host its own code repository, I have actually never setup my own GitLab instance before. I thought this would be a great learning opportunity, especially with the ability to run additional add-on applications on a Synology.
After a bit of researching online, I found that GitLab can easily run as a Container workload and it just so happens that the Synology DiskStation Manager (DSM) has a package for running containers creatively called Container Manager and below are the step by step instructions for setting up GitLab running on Synology DSM 7.2.
Step 1 - Login to the Synology DiskStation Manager (DSM) and open up the Package Center on the desktop. Search for the Container Manager application and initiate the installation.
Step 3 - Next, open the Container Manager and click on the Registry tab to download the latest GitLab Enterprise Edition container image. Search for gitlab/gitlab-ee in the search box and which should automatically find our desired package and then click on the download button.
Step 4 - Once the download has completed, which can take a couple of minutes, click on the Container tab to deploy an instance of the container. Select the container image which was downloaded from Step 3 and then provide a name.
Next, we need to map the external ports that we will use to connect to the GitLab instance via our Synology endpoint to the internal container ports as well as the folder mapping to the GitLab configuration files. Below are the configurations for my setup and we will connect to the GitLab instance on port 8080:
- /gitlab/data -> /var/opt/gitlab
- /gitlab/logs -> /var/log/gitlab
- /gitlab/config -> /etc/gitlab
Step 6 - By default, a random root password is generated for the GitLab container image as part of the setup and it will be deleted after 24 hrs. We need to retrieve the initial root password, so we can login to the GitLab instance to change the password.
To do this, we need to run a command inside the container to retrieve the password and the easiest way is to do this by SSH'ing to your Synology. If you do not have SSH enabled, navigate to the Control Panel->Security->Terminal & SNMP and selecting the Enable SSH Service and click on the apply button for change to go into effect.
Once logged in, run the following command (replace gitlab-gitlab-ee-1 with the label you had named your GitLab container instance):
sudo docker exec -it gitlab-gitlab-ee-1 grep 'Password:' /etc/gitlab/initial_root_password
If you are interested in using your newly deployed GitLab instance with Project Keswick, the remainder of the of instructions will walk you through the required configurations.
Step 8 - Create a new GitLab project that will be used as the repository that your Keswick host will be associated with.
Step 9 - We now need to request a deploy token from our repository, which will be used by the Keswick host to watch for workload deployment and host configuration files. Click on Settings and then click on Repository and expand the Deploy Tokens section to request a token. Only the read_repository scope is required and provide a token name (optional) or make a note of the default token name as that will be required when updating our Keswick ESXi Kickstart deployment configuration file.
Step 10 - At this point, you can clone your repo to your local machine and start checking in configuration files that will be consumed by your Keswick host.
Note: I have not figured out how to update GitLab or the Synology settings so that the URL provided for cloning uses the Synology FQDN/IP Address rather than just the container name. If anyone happens to know how to change this, please let me know by leaving a comment. You will need to replace the URL shown in the repo page with the Synology FQDN/IP Address which in my example would be http://nas.primp-industries.local:8080/lamw/keswick-nuc13.git (note that this is using HTTP and NOT HTTPS)
Step 11 - Next, sign up and register for a free Project Keswick account if you have not already, which is required to download the Keswick software. Download the Keswick Image, which is available in three different formats:
- ISO - Use this image if you will be booting from a physical/virtual CD-ROM including the use of out-of-band management like BMC/iDRAC/iLO
- OVA - If you do not have physical hardware to try out Project Keswick, you can use the OVA which is a Nested ESXi VM that contains the Keswick image and you can deploy that to vSphere, Workstation or Fusion for testing purposes.
- IMG - Use this image if you will be booting from a USB device
Note: I accidentally made the mistake of assuming the ISO image could also be used to create a bootable USB device as I typically use Unetbootin, which is a multi-platform utility for creating bootable live-CD on USB. If you use the ISO image, the ESXi installer is expecting the embedded ESXi Kickstart to be loaded from CD-ROM rather than USB, which is what the USB image is configured with. If you are familiar with ESXi Kickstart, it is a quick change to efi/boot/boot.cfg file on the USB device or you can simply download the correct image and then create the bootable USB device following directions HERE.
Step 11 - We need to adjust the default KS.CFG, which is located in the root of the USB device and uncomment the following section as shown in the screenshot below and add our deploy token details along with the branch name and GitLab repo.
Step 12 - Plug the USB device into your Keswick host and wait for the deployment to complete and then reboot automatically.
For my Keswick workload, I decided to deploy a pretty important application called Mario 🤪
This is actually based on a really slick project that I had first blogged about back in 2021 where you can run Retro DOS Games using Kubernetes (K8s)! The original setup used port forwarding to access the game via a browser, but if you deploy a simple k8s service load balancer like Metallb, then that additional step is not required and can be accessed by others that also have network connectivity to your Keswick host. I've put together all the required k8s manifest in the following repo: https://github.com/lamw/keswick-mario-demo and yes, the order of deployment does matter, so you will need to have multiple git commits to ensure the required k8s resources are realized before deploying the next resource.