WebserviceDeployment » History » Revision 26
« Previous |
Revision 26/32
(diff)
| Next »
Niels Hoffmann, 05/05/2009 10:56 AM
- Table of contents
- Webservice Deployment
Webservice Deployment¶
This HowTo describes all steps necessary to deploy a locally developed version of the webservice and dataportal to the production tomcat server and webserver.
Before taking the steps presented, please make sure everything is working in your local development environment all tests run without errors and that you committed all of your work to the subversion repository.
Updating the dataportal¶
Connect to the machine that is hosting the drupal instances via ssh.
When logged in to the server, change to the directory the dataportal files reside in and issue a subversion update command.
Also update all themes that have undeployed changes. The themes are likely in the instance folders for the specific dataportals.
Once you have updated the drupal instances, they might not work anymore unless the webservice get updated as well, because new dataportal code might rely on features that are not present in the current webservice.
Updating the database¶
Changes in the model will definitely come along with changes in the database. Make sure that the model version of your databases match the version of the webservice. Simplest thing to assure that would be a fresh import.
Updating the webservice¶
BACKUP THE EXISTING WAR FILE ON YOUR TOMCAT MACHINE FIRST, UNLESS YOU ARE 100% SURE OF WHAT YOU ARE DOING!
Adjust the cdm-remote source:trunk/cdmlib/cdmlib-remote/pom.xml.
- Make sure you have a settings.xml file in your maven repository (@~/.m2/@), that has at least one entry for the deployment server.
<settings> <servers> <server> <id>ID-OF-TOMCAT-SERVER-TO-DEPLOY-TO</id> <username>TOMCAT-USER</username> <password>TOMCAT-PASSWORD</password> </server> </servers> </settings>
- Adjust the tomcat plugin configuration.
<url>
has to point to the URL of the tomcat server,<servername>
has to match the id in settings.xml and we need the<update>
switch, so that maven undeploys the old .war file before installing the new one.
... <plugin><!--use mvn tomcat:deploy --> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <configuration> <update>true</update> <server>ID-OF-TOMCAT-SERVER-TO-DEPLOY-TO</server> <url>http://YOUR-TOMCAT-SERVER.TLD/manager</url> </configuration> </plugin> ...
- Install all cdmlib projects. Optionally omitting downloads, tests and other output.
mvn install [-q] [-o] [-Dmaven.test.skip]
- Generate the .war file and deploy it to the server.
mvn [-Dmaven.test.skip] tomcat:deploy
- Since we are using a !UpdatableRoutingDataSource there is no more need to install a service for every portal. You simply need to configure your datasources in an xml file. If not already there, create a hidden folder in
CATALINA_HOME
(e.g./usr/share/tomcat5.5@) directory called @.cdmlibrary
and create a filedatasources.xml
cd /usr/share/tomcat5.5 [mkdir .cdmlibrary] vi .cdmlibrary/datasources.xml
- Enter beans for every datasource. Example configuration:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd "> <bean id="cichorieae" lazy-init="true" class="org.springframework.jdbc.datasource.SimpleDriverDataSource"> <property name="driverClass" value="com.mysql.jdbc.Driver"/> <property name="username" value="DATABASE-USER"/> <property name="password" value="DATABASE-PASSWORD"/> <property name="url" value="jdbc:mysql://localhost/DATABASE-NAME"/> </bean> ... </beans>
Upon changes to datasources.xml, a management URL has to be called to reload the server settings: http://YOUR-TOMCAT-SERVER.TLD:PORT/cdmserver/manager/dataSources/reload.
And that's basically it!
By now you should have a running instance of your newly deployed webservice. Please check that everything is working correctly.
Caveat¶
- In case you deploy quite often, you should restart tomcat from time to time, otherwise you will run into OutOfMemory errors in the PermGen Space, due to reloading of already loaded classes. To do so, login to your server and restart tomcat
/etc/init.d/tomcat restart
- In case you run into OutOfMemory Exceptions when building the .war file increase the mavens memory within its environment variable.
export MAVEN_OPTS=-Xmx256M
Updated by Niels Hoffmann over 15 years ago · 26 revisions