Cloud Foundry Eclipse integrates Cloud Foundry server and application management into Eclipse and Spring Tool Suite (STS). You can push applications to a Cloud Foundry server via drag and drop from the Eclipse Project Explorer much in the same way as deploying to a local tomcat server. Application memory and instances can be scaled easily, and services created and bound to an application through drag and drop. A comprehensive description of the plug-in is available at:
Since 1.5.0, we have been busy making CF Eclipse ready to better support new features in Cloud Foundry public and private servers.
Version 1.6.0 introduces additional enhancements:
- Support for Spring Boot applications.
- Creating server instances to private clouds that use self-signed certificates.
- Environment variables for applications.
- Open memory configuration for applications.
- Comprehensive console output.
In this article we will cover these new features through an example where a Spring Boot application is deployed to a private Cloud Foundry server.
Spring Tool Suite 3.4.0 or higher integrates with Spring Boot. This allows you to create various types of Spring Boot projects like web, batch, and AMQP. Further reading can be found at:
In order to use the Spring Boot integration for STS, install Cloud Foundry Eclipse 1.6.0 into STS 3.4.0 or higher following these instructions:
Creating a Cloud Foundry Server Instance
Once Cloud Foundry Eclipse 1.6.0 has been installed, open the Servers view in STS/Eclipse, and create a new server instance. This can be done by right-clicking on the view to open the context menu and selecting:
New -> Server
In the first page, select “Cloud Foundry” under “Pivotal”, and click “Next” to open “Cloud Foundry Account”. Click on “Manage Cloud…” to add the URL to the private cloud.
Click “Add” and enter a name and URL for the private cloud.
After clicking “Finish”, a warning may appear indicating that the URL failed to validate. Click “Yes” to keep the URL. This will return to the “Manage Cloud URLs” dialogue.
Click “OK” in the “Manage Cloud URLs” dialogue to return to the credentials page. Enter a username and password and click “Finish”, which will validate the credentials as well as automatically select the first organization and space that it finds as the server’s target space. Alternately, click “Next” to select another organization and space.
While validating the credentials, by clicking on “Finish”, “Next” or “Validate Account”, a confirmation dialogue is displayed showing that the server uses self-signed certificates, and whether to proceed in creating the server instance. If you select “Yes”, the Cloud Foundry Eclipse plug-in will remember the decision for any future server instance creation to this URL, and you will not be prompted again.
Once the server instance is successfully created, it will appear in the Servers view.
Creating and Configuring Spring Boot App
Now we create a Spring Boot application. Right-click on the Project Explorer and select:
New -> Spring Starter Project
This opens the Spring Boot (Starter) Project creation wizard. Enter details and the Spring Boot application type, and click “Finish”.
Once the project is created and built in the STS workspace, right-click on it and select:
Configure -> Enable as Cloud Foundry App
This step is necessary and allows the project to be deployable to a Cloud Foundry server instance in STS.
NOTE: As of version 1.6.0, this configuration only applies to Java Spring Boot applications, that is, Spring Boot applications that are packaged and deployed as jar files.
Pushing the Spring Boot Application
Once configured, you can simply drag and drop the Spring Boot project onto the private cloud in the Servers view.
This opens the Application Deployment wizard. You can click “Finish” right away, or “Next” to further configure the application. For instance, you can modify the mapped application URL, memory (default is set to 512MB), bind services, or set environment variables.
For our case, we click “Next”, and modify the memory.
Version 1.6.0 now supports open, variable memory configuration. Whereas previous versions of the plug-in restricted the memory choices, you can now enter any MB value over 0 up to your maximum allowed allocation. We change the default 512MB to 437MB.
Clicking “Next” will allow you to bind services, and a further click on “Next” opens the Environment Variables page, which is another new feature in version 1.6.0.
To add a new environment variable, right-click on the table to open the context menu and select “Add”. In our example we enter a RECAPTCHA_PRIVATE_KEY environment variable.
Click “Finish” to push the application to the Cloud Foundry server.
Application Staging and Console Output
Once the application begins deployment, the Eclipse console will automatically open and show progress during different stages of the deployment.
Version 1.6.0 introduces more comprehensive console progress than previous versions of the plug-in, displaying completed stages of the application deployment and start process.
After the Spring Boot application completes staging and has successfully started, the console will display the application’s standard out and error logs.
While the application is running, at any time you can refresh the console output by right-clicking on the application in the Servers view and selecting “Show Console”. This will only show the application’s standard out and error log files.
Editing Environment Variables and Memory
To edit application environment variables and memory, double-click on the application in the Servers view. This will open the Cloud Foundry server editor, and display bound services and instance stats for the application. The “General (Application Restart Required)” section allows environment variables and memory to be adjusted. For these changes to take effect, the application has to be restarted, which can be done directly from the Cloud Foundry server editor by clicking on either “Restart” or “Update and Restart”.
Improved Application Deployment
With version 1.6.0, we have enhanced application deployment from Eclipse-based IDEs. Pushing applications to private servers that use self-signed certificates is now possible. Furthermore you can now easily push Spring Boot projects to Cloud Foundry servers via drag and drop, much like any other web project.
We continue to further enhance the Cloud Foundry experience in Eclipse and STS in each new release of the plug-in.
About the Author
BiographyMore Content by Nieraj Singh