Version 10 (modified by tsteemers@…, 3 years ago)


Setting up a dedicated server

In this guide we will assume you use Linux as a hosting platform. While you will be able to run GSCF on Windows, using Linux is preferable. This guide is written with  Debian GNU/Linux (or Ubuntu) as a hosting platform. As Linux distributions differ other distributions may require minor changes in setup, but following this guide you should be able to get things running on other distributions as well.


The tutorial is based on a number of assumptions:

  • you have root access to the server
  • we will set up a gscf test instance on on IP (
  • a DNS records is available for
  • our database will be named 'mytestdb' with username 'mydbuser' and password 'mydbpassword'
  • we will have one administrator user (user 'admin', password 'adminpw')
  • we will have one default user (user 'user', password 'userpw')


Before we can set up the server, the following requirements should be met:

  • Apache Tomcat ≥ 6.x.x
  • Apache Webserver ≥ 2.x (+mod_proxy, +mod_rewrite)
  • PostgreSQL database server ≥ 8.4

Installation is quick and easy:

apt-get install tomcat6 postgresql-8.4 apache2 libapache2-mod-proxy-html libapache2-mod-jk

Set Up the Database

su to user postgres and create the database:

Note: you may have to use double quotes (") rather than single quotes (').

root@nmcdsp:~# su - postgres
postgres@nmcdsp:~$ psql
Welcome to psql 8.3.14, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

postgres=# create database 'mytestdb';
postgres=# create user mydbuser password 'mydbpassword';
postgres=# grant all privileges on database mytestdb to mydbuser;
postgres=# grant all privileges on database mytestdb to mydbuser;
postgres=# alter database mytestdb owner to mydbuser;
postgres=# \l
           List of databases
    Name     |     Owner     | Encoding 
 mytestdb    | mydbuser      | UTF8
 postgres    | postgres      | UTF8
 template0   | postgres      | UTF8
 template1   | postgres      | UTF8
(16 rows)

postgres=# \q
postgres@nmcdsp:~$ exit

Set up the application configuration

Currently this is a manual step, but in the future the application will contain a getting started wizard which will do this for you (see #185).

GSCF supports externalized configuration which it expects to be in a .grails-config folder on the homedir of the tomcat user. In this case the homedir of the tomcat6 user is /usr/share/tomcat6/.grails-config so it will try to load the configuration file /usr/share/tomcat6/.grails-config/

First, create the folder to hold the configuration file(s), touch an empty configuration file and change the ownership:

root@nmcdsp:~# cd /usr/share/tomcat6
root@nmcdsp:/usr/share/tomcat6# mkdir .grails-config;touch .grails-config/;chown -R tomcat6.tomcat6 .grails-config;chmod -R gou+rx .grails-config

Then edit the configuration file itself:

root@nmcdsp:/usr/share/tomcat6# nano .grails-config/

And paste the following configuration:

# Test build default configuration
# Revision Information:
# $Author$
# $Date$
# $Rev$

# server URL


# use authenticated smtp (make sure your firewall allows
# outbound connections on port 465), or
#  - comment username and password to use non-authenticated
#    mail (on port 25)
#  - comment out all to use local mailer (e.g. postfix /
#    sendmail on port 25)

# SpringSecurity E-Mail Settings

# module configuration

# Number of seconds to keep rest results from modules in cache
modules.cacheDuration = 600

# default application users

Press CTRL-X to save the file (and enter Y).

Create a .grails directory

Grails uses a cache folder, which should be created if the tomcat user cannot create it

root@nmcdsp:~# mkdir -p /usr/share/tomcat6/.grails;chown tomcat6.tomcat6 /usr/share/tomcat6/.grails;chmod -R gou+rwx /usr/share/tomcat6/.grails

Install GSCF

Download and install the latest WAR from (make sure to replace the URL and WAR names with the most recent versions).

root@nmcdsp:~# curl "" > /tmp/gscf-0.6.6-nmcdsptest.war
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 47.8M  100 47.8M    0     0  6075k      0  0:00:08  0:00:08 --:--:-- 6602k
root@nmcdsp:~# cd /var/lib/tomcat6/webapps/
root@nmcdsp:/var/lib/tomcat6/webapps# cp /tmp/gscf-0.6.6-nmcdsptest.war .;chown tomcat6.tomcat6 *.war;chmod gou+rx *.war


You should now be able to start tomcat and run the GSCF application:

root@nmcdsp:~# /etc/init.d/tomcat6 start
Starting Tomcat servlet engine: tomcat6.

And check if it is running properly:

root@nmcdsp:~# lynx localhost http://localhost:8080/gscf-0.6.6-nmcdsptest

Set Up Apache to proxy / rewrite request

As tomcat is running (by default) on 8080, it is not very professional to have your application run on Instead is preferable. Also it is convenient to be able to add load balancing functionality in case you expect high load. Apache can solve these issues.

First, make sure Apache loads all modules we require:

root@nmcdsp:~# cd /etc/apache2/mods-enabled/
root@nmcdsp:/etc/apache2/mods-enabled# ln -s ../mods-available/proxy* .
root@nmcdsp:/etc/apache2/mods-enabled# ln -s ../mods-available/rewrite.load .

Then create a new virtual host configuration for and edit it:

root@nmcdsp:/etc/apache2/mods-enabled# cd /etc/apache2/sites-available/
root@nmcdsp:/etc/apache2/sites-available# nano mysite.com_gscf-test.conf

Paste the following content into the virtual host configuration:

# Apache Virtual Host for GSCF Test Build
# Author	Jeroen Wesbeek <J****n.W******>
# Since		20100825
# Revision Information:
# $Author$
# $Date$
# $Rev$
<VirtualHost *:80>

	ErrorLog /var/log/apache2/gscf-test-error.log
	CustomLog /var/log/apache2/gscf-test-access.log combined

	<IfModule mod_rewrite.c>
		RewriteEngine on

                # keep listening for the serveralias, but redirect to
                # servername instead to make sure only one user session
                # is created (tomcat will create one user session per
                # domain which may lead to two (or more) usersessions
                # depending on the number of serveraliases)
                # see gscf ticket #321
		RewriteCond %{HTTP_HOST} ^$ [NC]
		RewriteRule ^(.*)$$1 [R=301,L]

		# rewrite the /gscf-a.b.c-environment/ part of the url                
		RewriteCond %{HTTP_HOST} ^$ [NC]
		RewriteRule ^/gscf-0.6.6-nmcdsptest/(.*)$ /$1 [L,PT,NC,NE]

	<IfModule mod_proxy.c>
		<Proxy *>
			Order deny,allow
			Allow from all

		ProxyStatus On
		ProxyPass / balancer://gscf-cluster/gscf-0.6.6-nmcdsptest/ stickysession=JSESSIONID|jsessionid nofailover=On
		ProxyPassReverse / balancer://gscf-cluster/gscf-0.6.6-nmcdsptest/
		ProxyPassReverseCookiePath /gscf-0.6.6-nmcdsptest /

		<Proxy balancer://gscf-cluster>
			BalancerMember ajp://localhost:8009

and press CTRL-X (and Y) to save

Now enable this virtual host configuration:

root@nmcdsp:/etc/apache2# cd /etc/apache2/sites-enabled
root@nmcdsp:/etc/apache2/sites-enabled# ln -s ../sites-available/mysite.com_gscf-test.conf

And reload apache to use the newly created virtual host configuration:

root@nmcdsp:/etc/apache2/sites-enabled# /etc/init.d/apache2 reload


Your site should now be up and running and listening on (and server alias