0
votes

I am pretty new to grails. I have a pre existing application I want to run. The application builds and runs correctly but I am unable to figure out the server it is using - whether the default VMware or Tomcat instance

I included the tomcat plugin in my BuildConfig.groovy as shown below

build ':tomcat:7.0.52.1'

I am assuming that the application is infact running on a tomcat server but I know no way of confirming it. On the servers tab of my GGTS, I see only a VMware instance but no Tomcat instance. Is this normal?

I also tried to check the logs while the application is deployed by changing the log level to verbose in the BuildConfig.groovy, but that too doesnt give me enough information to get the answer which is where my search ended.

For those interested, my main aim is to configure SSL certificate on tomcat if it already isnt done. Any help regarding this is very much appreciated.

2

2 Answers

2
votes

It's possible to deploy a Grails WAR file to a GGTS-managed server, but I've never done it. I'm sure it's easy to do, but I've never needed to. That makes a lot more sense in a framework that doesn't ship with an embedded (but complete) instance of Tomcat, and additionally the option to swap that out with a 1-line config change for a complete, embedded instance of Jetty: http://grails.org/plugin/jetty

When you run the app from within GGTS using the "Run As | Grails Command (run-app)" you're doing exactly the same thing as if you had run grails run-app from the commandline. All GGTS does to run the app, or tests, and even the generate- and create- scripts is call the same script you would, but in a separate VM so it's isolated, and it captures and displays stdout and stderr within the IDE. So it's very unlikely you're using tc Server (VMware is the company (or was, it's Pivotal now), vFabric is the platform, and tc Server is the beefed-up version of Tomcat that they sell licences and support for). If you want to be completely sure, go to the Spring dashboard and uninstall tc Server, unless you plan on deploying to it in the future and want to test that locally.

Another quick test is (assuming you don't have a custom 404 page) is to request a url for the correct host, port, and context, but for a nonexistent page or controller in your app. The 404 page should say Tomcat, but the tc Server page should say "tc Server", something similar to this: enter image description here

So if your app name is "foo", request

http://localhost:8080/foo/whereAreWeRunningFrom?

or something similar.

Also, if GGTS deployed to tc Server (or even Tomcat, but it's own managed Tomcat, not the embedded Tomcat inside Grails that it can't configure or access), it would do that by creating a WAR file and deploying it, and it would use the production environment. So reloading would be disabled. If you can change a controller, service, taglib, i18n file, GSP, etc. and the change takes effect, you're using the Grails-configured Tomcat. This uses an "exploded WAR" style of deployment, where it tells Tomcat that your project directory is an unzipped WAR file, and it configures the css and js dirs, the images dir, WEB-INF, etc. to point to your project folders unstead of a real unpacked WAR file.

You can run with SSL locally by using the -https flag, see http://grails.org/doc/latest/ref/Command%20Line/run-app.html - Grails will create a self-signed cert for you the first time, and you can continue using that, or use an approach like what's described here to replace it: http://grails.1312388.n4.nabble.com/Specifying-the-SSL-certificate-in-Grails-2-x-td4629128.html

0
votes

The grails run-app command creates an embedded servlet container, using Tomcat by default. So you're using the Tomcat from the grails plugin, not the vFabric server that came with GGTS.

If you use grails run-app -https a self-signed certificate will be generated for you.

Of course when you deploy a WAR file to a production server you will have to have a SSL cert added there.