(Quick Reference)

22.1 Standalone - Reference Documentation

Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari

Version: 3.1.4

22.1 Standalone

"grails run-app"

You should be very familiar with this approach by now, since it is the most common method of running an application during the development phase. An embedded Tomcat server is launched that loads the web application from the development sources, thus allowing it to pick up any changes to application files.

You can also deploy to production this way using:

grails prod run-app

Runnable WAR or JAR file

Another way to deploy in Grails 3.0 or above is to use the new support for runnable JAR or WAR files. To create runnable archives, run grails package:

grails package

You can then run either the WAR file or the JAR using your Java installation:

java -Dgrails.env=prod -jar build/libs/mywar-0.1.war    (or .jar)

A TAR/ZIP distribution

The package will also produce a TAR and a ZIP file in the build/distributions directory. If you extract these archives (typically the TAR on Unix systems and the ZIP on Windows) you can then run bash file which is the name of your application located in the bin directory.

For example:

$ grails create-app helloworld
$ cd helloworld
$ grails package
$ tar -xvf build/distributions/helloworld-0.1.tar
$ export HELLOWORLD_OPTS=-Dgrails.env=prod
$ helloworld-0.1/bin/helloworld
Grails application running at http://localhost:8080

Note: TAR/ZIP distribution assembly has been removed from Grails 3.1.