Configuring WAR Deployment with the Heroku CLI
Last updated 19 May 2017
Table of Contents
The Heroku-Deploy CLI Plugin, which deploys a locally generated WAR file to Heroku, can be configured for various execution scenarios. The most commonly used are described here.
You can include additional files in your slug with the
--includes option. For example:
$ heroku war:deploy myapp.war --includes newrelic.jar:newrelic.xml
The character separating the included files is platform specific, just like File.pathSeparator. On Windows it will be
; (semi-colon) and on Mac and Linux it will be
Setting the Tomcat version
You can override the default Tomcat Webapp Runner version using the
--webapp-runner option. For example:
$ heroku war:deploy myapp.war --webapp-runner 22.214.171.124
A list of available Tomcat Webapp Runner versions are available on Maven Central.
Configuring Tomcat options
You can configure how the WAR file executes on the server by setting the WEBAPP_RUNNER_OPTS configuration variable on your application. For example, you might set the following option:
$ heroku config:set WEBAPP_RUNNER_OPTS="--uri-encoding=UTF-8"
The heroku-deploy plugin uses Tomcat Webapp Runner as a container for the WAR file. Thus, all Webapp Runner options are available to the app. A full list options is described in the Webapp Runner documentation.
Configuring Java options
You can also configure the underlying JVM that runs the Tomcat container by
JAVA_OPTS configuration variable. For example, you might set the
following option to configure thread stack size:
$ heroku config:set JAVA_OPTS="-Xss512k"
However, the Heroku platform will select a good set of defaults for you.
For more information, see WAR Deployment.