In my previous post, application workload was deployed, able to access the app and validated the scan results successfully. Now let me take you through the steps to iterate the application and test code changes on the cluster. Tanzu Developer Tools for VSCode, VMware Tanzu’s official IDE extension for VSCode helps you develop & receive fast feedback on the Tanzu Application Platform. VSCode extension enables live updates of application while it runs on the cluster and lets you debug your application directly on the cluster.
Install VS Code and Tanzu CLI
- Download VS code here, and install in your local machine.
Install Tanzu CLI
- Login to Tanzu Network, click on folder tanzu-cli-v0.10.0 and download tanzu framework bundle (select appropriate file based on OS type)
- Refer to VMware Doc in case of any issues.
Tanzu Extension for Visual Studio Code
- Download Tanzu Extension from Tanzu Network
- Open VS Code, navigate to the Extensions menu (⇧⌘X), then from Views and More Actions menu (…) select Install from VSIX… Select the tanzu-vscode-extension.vsix file downloaded from Tanzunet.
Note: Upon installation, accept the dialog box to install the Extension Pack for Java and the YAML Language Support by Red Hat. These are required dependencies for debugging, live-reloading, and enabling snippets.
- When you do not already have a Java Development Kit(JDK) installed, the Java extension pack prompts you to install one. When the JDK and Language Support for Java are configured correctly, you see that the integrated development environment creates a directory “target” where the code is compiled. Ensure to install latest JDK version.
Tilt is an open-source tool that aims to provide a productive software development environment for anyone whose deployment target is Kubernetes.
Tilt not only helps with orchestrating the deployment of changes for testing, but the live_update allows to start testing the changes without needing to wait for image builds. Tilt enables to move from painstakingly long dev and test cycles to rapid iterative development across the project life cycle.
- Refer to doc for Installing Tilt in your local machine, follow the appropriate steps based on the operating system you use.
Configure Tanzu Extension and Tilt
- With ref to post, where we downloaded the zip bundle from Accelerator and pushed to git repo. For this demo, I moved cloned the public repo into my local machine:
- Open VS Code, File > Open Folder > Select the folder
Run Application locally
- Select .java file > Run > Start Debugging
- Open Browser > access the url: localhost:8080
- Output should match the text given in .java file.
- Navigate to Extensions > Tanzu > gear icon – as shown below > Extension Settings
Configure Tiltfile to use EKS Cluster
- By default, Tilt automatically allows Minikube, Docker for Desktop, Microk8s, Red Hat CodeReady Containers, Kind, K3D, and Krucible. In order to allow EKS cluster, add below line to the Tiltfile:
- In VS Code > Explorer > Tiltfile
In earlier posts, we have deployed a web application and now let’s do a live update on the cluster.
- In VS Code Explorer > .java (In this demo it is HelloController.java which in under /src/main/java/com/example/springboot) > modified the string as shown below:
- From the Command Palette (⇧⌘P), type in and select Tanzu: Live Update Start. Tanzu Logs opens up in the Output tab and you will see output from the Tanzu Application Platform and from Tilt indicating that the container is being built and deployed. Because this is your first time starting live update for this application, it might take 1-3 minutes for the workload to be deployed and the Knative service to become available.
- Access tilt url
- You can see the progress in VS Code Terminal or in Tilt as shown below:
- If this is your first update, wait for few mins and access the webapp url to see the reflected changes.
- Refer to post if you want the know the url.
- Next subsequent changes should be completed in few secs:
- From the Command Palette (⇧⌘P), type in and select Tanzu: Live Update Stop to stop the live update.