Spring Boot Hosting

Togglebox is partnering with Jelastic to provide Spring Boot Hosting and Spring Boot server for standalone and clustered applications or microservices.

With the Spring Boot stack template, you can run various Java-based applications inside the cloud via easy-to-use graphic interface or automation scripts.

These Java project types can be hosted:

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

Spring Boot enables you to keep things portable, ensuring quick delivery of applications to production and their comprehensive management via GUI, API, or Cloud Scripting.

Creation of Spring Boot Environment

  1. Log in to your Togglebox Cloud dashboard to get started.
  2. Create a New Environment – use the same-named button to launch topology wizard.
  3. Switch to the Java language tab
  4. Choose the Spring Boot template within the application server layer at the left-hand panel as shown below.
  5. Set the amount of allocated resources, type your environment name and click Create to proceed.
spring boot application cloud hosting

Click Open in Browser to launch the pre-installed Hello World application sample to ensure it is up and running.

spring boot open in browser
spring boot default site

Deploying Java Applications to Spring Boot

To launch your Spring Boot project pack it into an executable archive with all the appropriate compiled classes and associated resources.

These 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 an all-in “fat” JAR or nested JAR file
  • WAR – for the 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

Any executable JAR file contains property files and additional settings.

In production deployment, it is more convenient to distribute these files outside of the 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, use the ZIP bundle, which may contain an executable JAR file and any additional files or directories.

While unpacking a ZIP bundle, Togglebox processes all the included folders to detect the runnable JAR.

A JAR file should contain the Main-Class declaration inside its META-INF/MANIFEST.MF manifest file.

Once the JAR file is located, we can run JVM with “java –jar /path/to/jar” parameters inside the directory that corresponds to the root folder of the deployed archive.





|    +-application.properties

|    +-log4j.properties


|    +-my-springboot-app.jar


|    +-additional_file1

|    +-additional_file2



If deploying such an archive, Togglebox 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

  • Manual Deployment

Perform this manually through Togglebox GUI.

You can either build it from the sources or deploy the already built JAR.
  1. Upload archive with your app via Deployment Manager and
  2.  Click the Deploy to button.
spring boot deploy application

3. Select the destination environment (the previously created spring-boot-app in our case)

4. Confirm Deploy with the same-named button. Wait till the corresponding task is finished.

  • Remote Deploy via CLI

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 run.log server log.

spring boot logs

After completion, your application web interface (if such is run on the default 8080 port).


This 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

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

The Maven plugin is aimed to facilitate your application delivery to the Cloud.

Integrate it within your Maven project’s pom.xml configuration file, build an 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

You can leverage a dedicated Maven build node  out-of-box.

It can be used to fetch, compile, and deploy applications from the sources within a specified remote GIT/SVN repository.

CI/CD Automation Add-On

Use the Git-Push-Deploy add-on for continuous application deployment from GitHub & GitLab repositories via the automatically integrated CI/CD pipeline.

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

spring boot file manager
spring boot variables
  • 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, you can connect to your Spring Boot container via SSH (either using the web or local SSH client). The following tips can come in handy when working with your Spring Boot server:

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

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

Automatic Scaling for Spring Boot Server

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.

It eliminates the need to pay for unused resources. Just decide on maximum limit of resources (set with cloudlets) your application may consume and Togglebox 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 /home/jelastic/conf/variables.conf file either via Configuration Manager or Jelastic SSH Gate.

Automatic Horizontal Scaling

The automatic horizontal scaling functionality allows adjusting 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, HAProxy, Varnish, or LiteSpeed ADC.

All the newly added nodes will be created at different hardware servers to ensure high-availability for your application.

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
  • custom SSL can be configured for the Spring Boot based environment by adding any of the certified load balancers
  • as a free-of-charge SSL alternative, applicable for both internal and custom domains, the Let’s Encrypt add-on can be used (certified load balancer is required)

Applying any of these solutions will enable traffic encryption on the 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 the 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 8743 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, this allows exposing private container TCP and UDP ports via Endpoints.

After adding, the corresponding port will be automatically enabled in server firewall settings, making it accessible for the rest of the world.