Version 6, last updated by Diego Medina at 11 May 21:54 UTC

When your Lift application runs it does so with a specific “run mode”. A run mode can be used to change the behaviour of your application in different environments, e.g., development v. production.

There are six run modes:

  • development
  • test
  • staging
  • production
  • pilot
  • profile

The default run mode is development.

This wiki article outlines the differences between the different run modes, and shows how to set and use the run mode.

Setting the run mode

The run mode is controlled via the run.mode system property, and so can be set via a JVM parameter: -Drun.mode=production (for example)

Accessing the run mode

Props.mode returns RunMode enumeration value

You can use this value if you need to change the behaviour of your application in different run modes, e.g.,:

Props.mode match {
  case Props.RunModes.Test => // do what you need to do in test mode 
  case _ => otherwise...                                        
}

Differences between run modes

The run mode can be used to select a properties file (e.g., for logging control). See Logging for an example.

The following sections details the differences between run modes.

Development

  • Snippet errors are shown in the browser
  • Syntax errors in CSS selector definition are shown in the rendered page.
  • Requests for pages that should be in the sitemap give a resulting page of: “The requested page was not defined in your SiteMap, so access was blocked.”
  • Comments are retained in XHTML (comments are stripped out in other run modes, and always for HTML5)
  • Non-minified version of JavaScript libraries (e.g., JQuery) are served
  • The default exception handler includes a stack trace in the error page.
  • Sitemap can be changed without restarting the app server (see Simply Lift section 3.2.1).
  • You can have two or more instances of the same comet actor, rendering different pats of a page, and it works fine, but on production and test mode, you will see the html of one instance on both comet instances, see this thread

Production deployments

Production, Staging and Pilot are all considered to be production-level deployments, and as such have similar differences:

  • Templates are cached in memory

Test

  • The Mailer logs the message, rather than sending it (since 2.0-M5)
  • Syntax errors in CSS selector definition are shown in the rendered page.

Profile