Menu

Tuesday, 2 October 2007

In production I use Apache2 in front of Tomcat. The configuration for this is quite simple and standard. However, while developing Grails applications I wanted to run the same configuration, so that there are very few differences between my development and production environments. In Apache, I use named virtual hosts to forward to Tomcat, and Tomcat is configured with web applications corresponding to the virtual host name, with just '/' as the context path.

Grails uses Jetty, and when running 'grails run-app' a Jetty container is configured and started. This is fine for me, I don't think I really need to switch to Tomcat in development, but running Apache2 in front of it would be very nice. This way I don't need to worry about differences in URLs.

I'm not familiar with Jetty at all, so the simplest and fastest way to get this working was to make a copy of the RunApp.groovy script that comes with Grails and change it so that it looks for the context path definition in 'application.properties' in the root of the Grails project.

Update March 7 2008:

See the comments below - I have produced a better implementation:

- appContext is now defined in Init.groovy so it is available to all scripts- RunApp.groovy and RunWar.groovy use the appContext to configure the server and display the url.- RunAppHttps.groovy reuses RunApp.groovy so the only change here is for displaying the url.

Depositphotos

Get royalty-free images, photos, vectors, illustrations and videos from the best microstock - Depositphotos.

vsConsole

vsConsole is a tool for developers and testers which lets you easily tail log files on remote servers, monitor the status and version of applications deployed to your environments, and stay informed with broadcast messaging.
Learn more

SSD Cloud Servers‎

Built For Developers. Deploy An SSD Cloud Server In 55 Seconds.
Digital Ocean