NIHVIVO-3721 Improve the build process for OpenSocial, including an Ant script to set up the config files.
This commit is contained in:
parent
0324d89561
commit
7095f0ea09
3 changed files with 219 additions and 13 deletions
198
opensocial/build_orng.xml
Normal file
198
opensocial/build_orng.xml
Normal file
|
@ -0,0 +1,198 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<!-- ======================================================================
|
||||||
|
Build script for the ORNG Shindig webapp.
|
||||||
|
|
||||||
|
This can be used on its own, or invoked from the "orng" target of the main build file.
|
||||||
|
====================================================================== -->
|
||||||
|
|
||||||
|
<project name="ORNG-shindig" default="describe">
|
||||||
|
|
||||||
|
<!-- =================================
|
||||||
|
target: describe
|
||||||
|
================================= -->
|
||||||
|
<target name="describe" description="--> Describe the targets (this is the default).">
|
||||||
|
<echo>
|
||||||
|
all - Runs "clean", then "deploy".
|
||||||
|
clean - Delete all artifacts so the next build will be from scratch.
|
||||||
|
deploy - Configure the application and deploy directly into the Tomcat webapps directory.
|
||||||
|
</echo>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- =================================
|
||||||
|
target: all
|
||||||
|
================================= -->
|
||||||
|
<target name="all" depends="clean, deploy" description="--> Run 'clean', then 'deploy'" />
|
||||||
|
|
||||||
|
<!-- - - - - - - - - - - - - - - - - -
|
||||||
|
target: properties
|
||||||
|
- - - - - - - - - - - - - - - - - -->
|
||||||
|
<target name="properties">
|
||||||
|
<property name="deploy.properties.file" location="../webapp/config/deploy.properties" />
|
||||||
|
|
||||||
|
<fail message="You must create a "${deploy.properties.file}" file.">
|
||||||
|
<condition>
|
||||||
|
<not>
|
||||||
|
<available file="${deploy.properties.file}" />
|
||||||
|
</not>
|
||||||
|
</condition>
|
||||||
|
</fail>
|
||||||
|
|
||||||
|
<property file="${deploy.properties.file}" />
|
||||||
|
|
||||||
|
<fail unless="tomcat.home" message="${deploy.properties.file} must contain a value for tomcat.home" />
|
||||||
|
<fail unless="vitro.home.directory" message="${deploy.properties.file} must contain a value for vitro.home.directory" />
|
||||||
|
<fail unless="VitroConnection.DataSource.url" message="${deploy.properties.file} must contain a value for VitroConnection.DataSource.url" />
|
||||||
|
<fail unless="VitroConnection.DataSource.username" message="${deploy.properties.file} must contain a value for VitroConnection.DataSource.username" />
|
||||||
|
<fail unless="VitroConnection.DataSource.password" message="${deploy.properties.file} must contain a value for VitroConnection.DataSource.password" />
|
||||||
|
<fail unless="VitroConnection.DataSource.driver" message="${deploy.properties.file} must contain a value for VitroConnection.DataSource.driver" />
|
||||||
|
<fail unless="OpenSocial.shindigURL" message="${deploy.properties.file} must contain a value for OpenSocial.shindigURL" />
|
||||||
|
<fail unless="OpenSocial.tokenService" message="${deploy.properties.file} must contain a value for OpenSocial.tokenService" />
|
||||||
|
<fail unless="OpenSocial.tokenKeyFile" message="${deploy.properties.file} must contain a value for OpenSocial.tokenKeyFile" />
|
||||||
|
|
||||||
|
<fail message="The vitro.home.directory "${vitro.home.directory}" does not exist.">
|
||||||
|
<condition>
|
||||||
|
<not>
|
||||||
|
<available file="${vitro.home.directory}" />
|
||||||
|
</not>
|
||||||
|
</condition>
|
||||||
|
</fail>
|
||||||
|
|
||||||
|
<fail message="The vitro.home.directory "${vitro.home.directory}" is not writable.">
|
||||||
|
<condition>
|
||||||
|
<not>
|
||||||
|
<isfileselected file="${vitro.home.directory}">
|
||||||
|
<writable />
|
||||||
|
</isfileselected>
|
||||||
|
</not>
|
||||||
|
</condition>
|
||||||
|
</fail>
|
||||||
|
|
||||||
|
<fail message="The Shindig token key file "${OpenSocial.tokenKeyFile}" does not exist.">
|
||||||
|
<condition>
|
||||||
|
<not>
|
||||||
|
<available file="${OpenSocial.tokenKeyFile}" />
|
||||||
|
</not>
|
||||||
|
</condition>
|
||||||
|
</fail>
|
||||||
|
|
||||||
|
<!-- build directories -->
|
||||||
|
<property name="build.dir" location="./build" />
|
||||||
|
<property name="build.shindig.dir" location="${build.dir}/shindig" />
|
||||||
|
|
||||||
|
<!-- deploy directories -->
|
||||||
|
<property name="shindig.home.dir" location="${vitro.home.directory}/shindig" />
|
||||||
|
<property name="shindig.config.dir" location="${shindig.home.dir}/conf" />
|
||||||
|
<property name="tomcat.webapps.dir" location="${tomcat.home}/webapps" />
|
||||||
|
|
||||||
|
<!-- the Shindig WAR -->
|
||||||
|
<property name="shindig.war.original.file" location="./shindigorng.war" />
|
||||||
|
<property name="shindig.war.unpacked.dir" location="${build.shindig.dir}/war" />
|
||||||
|
<property name="shindig.war.modified.file" location="${build.shindig.dir}/shindigorng.war" />
|
||||||
|
<property name="shindig.war.deployed.file" location="${tomcat.webapps.dir}/shindigorng.war" />
|
||||||
|
|
||||||
|
<!-- the Shindig-ORNG connector JAR -->
|
||||||
|
<property name="shindig.connector.prefix" value="/WEB-INF/lib" />
|
||||||
|
<property name="shindig.connector.original.file" location="${shindig.war.unpacked.dir}/${shindig.connector.prefix}/shindig-orng-connector-2.0.2.jar" />
|
||||||
|
<property name="shindig.connector.unpacked.dir" location="${build.shindig.dir}/connector" />
|
||||||
|
<property name="shindig.connector.modified.file" location="${build.shindig.dir}/shindig-orng-connector-2.0.2.jar" />
|
||||||
|
|
||||||
|
<!-- the Shindig-ORNG connector configuration file -->
|
||||||
|
<property name="shindig.js.original.file" location="${shindig.connector.unpacked.dir}/orng-container.js" />
|
||||||
|
<property name="shindig.js.modified.file" location="${build.shindig.dir}/orng-container.js" />
|
||||||
|
<property name="shindig.js.deployed.file" location="${shindig.config.dir}/orng-container.js" />
|
||||||
|
|
||||||
|
<!-- Shindig properties file -->
|
||||||
|
<property name="shindig.properties.template.file" location="${basedir}/shindig.orng.properties.template" />
|
||||||
|
<property name="shindig.properties.modified.file" location="${build.shindig.dir}/shindig.orng.properties" />
|
||||||
|
<property name="shindig.properties.deployed.file" location="${shindig.config.dir}/shindig.orng.properties" />
|
||||||
|
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- =================================
|
||||||
|
target: clean
|
||||||
|
================================= -->
|
||||||
|
<target name="clean" depends="properties" description="--> Delete all artifacts">
|
||||||
|
<delete includeemptydirs="true">
|
||||||
|
<fileset dir="${build.shindig.dir}" />
|
||||||
|
</delete>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- - - - - - - - - - - - - - - - - -
|
||||||
|
target: prepare
|
||||||
|
- - - - - - - - - - - - - - - - - -->
|
||||||
|
<target name="prepare" depends="properties">
|
||||||
|
<mkdir dir="${build.dir}" />
|
||||||
|
<mkdir dir="${build.shindig.dir}" />
|
||||||
|
|
||||||
|
<mkdir dir="${shindig.war.unpacked.dir}" />
|
||||||
|
<mkdir dir="${shindig.connector.unpacked.dir}" />
|
||||||
|
|
||||||
|
<mkdir dir="${shindig.home.dir}" />
|
||||||
|
<mkdir dir="${shindig.config.dir}" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- - - - - - - - - - - - - - - - - -
|
||||||
|
target: removeConnectorConfigFromWar
|
||||||
|
|
||||||
|
Unpack the war.
|
||||||
|
Unpack the JAR.
|
||||||
|
Create a new JAR that doesn't include the config file
|
||||||
|
Create a new WAR that includes the modified JAR.
|
||||||
|
- - - - - - - - - - - - - - - - - -->
|
||||||
|
<target name="removeConnectorConfigFromWar" depends="properties, prepare">
|
||||||
|
<unwar src="${shindig.war.original.file}" dest="${shindig.war.unpacked.dir}" />
|
||||||
|
<unwar src="${shindig.connector.original.file}" dest="${shindig.connector.unpacked.dir}" />
|
||||||
|
<zip destfile="${shindig.connector.modified.file}">
|
||||||
|
<zipfileset src="${shindig.connector.original.file}" excludes="orng-container.js" />
|
||||||
|
</zip>
|
||||||
|
<zip destfile="${shindig.war.modified.file}">
|
||||||
|
<fileset dir="${shindig.war.unpacked.dir}" excludes="**/shindig-orng-connector-2.0.2.jar" />
|
||||||
|
<zipfileset fullpath="WEB-INF/lib/shindig-orng-connector-2.0.2.jar" dir="${build.shindig.dir}" includes="shindig-orng-connector-2.0.2.jar" />
|
||||||
|
</zip>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- - - - - - - - - - - - - - - - - -
|
||||||
|
target: modifyConnectorConfig
|
||||||
|
|
||||||
|
Get the config file from the unpacked connector WAR and JAR, and make a modified copy.
|
||||||
|
- - - - - - - - - - - - - - - - - -->
|
||||||
|
<target name="modifyConnectorConfig" depends="removeConnectorConfigFromWar">
|
||||||
|
<copy file="${shindig.js.original.file}" tofile="${shindig.js.modified.file}">
|
||||||
|
<filterchain>
|
||||||
|
<tokenfilter>
|
||||||
|
<replacestring from="/shindig/openssl/securitytokenkey.txt" to="${OpenSocial.tokenKeyFile}" />
|
||||||
|
</tokenfilter>
|
||||||
|
</filterchain>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- - - - - - - - - - - - - - - - - -
|
||||||
|
target: modifyPropertiesFile
|
||||||
|
- - - - - - - - - - - - - - - - - -->
|
||||||
|
<target name="modifyPropertiesFile" depends="properties, prepare">
|
||||||
|
<copy file="${shindig.properties.template.file}" toFile="${shindig.properties.modified.file}">
|
||||||
|
<filterset>
|
||||||
|
<filter token="TOKEN_KEY_FILE" value="${OpenSocial.tokenKeyFile}" />
|
||||||
|
<filter token="DATA_SOURCE_URL" value="${VitroConnection.DataSource.url}" />
|
||||||
|
<filter token="DATA_SOURCE_USERNAME" value="${VitroConnection.DataSource.username}" />
|
||||||
|
<filter token="DATA_SOURCE_PASSWORD" value="${VitroConnection.DataSource.password}" />
|
||||||
|
<filter token="DATA_SOURCE_DRIVER" value="${VitroConnection.DataSource.driver}" />
|
||||||
|
</filterset>
|
||||||
|
</copy>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<!-- =================================
|
||||||
|
target: deploy
|
||||||
|
================================= -->
|
||||||
|
<target name="deploy" depends="modifyPropertiesFile, removeConnectorConfigFromWar, modifyConnectorConfig" description="--> Deploy the application directly into the Tomcat webapps directory.">
|
||||||
|
<copy file="${shindig.js.modified.file}" tofile="${shindig.js.deployed.file}" />
|
||||||
|
<copy file="${shindig.properties.modified.file}" tofile="${shindig.properties.deployed.file}" />
|
||||||
|
<copy file="${shindig.war.modified.file}" tofile="${shindig.war.deployed.file}" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
|
@ -157,7 +157,7 @@ shindig.json-rpc.result-field=result
|
||||||
shindig.accelerate.remapInternalServerError=true
|
shindig.accelerate.remapInternalServerError=true
|
||||||
shindig.proxy.remapInternalServerError=true
|
shindig.proxy.remapInternalServerError=true
|
||||||
|
|
||||||
shindig.signing.key-file=/shindig/openssl/oauthkey.pem
|
shindig.signing.key-file=@TOKEN_KEY_FILE@
|
||||||
shindig.signing.key-name=
|
shindig.signing.key-name=
|
||||||
|
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
@ -172,10 +172,10 @@ orng.system = VIVO
|
||||||
|
|
||||||
# orng.dbDriver is likely com.microsoft.sqlserver.jdbc.SQLServerDriver for Profiles and com.mysql.jdbc.Driver for VIVO
|
# orng.dbDriver is likely com.microsoft.sqlserver.jdbc.SQLServerDriver for Profiles and com.mysql.jdbc.Driver for VIVO
|
||||||
#orng.dbDriver = com.microsoft.sqlserver.jdbc.SQLServerDriver
|
#orng.dbDriver = com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||||
orng.dbDriver = com.mysql.jdbc.Driver
|
orng.dbDriver = @DATA_SOURCE_DRIVER@
|
||||||
orng.dbURL = jdbc:mysql://localhost/vitrodb
|
orng.dbURL = @DATA_SOURCE_URL@
|
||||||
orng.dbUser = vitrodb
|
orng.dbUser = @DATA_SOURCE_USERNAME@
|
||||||
orng.dbPassword = vitrodb
|
orng.dbPassword = @DATA_SOURCE_PASSWORD@
|
||||||
orng.tokenservice.port = 8777
|
orng.tokenservice.port = 8777
|
||||||
# orng.RDFConverter = elda | babel
|
# orng.RDFConverter = elda | babel
|
||||||
orng.RDFConverter = elda
|
orng.RDFConverter = elda
|
|
@ -74,6 +74,7 @@
|
||||||
all - Runs "clean", then "deploy".
|
all - Runs "clean", then "deploy".
|
||||||
clean - Delete all artifacts so the next build will be from scratch.
|
clean - Delete all artifacts so the next build will be from scratch.
|
||||||
compile - Compile the Java source files.
|
compile - Compile the Java source files.
|
||||||
|
orng - Configure and deploy the ORNG Shindig application.
|
||||||
test - Compile and run the JUnit tests.
|
test - Compile and run the JUnit tests.
|
||||||
war - Create a WAR file to be deployed in a servlet container.
|
war - Create a WAR file to be deployed in a servlet container.
|
||||||
deploy - Deploy the application directly into the Tomcat webapps directory.
|
deploy - Deploy the application directly into the Tomcat webapps directory.
|
||||||
|
@ -117,13 +118,13 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
|
||||||
</fail>
|
</fail>
|
||||||
|
|
||||||
<fail message="The vitro.home.directory "${vitro.home.directory}" is not writable.">
|
<fail message="The vitro.home.directory "${vitro.home.directory}" is not writable.">
|
||||||
<condition>
|
<condition>
|
||||||
<not>
|
<not>
|
||||||
<isfileselected file="${vitro.home.directory}" >
|
<isfileselected file="${vitro.home.directory}">
|
||||||
<writable/>
|
<writable />
|
||||||
</isfileselected>
|
</isfileselected>
|
||||||
</not>
|
</not>
|
||||||
</condition>
|
</condition>
|
||||||
</fail>
|
</fail>
|
||||||
|
|
||||||
<property name="solr.home.dir" location="${vitro.home.directory}/solr" />
|
<property name="solr.home.dir" location="${vitro.home.directory}/solr" />
|
||||||
|
@ -356,6 +357,13 @@ deploy - Deploy the application directly into the Tomcat webapps directory.
|
||||||
</java>
|
</java>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<!-- =================================
|
||||||
|
target: orng
|
||||||
|
================================= -->
|
||||||
|
<target name="orng" description="Configure and deploy the ORNG Shindig application">
|
||||||
|
<ant dir="${corebase.dir}/../opensocial" antfile="build_orng.xml" target="all" />
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
MACROS
|
MACROS
|
||||||
|
|
Loading…
Add table
Reference in a new issue