webapp-runner usage guide

webapp-runner can launch applications using Tomcat on any system with a JRE environment installed.Using webapp-runner does not require Tomcat to be installed.It’s just a jar file that can be run and configured withjavacommands.Rainbond runs a War package, or Maven packages a project into a War package by default using webapp-runner.

Imprint

Webapp Runner is based on Tomcat server.The default versions supported by Rainbond are as follows:

web service supportweb service versionCustomize the jar file name in the Procfile
tomcat7webapp-runner-7.0.91.0.jarwebapp-runner.jar
tomcat8webapp-runner-8.0.52.0.jarwebapp-runner.jar
tomcat85 (default)webapp-runner-8.5.38.0.jarwebapp-runner.jar
tomcat9webapp-runner-9.0.16.0.jarwebapp-runner.jar
jetty7jetty-runner-7.5.4.v20111024.jarjetty-runner.jar
jetty9jetty-runner-9.4.0.v20161208.jarjetty-runner.jar

Advanced feature configuration

Currently, the Webapp-runner provided by Rainbond supports session management.

session management

  1. # Procfile
  2. $ java -jar ./webapp-runner.jar --session-store memcache target/<appname>.war

Then make sure there are three environment variables to configure MEMCACHE_SERVERS, MEMCACHE_USERNAME, MEMCACHE_PASSWORD

or

  1. # Procfile
  2. java -jar ./webapp-runner.jar --session-store redis target/<appname>.war

Then make sure the Redis environment variable is available to configure:REDIS_URL

set access path

  1. # Procfile
  2. java -jar ./webapp-runner.jar --path /phone target/<appname>.war

More parameter configuration

  1. $ java -jar webapp-runner.jar --help
  2. The specified path "src/main/webapp" does not exist.
  3. Usage: <main class> [options]
  4. Options:
  5. --access-log
  6. Enables AccessLogValue to STDOUT
  7. Default: false
  8. --access-log-pattern
  9. If --access-log is enabled, sets the logging pattern
  10. Default: common
  11. --basic-auth-pw
  12. Password to be used with basic auth. Defaults to BASIC_AUTH_PW env
  13. variable.
  14. --basic-auth-user
  15. Username to be used with basic auth. Defaults to BASIC_AUTH_USER env
  16. variable.
  17. --bind-on-init
  18. Controls when the socket used by the connector is bound. By default it is
  19. bound when the connector is initiated and unbound when the connector is
  20. destroyed., default value: true
  21. Default: true
  22. --compressable-mime-types
  23. Comma delimited list of mime types that will be compressed when using
  24. GZIP compression.
  25. Default: text/html,text/xml,text/plain,text/css,application/json,application/xml,text/javascript,application/javascript
  26. --context-xml
  27. The path to the context xml to use.
  28. --enable-basic-auth
  29. Secure the app with basic auth. Use with --basic-auth-user and
  30. --basic-auth-pw or --tomcat-users-location
  31. Default: false
  32. --enable-client-auth
  33. Specify -Djavax.net.ssl.keyStore and -Djavax.net.ssl.keyStorePassword in
  34. JAVA_OPTS
  35. Default: false
  36. --enable-compression
  37. Enable GZIP compression on responses
  38. Default: false
  39. --enable-naming
  40. Enables JNDI naming
  41. Default: false
  42. --enable-ssl
  43. Specify -Djavax.net.ssl.keyStore, -Djavax.net.ssl.keyStorePassword,
  44. -Djavax.net.ssl.trustStore and -Djavax.net.ssl.trustStorePassword in JAVA_OPTS. Note: should not be
  45. used if a reverse proxy is terminating SSL for you (such as on Heroku)
  46. Default: false
  47. --expand-war-file
  48. Expand the war file and set it as source
  49. Default: true
  50. --expanded-dir-name
  51. The name of the directory the WAR file will be expanded into.
  52. Default: expanded
  53. --help
  54. Default: false
  55. --max-threads
  56. Set the maximum number of worker threads
  57. Default: 0
  58. --path
  59. The context path
  60. Default: <empty string>
  61. --port
  62. The port that the server will accept http requests on.
  63. Default: 8080
  64. --proxy-base-url
  65. Set proxy URL if tomcat is running behind reverse proxy
  66. Default: <empty string>
  67. --scanBootstrapClassPath
  68. Set jar scanner scan bootstrap classpath.
  69. Default: false
  70. --session-store
  71. Session store to use (valid options are 'memcache' or 'redis')
  72. --session-store-ignore-pattern
  73. Request pattern to not track sessions for. Valid only with memcache
  74. session store. (default is '.*\.(png|gif|jpg|css|js)$'. Has no effect
  75. for 'redis')
  76. Default: .*\.(png|gif|jpg|css|js)$
  77. --session-store-locking-mode
  78. Session locking mode for use with memcache session store. (default is
  79. all. Has no effect for 'redis')
  80. Default: all
  81. --session-store-operation-timeout
  82. Operation timeout for the memcache session store. (default is 5000ms)
  83. Default: 5000
  84. --session-store-pool-size
  85. Pool size of the session store connections (default is 10. Has no effect
  86. for 'memcache')
  87. Default: 10
  88. --session-timeout
  89. The number of minutes of inactivity before a user's session is timed
  90. out.
  91. --shutdown-override
  92. Overrides the default behavior and casues Tomcat to ignore lifecycle
  93. failure events rather than shutting down when they occur.
  94. Default: false
  95. --temp-directory
  96. Define the temp directory, default value: ./target/tomcat.PORT
  97. --tomcat-users-location
  98. Location of the tomcat-users.xml file. (relative to the location of the
  99. webapp-runner jar file)
  100. --uri-encoding
  101. Set the URI encoding to be used for the Connector.
  102. --use-body-encoding-for-uri
  103. Set if the entity body encoding should be used for the URI.
  104. Default: false
  105. -A
  106. Allows setting HTTP connector attributes. For example: -Acompression=on
  107. Syntax: -Akey=value
  108. Default: {}

For setting HTTP connection attributes, such as -Acompression=on, you can refer to Apache Attributes