This topic guides you through starting to iterate on your first application on Tanzu Application Platform, which you deployed in the previous how-to, Deploy your first application.
In the previous Getting started how-to topic, Deploy your first application, you deployed your first application on Tanzu Application Platform. Now that you have a skeleton workload developed, you are ready to begin to iterate on your new application and test code changes on the cluster.
Tanzu Developer Tools for Visual Studio Code is VMware Tanzu’s official IDE extension for VS Code. It helps you develop and receive fast feedback on your workloads running on the Tanzu Application Platform.
The VS Code extension enables live updates of your application while running on the cluster and allows you to debug your application directly on the cluster. For information about installing the prerequisites and the Tanzu Developer Tools for VS Code extension, see Install Tanzu Dev Tools for VS Code.
ImportantUse Tilt v0.30.12 or a later version for the sample application.
Open the Tanzu Java Web App as a project within your VS Code IDE.
To ensure your extension assists you with iterating on the correct project, configure its settings using the following instructions.
In Visual Studio Code, navigate to Preferences > Settings > Extensions > Tanzu Developer Tools.
In the Local Path field, provide the path to the directory containing the Tanzu Java Web App. The current directory is the default.
In the Source Image field, provide the destination image repository to publish an image containing your workload source code. For example, gcr.io/myteam/tanzu-java-web-app-source
.
NoteSee the documentation for the registry you’re using to find out which steps are necessary to authenticate and gain push access.
For example, if you use Docker, see the Docker documentation, or if you use Harbor, see the Harbor documentation.
You are now ready to iterate on your application.
Deploy the application to view it updating live on the cluster to see how code changes behave on a production cluster.
Follow the following steps to live update your application:
From the Command Palette (⇧⌘P), type in and select Tanzu: Live Update Start
. You can view output from Tanzu Application Platform and from Tilt indicating that the container is being built and deployed.
NoteDepending on the type of cluster you use, you might see an error similar to the following:
ERROR: Stop! cluster-name might be production. If you're sure you want to deploy there, add: allow_k8s_contexts('cluster-name') to your Tiltfile. Otherwise, switch k8scontexts and restart Tilt.
Follow the instructions and add the line,allow_k8s_contexts('cluster-name')
to yourTiltfile
.
http://localhost:8080
in your browser, and view your running application.HelloController.java
, edit the string returned to say Hello!
and save.Debug your cluster either on the application or in your local environment.
Use the following steps to debug your cluster:
workload.yaml
within the config
directory and select Tanzu: Java Debug Start. In a few moments, the workload is redeployed with debugging enabled. The “Deploy and Connect” Task completes and the debug menu actions are made available to you, indicating that the debugger has attached.http://localhost:8080
in your browser. This hits the breakpoint within VS Code. Play to the end of the debug session using VS Code debugging controls.Inspect the runtime characteristics of your running application using the Application Live View UI to monitor:
You can also troubleshoot environment variables and fine-tune the running application.
Use the following steps to diagnose Spring Boot-based applications by using Application Live View:
Confirm that the Application Live View components installed successfully. For instructions, see Install Application Live View.
Access the Application Live View Tanzu Application Platform GUI. For instructions, see Entry point to Application Live View plug-in.
Select your running application to view the diagnostic options and inside the application. For more information, see Application Live View features.