Serwer Tomcat 7 and MySQL 5.5
Preparation
Install Tomcat 7
First you should install Tomcat 7 server and Tomcat Admin Module. To do so just type into console the following:
sudo apt-get install tomcat7 tomcat7-admin
Prepare icescrum
Next we will download icescrum package:
# open any download location
cd ~/Download/icescrum/
# download package
wget http://www.icescrum.org/downloads/icescrum_R5_1.2_war.zip
# unzip war package
unzip icescrum_R5_1.2_war.zip
Get MySQL connector
Finally you should download and unpack MySQL Java Connector
tar -xzf mysql-connector-java-{version}.tar.gz or unzip mysql-connector-java-{version}.zip
sudo cp mysql-connector-java-{version}-bin.jar /usr/share/tomcat7/lib
Thanks to this your icescrum app will be able to work with MySQL database.
Icescrum deployment
Server configuration
In Tomcat server configuration file (/var/lib/tomcat7/conf/server.xml) replace the following lines:
<Connector port="8080"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
by
<Connector port=”8080″
protocol=”org.apache.coyote.http11.Http11NioProtocol” connectionTimeout=”2000″
maxThreads=”500″
URIEncoding=”UTF-8″/>
User configuration
In tomcat user configuration (/var/lib/tomcat7/conf/tomcat-users.xml ) file type:
<role rolename="manager-gui"/>
<user username="admin" password="pass" roles="manager-gui"/>
This will allow you to log into Tomcat application management panel to deploy downloaded icescrum.war file.
Deploying application
In your browser go to http://localhost:8080/manager/html and using credentials from previous step log into manager panel. Then deploy icescrum.war in section ‘WAR file to deploy’
If you’ll get error saying there is not enough memory go to usr/share/tomcat7-admin/manager/WEB-INF/web.xml and modify the following section:
<multipart-config>
<max-file-size>52428800</max-file-size>
<max-request-size>52428800</max-request-size>
<file-size-threshold>0</file-size-threshold>
</multipart-config>
with greater values like 104857600 (100 mb).
Such deployed application isn’t ready to work. We should configure it.
NOTE: You may also deploy app by putting war package in /var/lib/tomcat7/webapps/ and restarting server /etc/init.d/tomcat7 restart
Environment configuration
MySQL
On MySQL create new user and database:
CREATE DATABASE IF NOT EXISTS icescrum; GRANT ALL PRIVILEGES ON icescrum.* TO %27icescrum%27@%27localhost%27%20IDENTIFIED" data-mce-href="mailto:%27icescrum%27@%27localhost%27%20IDENTIFIED">'icescrum'@'localhost' IDENTIFIED BY "pass";
exit;
Work folder
Create new folder /home/icescrum, which will be used to store attachments and give owner permissions to that folder to user tomcat7 (created automatically while installing Tomcat)
Also create /etc/icescrum folder to keep configuration file there
chown tomcat7:tomcat7 -R /home/icescrum/
usermod -d /home/icescrum tomcat7
Permissions
Next you should grant all permissions to iscescrum app on Tomcat Server in filr /etc/tomcat7/policy.d/50local.policy adding the following lines at the end:
grant codeBase "file:${catalina.base}/webapps/icescrum/-" {
permission java.security.AllPermission;
};
Application requires more memory than it is avalible by default JVM settings, thats why we should export new settings at server startup. To do so we will modify script starting server. At the begining of /usr/share/tomcat7/bin/catalina.sh insert:
JAVA_OPTS="-Djava.awt.headless=true -XX:MaxPermSize=1024m -Xmx1024m -Dicescrum_config_location=/etc/icescrum/icescrum_config.properties"
Line with -Dicescrum_config_location defines where server should look for the icescrum configuration. We will talk about this file later.
App configuration
Default icescrum configuration file id located in webapps/icescrum/WEB-INF/classes/config.properties. It’s convenient to put this file somewhere else:
cp /var/lib/tomcat7/webapps/icescrum/WEB-INF/classes/config.properties /etc/icescrum/icescrum_config.properties
We replace the following properties in the newly created file:
#Data Source
dataSource.driverClassName=com.mysql.jdbc.Driver
dataSource.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
dataSource.url=jdbc:mysql://localhost:3306/icescrum?useUnicode=true&characterEncoding=utf8&autoReconnect=true
dataSource.username=icescrum
dataSource.password=pass
dataSource.dbCreate=update
#Use pool connection
dataSource.pooled=true
dataSource.properties.maxActive = 50
dataSource.properties.maxIdle = 25
dataSource.properties.minIdle = 1
dataSource.properties.initialSize = 1
dataSource.properties.minEvictableIdleTimeMillis = 1800000
dataSource.properties.timeBetweenEvictionRunsMillis = 1800000
dataSource.properties.numTestsPerEvictionRun = 3
dataSource.properties.maxWait = 10000
dataSource.properties.testOnBorrow = true
dataSource.properties.testWhileIdle = true
dataSource.properties.testOnReturn = false
dataSource.properties.validationQuery = "SELECT 1"
#serverURL Absolute link required with context name like : http://localhost:8080/icescrum
grails.serverURL=http://localhost:8080/icescrum
If you’re using older MySQL version you may replace
dataSource.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
with
dataSource.dialect=org.hibernate.dialect.MySQLInnoDBDialect
and to enable debugging type
icescrum.debug.enable = true
Start working
Now you can restart Tomcat server:
/etc/init.d/tomcat7 restart
and start working with application under http://localhost:8080/icescrum/ . If you have any problem try to check gedit /var/log/tomcat7/catalina.out log file (be sure that you’ve enabled debuging). To log in register or use default admin account:
login: admin
password: adminadmin!