You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2009/09/02 17:53:51 UTC

svn commit: r810581 - in /ofbiz/trunk/framework/appserver/templates/glassfish21: ./ README application.xml deploy.sh entityengine.xml.patch run.sh url.properties

Author: jleroux
Date: Wed Sep  2 15:53:50 2009
New Revision: 810581

URL: http://svn.apache.org/viewvc?rev=810581&view=rev
Log:
A patch from Vadiraj Deshpande "OFBiz deployment on Glassfish v2.1" (https://issues.apache.org/jira/browse/OFBIZ-2374) - OFBIZ-2374

Added:
    ofbiz/trunk/framework/appserver/templates/glassfish21/
    ofbiz/trunk/framework/appserver/templates/glassfish21/README
    ofbiz/trunk/framework/appserver/templates/glassfish21/application.xml
    ofbiz/trunk/framework/appserver/templates/glassfish21/deploy.sh
    ofbiz/trunk/framework/appserver/templates/glassfish21/entityengine.xml.patch
    ofbiz/trunk/framework/appserver/templates/glassfish21/run.sh
    ofbiz/trunk/framework/appserver/templates/glassfish21/url.properties

Added: ofbiz/trunk/framework/appserver/templates/glassfish21/README
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/appserver/templates/glassfish21/README?rev=810581&view=auto
==============================================================================
--- ofbiz/trunk/framework/appserver/templates/glassfish21/README (added)
+++ ofbiz/trunk/framework/appserver/templates/glassfish21/README Wed Sep  2 15:53:50 2009
@@ -0,0 +1,87 @@
+###############################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+###############################################################################
+
+This directory contains templates for Glassfish Server v2.1 deployment
+======================================================================
+
+README                  - this file.
+run.sh                  - loads seed and demo data into JavaDB that comes with
+                          Glassfish server and then deploys OFBiz.
+deploy.sh               - automatic deployment script. Builds WARs and the
+                          ofbiz.ear and deploys onto glassfish.
+domain.xml_patch        - updated to record the ofbiz home.
+entityengine.xml_patch  - updated to use bundled JavaDB datasources.
+url.properties          - updated to set the HTTPS port to 8181 (default port).
+application.xml         - EAR metadata.
+
+
+
+HOW-TO (this needs to be posted on the OFBiz documentation site)
+======
+
+1. Setup
+    a. Create a folder somewhere on the disk with ~800MB free memory. 
+       This becomes the work area. Referred as <work-folder> hence forth.
+    b. Download Glassfish Server v2.1 and install. (Download it from [1])
+    c. Download OFBiz source (if you have not done already). (Either 
+       download the build from http://build.ofbiz.org or checkout from SVN. 
+       Refer [2])
+    d. Build OFBiz sources (in case of svn checkout) using 'ant' command. 
+       This will create 'ofbiz.jar' file.
+    e. Generate container templates for Glassfish v2.1 server.
+         i. Goto the OFBiz source folder (referred as OFBIZ_HOME).
+        ii. Use the command 'java -jar ofbiz.jar -setup glassfish21' to 
+            generate the templates. For more information refer [3]. 
+            This will create a new folder called 'setup' inside OFBIZ_HOME 
+            and copy the generated templates under the folder 
+            'setup/glassfish21'.
+
+
+if (you are using JavaDB && want seed and demo data loaded) {
+    Copy OFBIZ_HOME/setup/glassfish21/run.sh to <work-folder>;
+    run run.sh script now!; 
+    // (without quotes) './run.sh <glassfish_home> <glassfish-domain-path>'
+} else {
+ read ahead;
+}
+
+
+2. Install and start the database server if its not done already.
+3. Create / update entityengine.xml to include your database server details. 
+   Refer [4]. If you want to use JavaDB with default settings, you can use entityengine.xml_patch
+   readily available under 'OFBIZ_HOME/setup/glassfish21'.
+4. Load seed and demo data (optional, but highly recommended) by using
+   './ant run-install' command under OFBIZ_HOME. Refer [5].
+5. Copy OFBIZ_HOME/setup/glassfish21/deploy.sh to <work-folder>.
+6. Run deploy.sh.
+   (without quotes) './deploy.sh <glassfish-home> <glassfish-domain-path>'.
+7. Check domain.xml for XML validation errors. This is to make sure the patching of domain.xml in previous step was done neatly.
+8. Start/restart glassfish server if its not already running.
+9. If you have opted for loading demo data, goto
+   http://localhost:8080/ecommerce and http://localhost:8080/webtools to 
+   verify the installation.
+
+References :
+
+[1] : https://glassfish.dev.java.net/downloads/v2.1-b60e.html
+[2] : http://docs.ofbiz.org/display/OFBADMIN/Demo+and+Test+Setup+Guide (Building from SVN)
+[3] : OFBIZ_HOME/framework/appserver/README
+[4] : http://docs.ofbiz.org/display/OFBTECH/Apache+OFBiz+Technical+Production+Setup+Guide (2.c. Database Setup)
+[5] : http://docs.ofbiz.org/display/OFBTECH/Apache+OFBiz+Technical+Production+Setup+Guide (2.d. Seed Data Loading)
+

Added: ofbiz/trunk/framework/appserver/templates/glassfish21/application.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/appserver/templates/glassfish21/application.xml?rev=810581&view=auto
==============================================================================
--- ofbiz/trunk/framework/appserver/templates/glassfish21/application.xml (added)
+++ ofbiz/trunk/framework/appserver/templates/glassfish21/application.xml Wed Sep  2 15:53:50 2009
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<application xmlns="http://java.sun.com/xml/ns/javaee"
+               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
+               version="5">
+
+    <description>Open For Business - Deployment</description>
+    <display-name>OFBiz</display-name>
+
+<#list webApps as webapp>
+    <module>
+        <web>
+            <web-uri>${webapp.getName()}.war</web-uri>
+            <context-root>${webapp.getContextRoot()}</context-root>
+        </web>
+    </module>
+</#list>
+    
+</application>

Added: ofbiz/trunk/framework/appserver/templates/glassfish21/deploy.sh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/appserver/templates/glassfish21/deploy.sh?rev=810581&view=auto
==============================================================================
--- ofbiz/trunk/framework/appserver/templates/glassfish21/deploy.sh (added)
+++ ofbiz/trunk/framework/appserver/templates/glassfish21/deploy.sh Wed Sep  2 15:53:50 2009
@@ -0,0 +1,145 @@
+#!/bin/sh
+
+###############################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+###############################################################################
+
+
+#################################
+# Glassfish Deployment          #
+#                               #
+# Run with Glassfish Home and   #
+# domain directory path         #
+#################################
+
+# Check args.
+
+if [ $# -ne 2 ]; then
+  echo "Input required .."
+  echo "Syntax: $0 <glassfish-home> <glassfish-domain-directory-path>"
+  exit 1
+fi
+
+# Clean up ..
+
+if [ -f "./META-INF/application.xml" ]; then
+  rm -rf META-INF
+  echo "removed META-INF"
+fi
+if [ -f "./lib/ofbiz-base.jar" ]; then
+  rm -rf lib
+  echo "removed libs"
+  rm *.war
+  echo "removed wars"
+  rm ofbiz.ear
+  echo "removed ear"
+fi
+
+GLASSFISH_HOME=$1
+DOMAIN_HOME=$2
+
+# setup JavaDB drivers.
+if [ ! -f "${ofbizHome}/framework/entity/lib/jdbc/derbyclient.jar" ]; then
+    cp $GLASSFISH_HOME/javadb/lib/derbyclient.jar ${ofbizHome}/framework/entity/lib/jdbc/derbyclient.jar
+fi
+
+# setup log4j.xml (copy to domain1/config folder)
+if [ ! -f "$DOMAIN_HOME/config/log4j.xml" ]; then
+    cp ${ofbizHome}/framework/base/config/log4j.xml $DOMAIN_HOME/config
+fi
+
+# setup the OFBIZ_HOME by updating domain.xml
+if [ ! -f "$DOMAIN_HOME/config/domain.xml_bak" ]; then
+  cp $DOMAIN_HOME/config/domain.xml $DOMAIN_HOME/config/domain.xml_bak
+  patch  $DOMAIN_HOME/config/domain.xml ${targetDirectory}/domain.xml.patch
+  if [ $? ne 0] ; then
+    echo "Patching domain.xml failed.."
+    exit 1;
+  fi
+  echo "patched domain.xml"
+fi
+
+# setup entityengine.xml
+if [ -f "${ofbizHome}/framework/entity/config/entityengine.xml" ]; then
+    cp ${ofbizHome}/framework/entity/config/entityengine.xml ${ofbizHome}/framework/entity/config/entityengine.xml_bak
+    patch  framework/entity/config/entityengine.xml ${targetDirectory}/entityengine.xml.patch
+    if [ $? ne 0] ; then
+      echo "Patching entityengine.xml failed.."
+      exit 1;
+    fi
+    echo "patched entityengine.xml"
+fi
+
+# setup url.properties (SSL port)
+if [ -f "${ofbizHome}/framework/webapp/config/url.properties" ]; then
+    mv ${ofbizHome}/framework/webapp/config/url.properties ${ofbizHome}/framework/webapp/config/url.properties_bak
+    cp ${targetDirectory}/url.properties ${ofbizHome}/framework/webapp/config/url.properties
+    echo "Copied url.properties"
+fi
+
+# copy all lib files
+mkdir lib
+<#list classpathJars as jar>
+<#if (!jar.contains("j2eespec") && !jar.contains("catalina") && !jar.contains("mx4j") && !jar.contains("derby-") && !jar.contains("commons-el") && !jar.contains("avalon-framework") && !jar.contains("mail.jar"))>
+cp ${jar} ./lib
+</#if>
+</#list>
+echo "installed ofbiz libraries"
+
+<#list classpathDirs as dir>
+<#if (dir != ofbizHome)>
+<#assign jarname = dir.substring(ofbizHome.length()+1)/>
+<#assign jarname = jarname.replaceAll("/", ".")/>
+jar cvf ./lib/${jarname}.jar -C ${dir} .
+</#if>
+</#list>
+echo "\n\n"
+echo "packaged and installed ofbiz configuration directories"
+
+# WAR the web applications
+<#list webApps as webapp>
+jar -cvf ${webapp.getName()}.war -C ${webapp.getLocation()} .
+</#list>
+echo "WARred webapp directories"
+
+# create the application meta data
+mkdir META-INF
+cp ${targetDirectory}/application.xml ./META-INF
+echo "installed application.xml"
+
+# build EAR
+jar -cvf ofbiz.ear *
+
+# copy the EAR to autodeploy dir
+cp ofbiz.ear $DOMAIN_HOME/autodeploy/ofbiz.ear
+echo "Copied EAR to autodeploy"
+
+# revert entityengine.xml
+if [ -f "${ofbizHome}/framework/entity/config/entityengine.xml_bak" ]; then
+    mv ${ofbizHome}/framework/entity/config/entityengine.xml_bak ${ofbizHome}/framework/entity/config/entityengine.xml
+    echo "restored entityengine.xml"
+fi
+
+# revert url.properties
+if [ -f "${ofbizHome}/framework/webapp/config/url.properties_bak" ]; then
+    mv ${ofbizHome}/framework/webapp/config/url.properties_bak ${ofbizHome}/framework/webapp/config/url.properties
+    echo "restored url.properties"
+fi
+
+
+echo "\n"

Added: ofbiz/trunk/framework/appserver/templates/glassfish21/entityengine.xml.patch
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/appserver/templates/glassfish21/entityengine.xml.patch?rev=810581&view=auto
==============================================================================
--- ofbiz/trunk/framework/appserver/templates/glassfish21/entityengine.xml.patch (added)
+++ ofbiz/trunk/framework/appserver/templates/glassfish21/entityengine.xml.patch Wed Sep  2 15:53:50 2009
@@ -0,0 +1,79 @@
+###############################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+###############################################################################
+53,54c53,54
+<         <group-map group-name="org.ofbiz" datasource-name="localderby"/>
+<         <group-map group-name="org.ofbiz.olap" datasource-name="localderbyolap"/>
+---
+>         <group-map group-name="org.ofbiz" datasource-name="derby"/>
+>         <group-map group-name="org.ofbiz.olap" datasource-name="derbyolap"/>
+55a56,57
+> 
+> 
+123a126,176
+> 
+>     <datasource name="derby"
+>             helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
+>             schema-name="ofbiz"
+>             field-type-name="derby"
+>             check-on-start="true"
+>             add-missing-on-start="true"
+>             use-pk-constraint-names="false"
+>             use-indices-unique="false"
+>             alias-view-columns="false">
+>         <read-data reader-name="seed"/>
+>         <read-data reader-name="seed-initial"/>
+>         <read-data reader-name="demo"/>
+>         <read-data reader-name="ext"/>
+>         <inline-jdbc
+>                 jdbc-driver="org.apache.derby.jdbc.ClientDriver"
+>                 jdbc-uri="jdbc:derby://localhost:1527/ofbiz;create=true"
+>                 jdbc-username="ofbiz"
+>                 jdbc-password="ofbiz"
+>                 isolation-level="ReadCommitted"
+>                 pool-minsize="2"
+>                 pool-maxsize="250"/>
+>         <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
+>     </datasource>
+> 
+> 
+>     <datasource name="derbyolap"
+>             helper-class="org.ofbiz.entity.datasource.GenericHelperDAO"
+>             schema-name="ofbiz"
+>             field-type-name="derby"
+>             check-on-start="true"
+>             add-missing-on-start="true"
+>             use-pk-constraint-names="false"
+>             use-indices-unique="false"
+>             alias-view-columns="false">
+>         <read-data reader-name="seed"/>
+>         <read-data reader-name="seed-initial"/>
+>         <read-data reader-name="demo"/>
+>         <read-data reader-name="ext"/>
+>         <inline-jdbc
+>                 jdbc-driver="org.apache.derby.jdbc.ClientDriver"
+>                 jdbc-uri="jdbc:derby://localhost:1527/ofbiz;create=true"
+>                 jdbc-username="ofbiz"
+>                 jdbc-password="ofbiz"
+>                 isolation-level="ReadCommitted"
+>                 pool-minsize="2"
+>                 pool-maxsize="250"/>
+>         <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/DerbyDataSource" isolation-level="ReadCommitted"/> -->
+>     </datasource>
+> 
+> 

Added: ofbiz/trunk/framework/appserver/templates/glassfish21/run.sh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/appserver/templates/glassfish21/run.sh?rev=810581&view=auto
==============================================================================
--- ofbiz/trunk/framework/appserver/templates/glassfish21/run.sh (added)
+++ ofbiz/trunk/framework/appserver/templates/glassfish21/run.sh Wed Sep  2 15:53:50 2009
@@ -0,0 +1,80 @@
+#!/bin/sh 
+
+###############################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+###############################################################################
+
+# Check args.
+
+if [ $# -ne 2 ]; then
+  echo "Input required ..."
+  echo "Syntax: $0 <glassfish-home> <glassfish-domain-directory-path>"
+  exit 1
+fi
+
+GLASSFISH_HOME=$1
+DOMAIN_HOME=$2
+WORK_DIR=$PWD
+
+# Setup JavaDB JDBC driver.
+cd ../ 
+cp $GLASSFISH_HOME/javadb/lib/derbyclient.jar ${ofbizHome}/framework/entity/lib/jdbc/derbyclient.jar
+echo "Installed JDBC driver for JavaDB"
+
+# Generate seed and demo data.
+cd ${ofbizHome}
+cp framework/entity/config/entityengine.xml framework/entity/config/entityengine.xml_orig
+patch framework/entity/config/entityengine.xml ${targetDirectory}/entityengine.xml.patch 
+if [ $? ne 0] ; then
+ echo "Patching entityengine.xml failed.."
+ exit 1;
+fi
+
+ # Start JavaDB server.
+ cd $GLASSFISH_HOME
+ export DERBY_HOME=$PWD/javadb
+ export DERBY_OPTS=-Dderby.system.home=$PWD/domains/domain1/config
+ sh javadb/bin/startNetworkServer &
+echo "Started JavaDB server"
+
+ # Load the seed and demo data.
+ cd ${ofbizHome} 
+ ./ant run-install
+echo "Loaded seed and demo data"
+
+ # Restore entityengine.xml
+ mv framework/entity/config/entityengine.xml_orig framework/entity/config/entityengine.xml
+
+
+# Setup work area (where the WARs and EAR to be built.
+cp ${targetDirectory}/deploy.sh $WORK_DIR  
+
+# Run the deployment script.
+echo "Running the deployment script"
+cd $WORK_DIR  
+chmod +x deploy.sh  
+./deploy.sh $GLASSFISH_HOME $DOMAIN_HOME > run.log  
+
+
+# Finally start glassfish server.
+#echo "Starting glassfish server .."
+#cd $GLASSFISH_HOME
+#bin/asadmin start-domain &
+
+cd ..
+echo "done"

Added: ofbiz/trunk/framework/appserver/templates/glassfish21/url.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/appserver/templates/glassfish21/url.properties?rev=810581&view=auto
==============================================================================
--- ofbiz/trunk/framework/appserver/templates/glassfish21/url.properties (added)
+++ ofbiz/trunk/framework/appserver/templates/glassfish21/url.properties Wed Sep  2 15:53:50 2009
@@ -0,0 +1,45 @@
+###############################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+###############################################################################
+####
+# OFBiz Global URL Settings - WebSite specific settings found in WebSite entity
+####
+
+# HTTPS Port (Secure port)
+port.https.enabled=Y
+port.https=8181
+force.https.host=
+
+# HTTP Port (Not Secure port)
+port.http=8080
+force.http.host=
+
+# Static Content URLs to make it easy to move the serving load for static content to other machines
+# -- thse are for general content such as images, js & css files, or non-dynamic HTML files
+content.url.prefix.secure=
+content.url.prefix.standard=
+
+# Here you can set the domain string to use for new cookies
+cookie.domain=
+
+# Exclude jsessionid for User-Agents (separated by comma's)
+link.remove_lsessionid.user_agent_list = googlebot,yahoo,msnbot
+
+# Should HTTP parameters sent to services require encryption?
+# This is generally advised for more secure webapps as it makes it more difficult to spoof requests (XSRF) that change data. 
+service.http.parameters.require.encrypted=Y