The Art of .WAR

Published on April 04, 2017

Java developers can rejoice today! We are releasing a new way to deploy web applications packaged as .WAR archives, as simple as the one-liner “scalingo deploy project.war”. Build them with your continuous integration solution or directly on your workstation and deploy them directly to Scalingo. Releasing a WAR has never been so easy and fast.

So far our only method to start an application deployment was to use git push or the GitHub integration provided by the platform. In both cases the deployment is working the same way: the language is detected, dependencies are installed and potentially, the code is compiled. In some ecosystem, this method is not always the best one. That’s why we’re proposing today to the Java developers to deploy their WAR archives directly.

Direct WAR archive deployment

WAR (Web application ARchive) are special zip archives containing a built java project with its dependencies required to run a webservice over an application server like Tomcat. They are designed to be distributed directly to hosting platforms as a standalone package to run a web application.

Once the developer or the continuous integration platform has generated this file, there is no need to compile the source code again, it is already ready to run. To avoid doing this unnecessary step and to fasten the deployment of java applications producing WAR files, we’re introducing a new command in our Command Line Interface.

Usage

$ scalingo deploy project.war
-----> Deploying WAR archive 'project.war'
-----> Uploading archive…
       Deployment started, streaming output:

<-- Start deployment of sample-java-war -->
-----> Installing OpenJDK 1.8... done
 Build complete, shipping your container...
 Waiting for your application to boot...
<-- https://sample-java-war.scalingo.io -->

Designed over our API

The feature has been designed thanks to our Developers API, That means there is no magic, our CLI is open source and you can integrate this kind of feature pretty easily in your own tools and scripts.

Configuration

You may want to customize the version of the JVM deployed with your WAR or the version of webapp-runner (including Tomcat).

JVM version selection

The Java version you’re using can be defined in the JAVA_VERSION environment variable:

# Install Java 9
scalingo env-set JAVA_VERSION=1.9

If nothing is defined, Java 8 will be installed alongside your .WAR.

Webapp Runner / Tomcat version selection

By default, Tomcat 8.5 is installed with the last version of the webapp-runner, if you want to use another version, you can defined the environment variable WEBAPP_RUNNER_VERSION. You can find all the available versions here.

The 8.0.x versions are installing Tomcat 8, and the 8.5.x releases are installing Tomcat 8.5:

# Install Tomcat 8
scalingo env-set WEBAPP_RUNNER_VERSION=8.0.39.0

Future

While WAR archives are now directly deployable, you can still deploy your Java/Scala/Play app by pushing your code and using Maven or Gradle. If you are used to deploy self-sufficient JAR archives while using Spring Boot or Jetty, the feature is also coming, stay tuned.

Subscribe to our newsletter

We will send you emails only once to twice per month.
Actually we won’t spam you and keep your personal data secure.