Spring Boot

Spring Boot

Hosting Spring Boot Standalone and Clustered Java Applications with Jelastic Cloud

spring boot monitoringSince the very foundation, Jelastic PaaS evangelizes the idea of making application deployment process as easy and universal as possible. Keep following our mission, today we are glad to introduce another newcomer within a family of certified Java-powered stacks – Spring Boot server for standalone and clustered applications or microservices.
With Jelastic’s Spring Boot stack template, you can effortlessly run various Java-based applications inside the cloud via easy-to-use graphic interface or automation scripts. The following Java project types can be hosted within this server:

  • JAR – for standalone Java apps or stateless microservice instances, created using Spring BootDropwizard or Spark frameworks
  • WAR – for web applications with embedded servlet container

In this way, Spring Boot enables you to keep things portable, whilst Jelastic ensures quick delivery of applications to production and their comprehensive management via GUI, API or Cloud Scripting.

Creation of Spring Boot Environment

So, log in to your Jelastic Cloud dashboard and let’s get started.

1. First of all, you need to create a New Environment – use the same-named button to launch topology wizard. Switch to Java language tab and choose SpringBoot template within application server layer at the left-hand panel like shown below. Set the amount of allocated resources, type your environment name and click Create to proceed.

spring boot application cloud hosting

Versions Compatibility:

  • Indication with 1.x-2.x label implies that Jelastic-managed Spring Boot server can run any application, built upon these versions
  • The current custom Spring Boot stack is provisioned within Jelastic Platforms of 4.10 version and higher.

2. When your new environment appears at the dashboard, you can click Open in browser to launch the pre-installed Hello World application sample. spring boot load balancing

In this way, you can make sure your Spring Boot instance is up and running. spring boot custom port

Now let’s consider how to integrate your custom Java application into the created Spring Boot environment.

Deploying Java Applications to Spring Boot

To launch your Spring Boot project inside Jelastic, you need to preliminary pack it into an executable archive with all the appropriate compiled classes and associated resources inside (including embedded servlet container for handling self-contained applications). The following archive types are supported:

  • JAR – the most common Java-archive type; should either contain a manifest with declared entry point class or being built as all-in “fat” JAR or nested JAR file
  • WAR – for deployment of applications with embedded servlet container; in particular, should be used for JSP-based projects for solving known supportability issues within Spring Boot

ZIP Bundle

By default, any executable JAR file, created by Spring Boot, contains property files and additional settings. However, in case of production deployment, it is more convenient to distribute these files outside of packaged archive. For example, this can be applied to externalized configuration property files (application.propertyapplication.yml) or logging configurations (log4j2.propertieslogback.xml).
To simplify application deployment in these cases, Jelastic supports deployment of a ZIP bundle, which may contain an executable JAR file and any additional files or directories.

While unpacking a ZIP bundle, Jelastic processes all the included folders to detect the runnable JAR. To be considered as an execution point, a JAR file should contain the Main-Class declaration inside its META-INF/MANIFEST.MF manifest file. Once such JAR file is located, Jelastic will run JVM with “java –jar /path/to/jar” parameters inside the directory that corresponds to the root folder of the deployed archive.


Below is a sample directory structure of a ZIP bundle that can be used for deployment into Jelastic Cloud.

|    +-application.properties
|    +-log4j.properties
|    +-my-springboot-app.jar
|    +-additional_file1
|    +-additional_file2

If deploying such archive, Jelastic will run JVM with the “java -jar lib/my-springboot-app.jar” arguments from a directory that corresponds to the root folder of the unpacked  application.zip archive.

Application Deployment

Jelastic provides versatile possibilities for your application deployment into the Cloud, allowing to choose the most preferable one.

  • Manual Deployment

The most evident and comfortable approach is to perform this manually through the convenient Jelastic GUI.

As an example, give a try to a sample Spring Boot project, which represents a simple application to store the messages you create – you can either build it from the sources or deploy the already built JAR.

For that, Upload archive with your app via Deployment Manager and initiate its deployment by selecting the destination environment (the previously created spring-boot-app in our case).

spring boot java heap size

In the opened dialog, confirm Deploy with the same-named button and wait till the corresponding task is finished.

Note: Support of WAR archives deployment through dashboard’s Deployment Manager is provided starting from Jelastic 5.0.6. For preceding platform versions, this operation can be accomplished via Jelastic API or Cloud Scripting.
  • Remote Deploy via CLI

Alternatively, you can leverage Jelastic CLI to deploy your application to a target Spring Boot environment remotely with the following command:

~/jelastic/environment/control/deployapp –envName spring-boot-app –fileUrl http://link/to/archive –fileName my_springboot.jar –context ROOT

Checking Logs

When the deployment is finished, give the system some more time to run the required services (where delay directly depends on your project complexity) – the current progress of this operation can be tracked in real time via the springboot.log server log.

spring boot logs

After completion, your application web interface (if such is run on the default :8080 port) can be accessed identically you’ve done this for preinstalled Hello World – by clicking Open in browser for your environment.

Ways to Build a Spring Boot Application

To create an appropriate archive file for your application hosting inside Jelastic Cloud, either Gradle or Maven build tools can be used.

  • The minimal base for Gradle build script (build.gradle) is listed below, where parameters in curly braces should be substitutes with your custom values:
buildscript {
  ext {
     springBootVersion = '{X.X.X.RELEASE}'
  repositories {
  dependencies {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
sourceCompatibility = 1.8
targetCompatibility = 1.8
jar {
  baseName = '{your_app_name}'
  version =  '{your_app_version}'
repositories {
dependencies {
task wrapper(type: Wrapper) {
  gradleVersion = '{used_gradle_version}'

To build an executable JAR file with this script, use the following command:
./gradlew clean assemble
The generated archive will be stored upon the ..build/libs/{app_name}-{app-version}.jar path.

  • The minimal base for pom.xml Maven project description includes the following parameters (where parameters in curly braces should be substitutes with your custom values):
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <!-- Compile -->

To produce an executable JAR with Maven, execute the following command:
mvn clean package
Your app archive will be placed at the …target/{app_name}-{app-version}.jar location

Jelastic Maven Plugin

As more convenient joint build & deployment option, consider Jelastic Maven plugin, which is aimed to facilitate your application delivery to the Cloud. Integrate it within your Maven project’s pom.xml configuration file and get the ability to build application archive and instantly push it to a target environment with a single command.

CI/CD Tools for Java Applications in the Cloud

Dedicated Maven Build Node in the Cloud

In case you do prefer working via GUI, leverage dedicated Maven build node the Jelastic Platform provides out-of-box. Being included to an environment alongside with Java application server, it can be used to fetch, compile and deploy application from its sources within a specified remote GIT/SVN repository.

CI/CD Automation Add-On

In addition to all the above-mentioned options, Jelastic offers a special Git-Push-Deploy add-on for continuous application deployment from GitHub & GitLab repositories via the automatically integrated CI/CD pipeline. It can be especially useful in case your project is under intensive development yet, which implies lots of repetitive commits. With this solution, your application will be automatically rebuilt and delivered to a target server upon any change is made within its code, making the newest version available via the corresponding domain in a matter of minutes.

Maintaining Your Spring Boot Server

The majority of basic server management operations can be performed right via Jelastic Cloud UI with the appropriate embedded tools, e.g.:

spring boot management ui
spring boot java options arguments
spring boot java options arguments
  • explore server Logs to get the details on run operations for efficient service administration and troubleshooting
  • track the Statistics on consumed resources to be aware of the capacities your server actually needs and define the best approach for their allocation

For more complex maintenance operations, the Jelastic SSH Gate can be used. It allows to manage your containers remotely with a full root access provided. For that, you just need to connect to your account with the previously generated SSH key pair. And the following tips can come in handy when working with your Spring Boot server:

  • your application files can be located in the /opt/shared/apps/APP directory, which is considered as “current” or “working” for Java process
  • Java Virtual Machine (JVM) configuration parameters can be customized within the /opt/shared/conf/variables.conf file (e.g. to enable remote debugging or pass any additional arguments to JVM)
  • to inspect log files, refer to the /opt/repo/logs directory
  • the /opt/shared/home location is considered as a home directory
  • JDK is located in the /usr/java/default directory
  • to restart your application, execute the sudo service cartridge restart command

In particular, ability to operate server via console can be especially useful when handling a non-web Spring Boot applications.

Automatic Scaling for Spring Boot Server

Jelastic Platform provides a real-time elastic scalability that is available out-of-the-box for any server. By enabling both automatic vertical and horizontal scaling, you can make your Spring Boot application fully adaptable to changeable workloads.

Automatic Vertical Scaling

The automatic vertical scaling is enabled by default and ensures your service remains available during the load spikes, and at the same time, eliminates the need to pay for unused resources. Just decide on maximum limit of resources (set with cloudlets) your application may consume and Jelastic will automatically adjust the maximum memory size (-Xmx) for you application based on these capacities, for example:

  • 8 cloudlets (1GiB RAM) set the maximum heap size to 819 MB
  • 16 cloudlets (2GiB RAM) set the maximum heap size to 1638 MB

To customize -Xmx or any other JVM options, edit the /opt/shared/conf/variables.conf file either via Configuration Manager or Jelastic SSH Gate.

Automatic Horizontal Scaling

The automatic horizontal scaling functionality allows to adjust the number of web and application servers according to the resources consumption of your application. It is implemented by means of the tunable monitoring triggers that are based on the usage of a particular resource type:

  • CPU
  • Memory (RAM)
  • Network
  • Disk I/O
  • Disk IOPS
spring boot application scaling
Note: When a server is scaled out (both with a trigger or manually), an NGINX load balancer will be automatically added to your environment, with pre-configurations for sticky session load balancing. Alternatively, you can switch the used balancer stack to Apache-LB, HAProxy or Varnish with the Change Environment Topology option.

Traffic Encryption with SSL

If your project requires some complex configurations for requests handling, like HTTPS and load balancing, feel free to leverage the following security options:

spring boot ssl configuration
  • as a free-of-charge SSL alternative, applicable for both internal and custom domains, a special Jelastic-developed Let’s Encrypt add-on can be used

Applying any of these solutions to the Load Balancer node will enable traffic encryption on environment level, eliminating the necessity to configure it inside your application. As a result, the received encrypted traffic will be terminated at the load balancing layer and proxied further to application server in a plain view.

Custom Ports & HTTP/HTTPS Usage Considerations

By default, the majority of Java applications listen to port 8080 on HTTP level, thus it is considered as the standard Spring Boot endpoint for HTTP traffic.

Herewith, when your environment link is requested over the Internet, the ports are automatically mapped as follows:

  • internal HTTP port 8080 refers to the port 80
  • secure HTTPS port 8043 refers to the ports 443 and 80

Thus, if working over standard HTTP/HTTPS ports, your application can be accessed directly via environment URL with the corresponding protocol specified, with no necessity to enter the appropriate port number.
And if your application does need to process the requests on some custom interface, Jelastic allows to expose private container TCP and UDP ports via Endpoints. After adding such, the corresponding port will be automatically enabled in server firewall settings, making it accessible for the rest of world.


Find out more possibilities of the Spring Boot server by trying it out within Jelastic. Create your own account and easily deploy a scalable Java application to run it in the cloud.

Need some details or assistance? Feel free to ask for help within the comments below or get in touch with our technical experts at Stackoverflow.