Skip to content

Commit

Permalink
add deployment options section
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Nov 13, 2007
1 parent 45df593 commit c719010
Showing 1 changed file with 205 additions and 1 deletion.
206 changes: 205 additions & 1 deletion symmetric/src/docbook/user-guide/ch04-architecture.xml
Expand Up @@ -51,6 +51,210 @@
</section>
<section>
<title>Deployment Options</title>
<para></para>
<para>The following deployment options are possible:</para>
<itemizedlist>
<listitem>
<para>Web application archive (WAR) deployed to an application server</para>
</listitem>
<listitem>
<para>Standalone service that embeds Jetty web server</para>
</listitem>
<listitem>
<para>Embedded as a Java library in an application</para>
</listitem>
</itemizedlist>
<para>
In each deployment, you configure which services are available.
The possible services to map for deployment include PushServlet,
PullServlet, AckServlet, and RegistrationServlet. If synchronization is configured
for "pull" action, the PullServlet and AckServlet must be mapped. If using "push"
action, the PushServlet must be mapped. If the instance is used as the registration
server, the RegistrationServlet must mapped.
</para>
<section>
<title>Web Archive</title>
<para>
As a web application archive, a WAR or EAR file is deployed to an application server,
such as Tomcat, Jetty, or JBoss. The <filename>WEB-INF/web.xml</filename> file
is configured with a <literal>SymmetricEngineContextLoaderListener</literal>
and the required Servlet mappings.
</para>
<programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>sync</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<!-- Optionally specify other spring xml files that are loaded in the same context -->
<param-value>classpath:additional-spring.xml</param-value>
</context-param>
<servlet>
<servlet-name>push</servlet-name>
<servlet-class>org.jumpmind.symmetric.web.PushServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>pull</servlet-name>
<servlet-class>org.jumpmind.symmetric.web.PullServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>registration</servlet-name>
<servlet-class>org.jumpmind.symmetric.web.RegistrationServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>ack</servlet-name>
<servlet-class>org.jumpmind.symmetric.web.AckServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<filter>
<filter-name>NodeConcurrencyFilter</filter-name>
<filter-class>org.jumpmind.symmetric.web.NodeConcurrencyFilter</filter-class>
</filter>
<filter>
<filter-name>AuthenticationFilter</filter-name>
<filter-class>org.jumpmind.symmetric.web.AuthenticationFilter</filter-class>
</filter>
<filter>
<filter-name>CompressionFilter</filter-name>
<filter-class>javawebparts.filter.CompressionFilter</filter-class>
<init-param>
<param-name>compressType</param-name>
<param-value>gzip_only</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CompressionFilter</filter-name>
<servlet-name>pull</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>CompressionFilter</filter-name>
<servlet-name>push</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>CompressionFilter</filter-name>
<servlet-name>registration</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>NodeConcurrencyFilter</filter-name>
<servlet-name>push</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>NodeConcurrencyFilter</filter-name>
<servlet-name>pull</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>NodeConcurrencyFilter</filter-name>
<servlet-name>ack</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>
<servlet-name>push</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>
<servlet-name>ack</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>
<servlet-name>pull</servlet-name>
</filter-mapping>
<servlet-mapping>
<servlet-name>push</servlet-name>
<url-pattern>/push/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ack</servlet-name>
<url-pattern>/ack/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>pull</servlet-name>
<url-pattern>/pull/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>registration</servlet-name>
<url-pattern>/registration/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.jumpmind.symmetric.SymmetricEngineContextLoaderListener</listener-class>
</listener>
</web-app>
]]></programlisting>
<para>
This example starts all the SymmetricDS Servlets with filters to compress the
stream, authenticate nodes, and reject nodes when the server is too busy.
</para>
</section>
<section>
<title>Standalone</title>
<para>
A standalone service can use the <literal>sym</literal> command line options to start
a server. An embedded instance of Jetty is used to service web
requests for all the servlets.
</para>
<programlisting><![CDATA[/symmetric/bin/sym --properties root.properties --port 8080 --server
]]></programlisting>
<para>
This example starts the SymmetricDS server on port 8080 with the startup
properties found in the <filename>root.properties</filename> file.
</para>
</section>
<section>
<title>Embedded</title>
<para>
A Java application with the SymmetricDS Java Archive (JAR) library on its
classpath can use the <literal>SymmetricEngine</literal> to start the server.
</para>
<programlisting><![CDATA[
import org.jumpmind.symmetric.SymmetricEngine;
public class StartSymmetricEngine {
public static void main(String[] args) throws Exception {
String workingDirectory = System.getProperty("user.dir");
SymmetricEngine engine = new SymmetricEngine("classpath://my-application.properties", "file://"
+ workingDirectory + "/my-environment.properties");
// this will create the database, sync triggers, start jobs running
engine.start(8080);
}
}]]></programlisting>
<para>
This example starts the SymmetricDS server on port 8080 with startup properies found
in two locations. The first file, <filename>my-application.properties</filename>,
is packaged in the application to provide properties that override the SymmetricDS
default values. The second file, <filename>my-environment.properties</filename>,
is located in a working directory that overrides properties specific to the
environment. This allows the same application to deploy to development and
production environments using different <filename>my-environment.properties</filename>.
</para>
</section>
</section>
</chapter>

0 comments on commit c719010

Please sign in to comment.