The Spring Boot Dashboard in STS: Working With Cloud Foundry Manifest Files
The latest release 3.7.3 of the Spring Tool Suite introduces a number of new features around the Spring Boot Dashboard. Let's take a look at how Spring Boot Dashboard works with Cloud Foundry manifest files.
Join the DZone community and get the full member experience.Join For Free
welcome back, spring community,
the latest release 3.7.3 of the spring tool suite introduces a number of new features around the spring boot dashboard. therefore we continue the blog post series that started last year and introduced you to the new way of working with spring boot based microservice projects in your ide (you can find links to the previous parts at the bottom).
cloud foundry manifest files
in this new part of the series we take a closer look at cloud foundry manifest files. they are a cloud foundry concept used as a shortcut to define configurations for applications on cloud foundry. instead of passing every argument and configuration to the command line when doing a “cf push”, you can put all your configuration data into a yaml file and pass that to the push command instead. more detailed information about cloud foundry manifest files can be found here.
the early versions of the spring boot dashboard already used the manifest files for deploying an app to cf if a file called “manifest.yml” existed in the project. this was done “under the hood” for your convenience. that was nice and useful. but it also caused confusion due to the “hidden nature” of this support.
choose a manifest file when deploying an app
the new version of the spring boot dashboard supports cloud foundry manifest files as a first-class citizen. this starts to show up when you deploy an application from within the boot dashboard to a cloud foundry target for the first time. a dialog comes up and asks you which manifest file should be used for this deployment operation.
this dialog allows you to select the manifest file you would like to use to deploy the app. this also allows you to have multiple manifest files in your projects - for example for different spaces on cloud foundry or different deployment environments. you can also deploy the same app multiple times to the same cloud foundry target by choosing a different manifest file for each deploy operation.
the dialog shows the content of the selected manifest file, so that you can verify that you selected the correct one. and if something is wrong inside of the manifest file, you don’t need to go back to the main ide workbench, open the file, edit it, save it, and go back to the deploy operation. instead edit the manifest file content directly within the dialog. this makes deploying an app to cloud foundry really easy.
the boot dashboard will remember your choice and use the same manifest file again if you update your project on cloud foundry. that also means that changes to the manifest file will be taken into account the next time the app is re-deployed to cloud foundry (during a boot dashboard restart operation, for example).
of course you can change your mind and decide to choose a different manifest file. an action in the context menu allows you to open the same “choose the manifest file” dialog and make a different choice. the next redeploy of the app will take that change into account. you can also use this dialog to quickly check which manifest file is currently associated with the project.
deploying without a manifest file
sometimes you don’t already have a manifest file or you don’t want to use an existing manifest file. in that case, you can choose the “manual mode” in the dialog.
it opens up an editor area for a temporary manifest file and fills that with some default content. you can edit this temporary manifest content, add properties or change existing ones. this allows you to completely define the way the app should be deployed to cloud foundry.
the content of that temporary manifest is not stored anywhere (we may add a convenience option to quickly save the manually entered manifest content to a new file) and the ide doesn’t remember it for the next time you update the application on cloud foundry. instead the existing configuration on cloud foundry will be kept and used while updating the application.
this is also true if you have used a manifest file in the past and then decided to switch to the manual mode. subsequent updates to the application will keep the configuration on cloud foundry untouched.
changed configurations on cf
let’s imagine you have used a manifest file to deploy your application from within the boot dashboard to cloud foundry. then you go to the web console and add a service to the already deployed app - or change the memory settings, scale it up, or do similar changes to the configuration. if you go back to the boot dashboard, maybe change some code of the app, and restart (and therefore update) the app on cloud foundry, the boot dashboard would use the manifest file again - and trash all the changes to the configuration that you made on cf. to avoid this, the boot dashboard checks for configuration changes on cloud foundry when re-deploying an application that uses a manifest file. if a configuration mismatch is found, it opens up a diff and merge dialog - and displays the detailed changes.
this feature prevents you from override configuration changes by accident. and it is a powerful dialog that lets you merge configuration changes on cf to your local manifest file. you can merge individual changes as well as all changes at once. that makes it easy to update the local manifest file with those changes and you can continue to use the manifest file when updating the application in the future.
in case you don’t want those configuration changes on cf to be reflected in your local manifest file, select the “forget manifest” button and the boot dashboard will keep the configuration on cloud foundry as it is. it switches the application to the “manual mode” deployment.
again, if you would like to explicitly change those settings, go to the context menu and choose the “select manifest” operation.
editing manifest files
while the cloud foundry manifest files are a nice and clean way to configure your application for cloud foundry, it can be cumbersome to edit those files. luckily the new version of the spring tool suite comes with a specialized editor for cloud foundry manifest files.
it provides nice content-assist for property names and selected property values.
if you hover over the properties, you get additional help about the property and examples how and when to use it.
the file is also validated while typing. reconcile errors are showing up directly in the editor in the same way they do in spring boot property files or when editing java code.
and the good news is: this advanced editing support is available in the “select the manifest file” dialog, too (for example when working on the manual manifest or changing the selected manifest file content):
the next part of this blog series will cover the new support for working with multiple launch configurations for local spring boot applications. stay tuned.
the spring boot dashboard blog series:
Published at DZone with permission of Martin Lippert. See the original article here.
Opinions expressed by DZone contributors are their own.