This document describes how to deploy your Aligo application to Ejip.Net.  At a high-level, your Ejip.Net environment is a hosting environment for production deployments, therefore, as you often must in projects, you must modify your deployment descriptors to deploy into the Ejip.Net environment that is created for your server.

Ejip.Net requires a full J2EE application to be deployed, not individual WARs, EJBs, etc.  So the steps involved here, will package any WAR or EJB based Aligo application for deployment to Ejip.Net on the Orion Server. There should be no need for code-changes if the standard Aligo classes are used for DB access and connectivity.

PREQUISITE: If you have not already, Sign up for a trial account on Ejip.Net.  See howtoSignUpForTrialAccount.txt.  When you are done, please continue the steps below.

Before you begin, make a backup of your project including all /properties, and /src files.

NOTE: It is recommended that you have two sets of aligo.xml, and web.xml files.  One for your local development environment and one that is modified for deployment settings in Ejip.Net.  Your build environment (e.g, build.properties &  build.xml) can be as sexy as you want it.  The most basic being two full copies of each with separate build.xmls, aligo.xml, and web.xmls.  Where as the most sexy would to switch between the two environments even across servers from Tomcat to a full J2EE server like the ones used in Ejip.Net with a single flag in build.properties and some nice work in build.xml too.

This document describes how-to-deploy to Ejip.Net, not how to be sexy about it!  Although, there is a code change and extra JAR that you need to be aware of if you plan to deploy to Ejip.Net.  Check out the guide, "howtoUseEjipDBConnections.txt" for more information on code change requirements (they are minor, really!).

1. Copy the /application directory from the Ejip.Net sample RestaurantGuide over to your application home directory and modify application/application.xml to add your WARs, or other J2EE modules if you used EJBs.  

**********************************************************************************************************************

2. In your Aligo application's build.xml, perform the following modifications:

a.) Modify target "release" to build an .ear file:

<target name="release" depends="war" description="Creates a deployable J2EE application for Ejip.Net in the /release directory" > 
        <mkdir dir="release"/> 
        <mkdir dir="deploy"/>
	<copy file="tojar/your_aligo_project_name.war" todir="deploy" /> 

	<mkdir dir="deploy/META-INF"/>
	<copy file="application/application.xml" todir="deploy/META-INF" /> 
	
	<jar jarfile="release/yourprojectname.ear" 
              basedir="deploy" 
              compress="false"> 
        </jar> 
	<delete dir="deploy" /> 
</target>

The /release directory will hold the J2EE application that is deployed to Ejip.Net through the Ejip.Net Console's Deploy Tab.

b.) Next, modify target "war" to ensures the Aligo server is embedded in the WAR correctly (see RestaurantGuide's build.xml for example): 

	<!-- Added to embed the Aligo Server configuration files -->  
	<mkdir dir="wartemp/aligo" />
	<copy file="../yourprojectname/aligoconf/Messages.xml" todir="wartemp/aligo"/>
	<mkdir dir="wartemp/aligo/aml" />
	<copy todir="wartemp/aligo/license">
		<fileset dir="../yourprojectname/aligoconf/license" />
	</copy>
	<copy todir="wartemp/aligo/profilemanager">
		<fileset dir="../yourprojectname/aligoconf/profilemanager" />
	</copy>
	<!-- Done adding Aligo Server configuration files -->

c.) Modify the actual war task to include ejip-dbplugin.jar in WEB-INF/lib.  See RestaurantGuide example below:

<war warfile="tojar/restaurantguide.war" webxml="properties/web.xml">
	<lib dir="${m1.jars}">  
         	<include name="m1framework.jar" />           
		<include name="pminternallib.jar" />           
        </lib> 
	<lib dir="tojar"> 
        	<include name="restaurantguide.jar" /> 
        </lib>    

	<!-- Added to ensure Ejip.Net database connections used correctly -->  
	<lib dir="aligoconf/lib/"> 
       		<include name="ejip-dbplugin.jar" /> 
       	</lib>
		
       	<fileset dir="wartemp" /> 
</war>

******************************************************************************************************
3. Modify the following files in the /properties directory to enable them to be deployed to Ejip.Net

- aligo.xml
- web.xml

aligo.xml
---------
a.) Modify location of profilemanager.xml:
<ProfileManager>
	<Config>/home/vhost1/www.[yourdomain].com|net|org/deploy/[your J2EE EAR Name]/[your aligo project name]/aligo/profilemanager/profilemanager.xml</Config>
</ProfileManager>

b.) Modify location of UAQuery.xml:
<DevicePersonalizationManager>
	<Config>/home/vhost1/www.[yourdomain].com|net|org/deploy/[your J2EE EAR Name]/[your aligo project name]/conf/UAQuery.xml</Config>
</DevicePersonalizationManager>

c.) Modify location of lic.key:
<License>/home/vhost1/www.[yourdomain].com|net|org/deploy/[your J2EE EAR Name]/[your aligo project name]/aligo/license/lic.key</License>

d.) Modify location of aml output directory:
<Engine>
	<AmlOutputDir>/home/vhost1/www.[yourdomain].com|net|org/deploy/[your J2EE EAR Name]/[your aligo project name]/aligo/aml</AmlOutputDir>
	...
</Engine>

e.) Modify location of Messages.xml:
<MessagesFile>/home/vhost1/www.[yourdomain].com|net|org/deploy/[your J2EE EAR Name]/[your aligo project name]/aligo/Messages.xml</MessagesFile>

f.) Modify <HostName>:
<Application>
	<Name>restaurantguide</Name>
	<Servlet>com.xyz.wireless.servlet.RestaurantGuideServlet</Servlet>

	<!-- Domain name here MUST contain the suffix ejip.org if it is a Trial Account -->
	<HostName>http://www.[yourdomain].com|net|org|.ejip.org</HostName>


	...
</Application>

g.) Modify default aml handler's <Location>:
<Default>
	<Handler>aml</Handler>
	<!-- Domain name here MUST contain the suffix ejip.org if it is a Trial Account -->
	<Location>http://www.[yourdomain].com|net|org|.ejip.org/[your web app context]/JSP/</Location>

	...
</Default>


web.xml
-------
a.) Modify the deployment_descriptor value:
<init-param>
            <param-name>deployment_descriptor</param-name>
            <param-value>/home/vhost1/www.[yourdomain].com|net|org/deploy/[your J2EE EAR Name]/[your aligo project name]/conf/aligo.xml</param-value>
</init-param>

b.) Modify logs_dir value:
<init-param>   
            <param-name>logs_dir</param-name>
            <param-value>/home/vhost1/www.[yourdomain].com|net|org/vroot/html/aligo/log/[your aligo project name]</param-value>
</init-param>

c.) Copy the /m1-embedded directory from the RestaurantGuide sample to your application directory (e.g., userapps, or some custom directory where you mounted a drive).

***************************************************************************************************************
4.) Modify the following files to enable them to be deployed to Ejip.Net

aligoconf/profilemanager/profilemanager.xml

profilemanager.xml
------------------
a.) Modify <LogDir> location:
<LogDir>/home/vhost1/www.[yourdomain].com|net|org/vroot/html/aligo/log/profilemanager</LogDir>

b.) Modify <ExternalLibrary> location:
<ExternalLibrary>/home/vhost1/www.[yourdomain].com|net|org/deploy/[your J2EE EAR Name]/[your aligo project name]/aligo/profilemanager/externallib/</ExternalLibrary>

c.) Modify <InternalLibrary> location:
<InternalLibrary>/home/vhost1/[your domain name]/vroot/lib/pminternallib.jar</InternalLibrary>

****************************************************************************************************************
5. Copy your license file (lic.key) from your %ALIGO_HOME/license directory to your project's /aligoconf/license directory.  This file will be bundled into your WAR and deployed to Ejip.Net to ensure your server runs on a valid license.

6. From the Ejip.Net Console, click left navbar's Deploy, and then in the tabbed screen, select LIB tab.  Upload the following JARs from your %ALIGO_HOME%/m-1/jars directory on your local hard drive:

aligoprofileservlet.jar
m1.jar
m1framework.jar
pminternallib.jar
properties-syntax.jar

9. Make changes to your deployment descriptors and code-base to use Ejip.Net database connections. See howtoUseEjipDBConnections.txt

10. Build your .ear file through ANT calling c:\yourapplication\build.cmd release.  The output should be an Ejip.Net deployable .ear file.

11. While your Ejip.Net server is stopped, Goto the Deploy section of the Ejip.Net Console, and within the J2EE Tab, upload the .ear file to Ejip.Net.

12. Upload your application's JAR file to the LIB tab in the Ejip.Net Console as well.  After a successful build.xml release, this file should belong in your project's /tojar directory.

[yourapplication].jar

13. Setup Logging.  See howToSetupAligoLogging.txt

14. Create your database and load any data into the tables as necessary.  Do this through the Database section of the Ejip.Net Console.

15. Start your server by selecting the start option in the upper right portion of your monitor (e.g., Server Control).

16. Navigate to your URL through any browser to ensure your application deployed successfully.  You can also check the Logs in the Server section of the Ejip.Net Console for more information.







