You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by oscontrib oscontrib <os...@gmail.com> on 2011/02/02 05:42:59 UTC
Steps to build roller trunk and deploy on Tomcat/MySQL
Since my hosting provider supports Tomcat/MySQL, I got roller (from trunk)
to build a war that deploys out of the box on Tomcat. Here are the steps I
followed. I hope its useful to others. I had to tweak the pom.xml under the
weblogger-webapp directory and my pom.xml is attached. The differences are
minor and highlighted in the docs.. I checked the instructions a couple of
times and it worked for me on my Ubuntu.
Building and installing roller from trunk but customized for Tomcat/MySQL
Prerequisites : Make sure you have java JDK (I use 1.6) and maven
installed on your box.
1) Check out the top of trunk into a roller directory
svn co https://svn.apache.org/repos/asf/roller/trunk roller
2) Make sure the roller-custom.properties file gets bundled into the
war. Instead of copying the war over into Tomcat's webapps directory
and then exploding it manually, copying jar files and copying the
properties file, I use the following technique to build the final war
directly.
2.a) mkdir -p roller/weblogger-webapp/src/main/resources
2.b) Create the file
roller/weblogger-webapp/src/main/resources/roller-custom.properties
with the following contents (change the username/password based on
what you want to use).
I have attached my version of the file with this email.
## roller-custom.properties begin
installation.type=auto
database.configurationType=jdbc
database.jdbc.driverClass=com.mysql.jdbc.Driver
database.jdbc.connectionURL=jdbc:mysql://localhost/rollerdb
database.jdbc.username=roller_user
database.jdbc.password=password
mail.configurationType=properties
mail.hostname=localhost
## roller-custom.properties end
2.c) Change the pom.xml file to make mail.jar not a 'provided' jar
(since Tomcat doesnt ship a mail.jar in its distribution and we can
get maven to download it for us), add the mysql-connector.jar as a
dependency . I didnt add activation.jar but usually if you need to
send attachments and stuff in the emails it could be added as well.
(the pom.xml I use is attached along with this email).
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.11</version>
</dependency>
2.d) Also change pom.xml to copy over the
src/main/resources/roller-custom.properties into the war (add another
execution element to the executions element under the
maven-resources-plugin (refer to attached pom.xml file)
<execution>
<id>copy-custom-roller-props</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/roller/WEB-INF/classes/</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
3) Build the project
cd roller
mvn clean install
4) cp weblogger-webapp/target/roller.war ${TOMCAT_HOME}/webapps
5) Set up your mysql database (in example below we create a database
called rollerdb, with user 'roller_user' and password 'password',
because thats we configured in roller-custom.properties in step 2.b )
$> mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 214
Server version: 5.1.37-1ubuntu5.5 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database rollerdb;
Query OK, 1 row affected (0.00 sec)
mysql> grant all on rollerdb.* to 'roller_user'@'%' identified by 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all on rollerdb.* to 'roller_user'@'localhost' identified
by 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
6) Start tomcat .. and you are good to go if you point your browser to
the 'roller' context.
${TOMCAT_HOME}/bin/startup.sh
Hitting the roller context from your browser will show you a page
where roller prompts you to create database tables, and then you can
register your new user and start blogging :)
Re: Steps to build roller trunk and deploy on Tomcat/MySQL
Posted by shelan Perera <sh...@gmail.com>.
Hi ,
Thanks for the steps.This would really eliminate troubles to add the custom
prop file manually. :)
regards.
On Wed, Feb 2, 2011 at 10:12 AM, oscontrib oscontrib <os...@gmail.com>wrote:
> Since my hosting provider supports Tomcat/MySQL, I got roller (from trunk)
> to build a war that deploys out of the box on Tomcat. Here are the steps I
> followed. I hope its useful to others. I had to tweak the pom.xml under the
> weblogger-webapp directory and my pom.xml is attached. The differences are
> minor and highlighted in the docs.. I checked the instructions a couple of
> times and it worked for me on my Ubuntu.
>
> Building and installing roller from trunk but customized for Tomcat/MySQL
>
> Prerequisites : Make sure you have java JDK (I use 1.6) and maven installed on your box.
>
>
> 1) Check out the top of trunk into a roller directory
> svn co https://svn.apache.org/repos/asf/roller/trunk roller
>
>
>
> 2) Make sure the roller-custom.properties file gets bundled into the war. Instead of copying the war over into Tomcat's webapps directory and then exploding it manually, copying jar files and copying the properties file, I use the following technique to build the final war directly.
>
>
> 2.a) mkdir -p roller/weblogger-webapp/src/main/resources
> 2.b) Create the file roller/weblogger-webapp/src/main/resources/roller-custom.properties with the following contents (change the username/password based on what you want to use).
>
>
> I have attached my version of the file with this email.
>
> ## roller-custom.properties begin
> installation.type=auto
>
> database.configurationType=jdbc
> database.jdbc.driverClass=com.mysql.jdbc.Driver
>
>
> database.jdbc.connectionURL=jdbc:mysql://localhost/rollerdb
> database.jdbc.username=roller_user
> database.jdbc.password=password
>
> mail.configurationType=properties
> mail.hostname=localhost
> ## roller-custom.properties end
>
>
> 2.c) Change the pom.xml file to make mail.jar not a 'provided' jar (since Tomcat doesnt ship a mail.jar in its distribution and we can get maven to download it for us), add the mysql-connector.jar as a dependency . I didnt add activation.jar but usually if you need to send attachments and stuff in the emails it could be added as well. (the pom.xml I use is attached along with this email).
>
>
> <dependency>
> <groupId>javax.mail</groupId>
> <artifactId>mail</artifactId>
> </dependency>
>
> <dependency>
> <groupId>mysql</groupId>
>
>
> <artifactId>mysql-connector-java</artifactId>
> <version>5.1.11</version>
> </dependency>
>
> 2.d) Also change pom.xml to copy over the src/main/resources/roller-custom.properties into the war (add another execution element to the executions element under the maven-resources-plugin (refer to attached pom.xml file)
>
>
> <execution>
> <id>copy-custom-roller-props</id>
> <phase>process-resources</phase>
> <goals>
>
>
> <goal>copy-resources</goal>
> </goals>
> <configuration>
> <outputDirectory>${project.build.directory}/roller/WEB-INF/classes/</outputDirectory>
>
>
> <resources>
> <resource>
> <directory>src/main/resources</directory>
> <filtering>false</filtering>
>
>
> <includes>
> <include>**/*.properties</include>
> </includes>
> </resource>
>
>
> </resources>
> </configuration>
> </execution>
>
> 3) Build the project
>
> cd roller
> mvn clean install
>
> 4) cp weblogger-webapp/target/roller.war ${TOMCAT_HOME}/webapps
>
>
> 5) Set up your mysql database (in example below we create a database called rollerdb, with user 'roller_user' and password 'password', because thats we configured in roller-custom.properties in step 2.b )
>
>
> $> mysql -u root -p
> Enter password:
> Welcome to the MySQL monitor. Commands end with ; or \g.
> Your MySQL connection id is 214
> Server version: 5.1.37-1ubuntu5.5 (Ubuntu)
>
> Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
>
>
> mysql> create database rollerdb;
> Query OK, 1 row affected (0.00 sec)
>
> mysql> grant all on rollerdb.* to 'roller_user'@'%' identified by 'password';
> Query OK, 0 rows affected (0.00 sec)
>
>
> mysql> grant all on rollerdb.* to 'roller_user'@'localhost' identified by 'password';
> Query OK, 0 rows affected (0.00 sec)
>
> mysql> quit;
>
>
> 6) Start tomcat .. and you are good to go if you point your browser to the 'roller' context.
>
>
> ${TOMCAT_HOME}/bin/startup.sh
>
> Hitting the roller context from your browser will show you a page where roller prompts you to create database tables, and then you can register your new user and start blogging :)
>
>
>
--
Shelan Perera
Blog : http://www.shelanlk.com
Twitter: shelan
skype :shelan.perera
gtalk :shelanrc
I am the master of my fate:
I am the captain of my soul.
*invictus*