Java is one of the programming language runtimes supported by Toolforge's
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.
- 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. play.crypto.secret="changeme" # Port # ~~~~~ # On WMF Toolforge, the port used by kubernetes webservice is 8000/TCP http.port=8000 # HTTP context # ~~~~~ # Your tool will be available at https://$TOOLNAME.toolforge.org/. # Play usually expects to be operating at the root of a domain, so this setting is # required for routes to work properly. play.http.context="/"
- The application secret can be stored in a private file with 440 permissions.
- Build the project.
- 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:
- Setup Tomcat by running
setup-tomcat. This will create a local Tomcat installation at
- To deploy the WAR, move it to
$TOOLis the name of your tool. Archive extraction, deployment, and configuration is done automatically by Tomcat.
- If necessary, restart Tomcat.
- The application will be available at
- To test the Tomcat webservice, you can use the Tomcat sample application (available on tomcat.apache.org).
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
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:
- Modify your tool's JVM settings in $HOME/public_tomcat/bin/setenv.sh.
- If the memory setting from
JAVA_OPTSis too low, you'll get the well-known OutOfMemoryError from Java.
- In some cases, Tomcat may not stop following an OOM error. Killing the grid engine job using
qdelmay 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: