Deploying (To Hectare)

1. Copy File Datastore from devel to prod

  1. Verify that no production metadata files have been changed. If some have then it will be necessary to merge those changes with the development metadata system.
  1. Copy over the admin_tools and update the properties file to point to the production database.
  1. Copy over all the relevant files in the data_store folder.

2. Copy over database

--devel to prod
--really only the metadata and master grid tables need to be copied.  At some point doing a complete dump is going to cause problems as saved queries will be lost.  The following tables will need to be dumpped:
*habc.master_grid_x
*habc.category_metadata;
*habc.layer_metadata;
*habc.grid_metadata;
*habc.search
*the schema should be copied for all other query tables if not already existant.
/opt/postgresql-8.2.4/bin/pg_dump -n habc habc_devel | /opt/postgresql-8.2.4/bin/psql habc_prod
  1. Update dirty flag on metadata tables to false.

3. Create tomcat directory

cd /opt/tomcat-6.0.14/webapps/
mkdir habc-sprint4

4. Create Jar File of Application

5. Compile the GWT to javascript This can be completed by either running the application and hitting the compile/browse button (output is placed in the www/net.refractions.habc.gui.HaBC folder); or by running the mvn gwt:compile. This step creates a bunch of html and js files.

6. Copy over the compiled javascript and other files to the /opt/tomcat-6.0.14/webapps/habc-sprint4 folder.

7. Create WEB-INF and META-INF folders

mkdir WEB-INF
mkdir META-INF

8. In the WEB-INF file create web.xml file

cd WEB-INF
vi web.xml

<<
copy the values from the web.xml file in the svn repositoy
 * remove the servlet and servlet mapping related to shell (GWTShellServlet).
 * update references to be relative (tomcat references get /app)
 * update all references to devel to prod
>>

9. In the WEB-INF file create a lib folder and place the jar created in step 4 and the other jars required by this program in this directory.

mkdir lib

This list currently includes: *commons-dbcp-1.2.2.jar *gwt-dragdrop-1.2.2.jar *gwt-user.jar *jmxri-1.2.1.jar *log4j-1.2.15.jar *openlayers_gwt-0.1.jar *commons-pool-1.3.jar *gwt-servlet.jar *habc_app_3.4.jar *jms-1.1.jar *jmxtools-1.2.1.jar *mail-1.4.jar *sph-gwt-widgets-1.0.0.jar

10. In the META-INF folder create a context.xml file and place in the database connection information.

<Context path="" docBase=""  crossContext="true" reloadable="true" debug="1">

<Resource name="habcdb" auth="Container"
          type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"
          url="jdbc:postgresql://hectare:5432/habc_prod"
          username="habc_user" password="" maxActive="2" maxIdle="2" maxWait="-1"/>
</Context>

11. Regenerate mapfile

cd /raid/habc_data_prod/admin_tools

vi habc_mapfile_template.map
<<and ensure FONTSET directory is correct:  /raid/habc_data_prod/mapserver/fonts/fonts.lst>>

java -Xmx265M -cp "./lib/HaBC_DataLoading-3.0.jar:./lib/log4j-1.2.15.jar:./lib/postgresql-jdbc-8.2-505-copy-20070719.jdbc3.jar:./lib" net.ref
ractions.habc.web.mapfile.MapfileGenerator -mapfile /raid/habc_data_prod/mapserver/habc.map  -template habc_mapfile_template.map

12. Setup Log4J file.

cd /opt/tomcat-6.0.14/webapps/habc-sprint4/WEB-INF/lib/
vi log4j.properties

log4j.rootLogger=DEBUG, A1
log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.File=habc_errors.log

# Print the date in ISO 8601 format
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n


14. Change owner for metadata files (required for editing metadata files). [Need to be root]

chown -R apache /raid/habc_data_prod/data_files

13. Restart tomcat

/etc/init.d/tomcat_6 stop
/etc/init.d/tomcat_6 start

14. Ensure /raid/habc_data_prod/tile_cache permissions are setup properly. The user Apache needs to be able to write to this directory. If tile_cache is not working then it is likely because these permissions are not setup properly.