From Wikitech
Jump to navigation Jump to search


Java is one of the programming language runtimes supported by Toolforge's webservice command.

Play and similar JVM-based frameworks

  • webservice --backend=kubernetes jdk11 start|stop|restart|shell BINARY

Play Framework projects (and other JVM-based projects that have one executable to start the application) can be run on Toolforge.

  1. In order to work on Toolforge, the following Play configuration changes need to be made:
    # Secret key
    # ~~~~~
    # The secret key is used to secure cryptographics functions.
    # If you deploy your application to several instances be sure to use the same key!
    # On Toolforge, we will make a startup script that specifies play.crypto.secret
    # using a command line option reading from a private file.
    # Port
    # ~~~~~
    # On WMF Toolforge, the port used by kubernetes webservice is 8000/TCP
    # HTTP context
    # ~~~~~
    # Your tool will be available at https://$
    # Play usually expects to be operating at the root of a domain, so this setting is
    # required for routes to work properly.
  2. The application secret can be stored in a private file with 440 permissions.
  3. Build the project.
  4. After building the project, start your webservice:
    webservice --backend=kubernetes jdk11 start '$EXECUTABLE -Dplay.crypto.secret="$(cat /data/project/$TOOLNAME/app_secret)"'.

For more details, see User:Sn1per/Play on Tool Labs.


  • webservice --backend=gridengine tomcat start|stop|restart

To run a JVM-based Web Application Archive (WAR) on Tomcat:

  1. Setup Tomcat by running setup-tomcat. This will create a local Tomcat installation at $HOME/public_tomcat/.
  2. To deploy the WAR, move it to $HOME/public_tomcat/webapps/$TOOL.war where $TOOL is the name of your tool. Archive extraction, deployment, and configuration is done automatically by Tomcat.
  3. If necessary, restart Tomcat.
  4. The application will be available at $
  5. To test the Tomcat webservice, you can use the Tomcat sample application (available on

When reading Tomcat tutorials, it is helpful to know that $CATALINA_HOME under our configuration is the $HOME/public_tomcat directory created by setup-tomcat. The default Tomcat classloader will read jar files such as a MySQL JDBC driver jar that are placed in $HOME/public_tomcat/lib (i.e. $CATALINA_HOME/lib).


If your Java application is more complex, the standard memory settings might not work. Common symptoms of insufficient memory include receiving the message: There is insufficient memory for the Java Runtime Environment to continue and Tomcat stopping. See Help:Toolforge/Web § Runtime memory limits for instructions on getting the runtime memory limit increased.

To resolve an insufficient memory problem:

  1. Modify your tool's JVM settings in $HOME/public_tomcat/bin/
  2. If the memory setting from JAVA_OPTS is too low, you'll get the well-known OutOfMemoryError from Java.
  3. In some cases, Tomcat may not stop following an OOM error. Killing the grid engine job using qdel may be your only solution.

Communication and support

Support and administration of the WMCS resources is provided by the Wikimedia Foundation Cloud Services team and Wikimedia Movement volunteers. Please reach out with questions and join the conversation:

Discuss and receive general support
Receive mail announcements about critical changes
Subscribe to the cloud-announce@ mailing list (all messages are also mirrored to the cloud@ list)
Track work tasks and report bugs
Use the Phabricator workboard #Cloud-Services for bug reports and feature requests about the Cloud VPS infrastructure itself
Learn about major near-term plans
Read the News wiki page
Read news and stories about Wikimedia Cloud Services
Read the Cloud Services Blog (for the broader Wikimedia movement, see the Wikimedia Technical Blog)

See also