Skip to content

Commit

Permalink
Merge branch 'dev' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
rachel-orti committed Dec 6, 2017
2 parents 229b24b + 9052bcc commit f95aa66
Show file tree
Hide file tree
Showing 31 changed files with 256 additions and 78 deletions.
1 change: 1 addition & 0 deletions common/DO_NOT_REMOVE_DRIVERS_FOLDER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The `drivers` folder is used to add additional drivers. These drivers will be copied to the `/config/resources` folder of the ODM Docker images at build time.
4 changes: 4 additions & 0 deletions common/drivers/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
1 change: 1 addition & 0 deletions common/script/installDerby.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

# Install the driver for Derby
echo "Install the driver for Derby"
wget -nv http://central.maven.org/maven2/org/apache/derby/derbyclient/10.12.1.1/derbyclient-10.12.1.1.jar
mv derby* /config/resources
1 change: 1 addition & 0 deletions common/script/installMySQL.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

# Install the driver for MySQL
echo "Install the driver for MySQL"
wget -nv http://central.maven.org/maven2/mysql/mysql-connector-java/5.1.22/mysql-connector-java-5.1.22.jar
mv mysql* /config/resources
3 changes: 2 additions & 1 deletion common/script/installPostgres.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

# Install the driver for PostgreSQL
wget -nv https://jdbc.postgresql.org/download/postgresql-9.3-1104.jdbc4.jar
echo "Install the driver for postgreSQL"
wget -nv https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar
mv postgres* /config/resources
2 changes: 1 addition & 1 deletion databases/derby/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ MAINTAINER ODMDev odmdev_open_source_user@wwpdl.vnet.ibm.com, Laurent GRATEAU <l
ENV DERBY_INSTALL=/db-derby-10.12.1.1-bin
ENV DERBY_HOME=/db-derby-10.12.1.1-bin
ENV CLASSPATH=/$DERBY_INSTALL/lib/derby.jar:$DERBY_INSTALL/lib/derbytools.jar:.
ENV DOWNLOAD http://wwwftp.ciril.fr/pub/apache//db/derby/db-derby-10.12.1.1/db-derby-10.12.1.1-bin.tar.gz
ENV DOWNLOAD=http://archive.apache.org/dist/db/derby/db-derby-10.12.1.1/db-derby-10.12.1.1-bin.tar.gz
ENV DERBY_INSTALL=/opt/db-derby-10.12.1.1-bin
ENV CLASSPATH=/$DERBY_INSTALL/lib/derby.jar:$DERBY_INSTALL/lib/derbytools.jar:.

Expand Down
Binary file modified databases/derby/data.tar.gz
Binary file not shown.
Binary file modified databases/postgresql/data.tar.gz
Binary file not shown.
4 changes: 2 additions & 2 deletions decisioncenter/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ MAINTAINER ODMDev odmdev_open_source_user@wwpdl.vnet.ibm.com, Laurent GRATEAU <l
ENV APP_NAME DecisionCenter
ENV ODMDOCKERDIR $ODMDOCKERDIR
ENV SCRIPT /script
ENV DC_PERSISTENCE_LOCALE en_US

RUN mkdir /config/resources && \
mkdir -p $SCRIPT
Expand All @@ -18,13 +17,14 @@ COPY $ODMDOCKERDIR/decisioncenter/config /config
COPY $ODMDOCKERDIR/common/security /config/resources/security
COPY $ODMDOCKERDIR/decisioncenter/script $SCRIPT
COPY $ODMDOCKERDIR/common/script $SCRIPT
COPY $ODMDOCKERDIR/common/drivers /config/resources

COPY ./teamserver/applicationservers/WLP855/teamserver.war /config/apps/
COPY ./teamserver/applicationservers/WLP855/decisioncenter*.war /config/apps/

RUN chmod -R a+x $SCRIPT && \
sync && \
$SCRIPT/installPostgres.sh && \
if [ ! -f /config/resources/postgres* ]; then $SCRIPT/installPostgres.sh; fi && \
mkdir -p /config/apps/extract && \
cd /config/apps/extract && \
unzip -q ../decisioncenter.war && \
Expand Down
26 changes: 26 additions & 0 deletions decisioncenter/config/datasource-db2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<server>
<!-- decision center datasource -->
<library id="DB2Lib">
<fileset dir="${server.config.dir}/resources"/>
</library>

<jdbcDriver id="DB2Driver" libraryRef="DB2Lib"/>
<dataSource id="dcdatasource"
isolationLevel="TRANSACTION_READ_COMMITTED"
jndiName="jdbc/ilogDataSource"
statementCacheSize="150"
jdbcDriverRef="DB2Driver">
<connectionManager
maxPoolSize="25"
minPoolSize="10"
connectionTimout="10s"
agedTimeout="30m"/>
<properties.db2.jcc
databaseName="odmdb"
user="odmusr"
password="odmpwd"
serverName="dbserver"
portNumber="50000"/>
</dataSource>

</server>
6 changes: 3 additions & 3 deletions decisioncenter/config/datasource-derby.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
minPoolSize="10"
connectionTimout="10s"
agedTimeout="30m"/>
<properties.derby.client databaseName="rtsdb"
<properties.derby.client databaseName="odmdb"
serverName="dbserver"
portNumber="1527"
createDatabase="create"
user="ilog"
password="ilog" />
user="odmusr"
password="odmpwd" />
</dataSource>
</server>
14 changes: 10 additions & 4 deletions decisioncenter/config/datasource-mysql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@
<fileset dir="${server.config.dir}/resources"/>
</library>

<jdbcDriver id="MySQLDriver" libraryRef="MySQLLib"/>
<jdbcDriver id="MySQLDriver"
javax.sql.ConnectionPoolDataSource="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"
javax.sql.DataSource="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
javax.sql.XADataSource="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"
libraryRef="MySQLLib"/>

<dataSource id="dcdatasource"
isolationLevel="TRANSACTION_READ_COMMITTED"
jndiName="jdbc/ilogDataSource"
statementCacheSize="150"
jdbcDriverRef="MySQLDriver">
jdbcDriverRef="MySQLDriver"
type="javax.sql.ConnectionPoolDataSource">
<connectionManager
maxPoolSize="25"
minPoolSize="10"
connectionTimout="10s"
agedTimeout="30m"/>
<properties databaseName="odmdb"
user="odm"
password="odm"
user="odmusr"
password="odmpwd"
serverName="dbserver"
portNumber="3306"/>
</dataSource>
Expand Down
7 changes: 4 additions & 3 deletions decisioncenter/config/datasource-postgres.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@
-->
<properties
databaseName="odmdb"
user="odm"
password="odm"
user="odmusr"
password="odmpwd"
portNumber="5432"
serverName="dbserver" />
</dataSource>

<jdbcDriver id="postgresql-driver"
javax.sql.XADataSource="org.postgresql.xa.PGXADataSource"
javax.sql.ConnectionPoolDataSource="org.postgresql.ds.PGConnectionPoolDataSource"
javax.sql.XADataSource="org.postgresql.xa.PGXADataSource"

libraryRef="postgresql-library"/>

<library id="postgresql-library">
Expand Down
54 changes: 42 additions & 12 deletions decisioncenter/script/rundc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ fi

if [ -n "$DC_PERSISTENCE_LOCALE" ]
then
sed -i 's|DC_PERSISTENCE_LOCALE|'$DC_PERSISTENCE_LOCALE'|g' /config/apps/decisioncenter.war/WEB-INF/classes/config/decisioncenter-configuration.properties
echo "use DC_PERSISTENCE_LOCALE set to $DC_PERSISTENCE_LOCALE"
sed -i 's|DC_PERSISTENCE_LOCALE|'$DC_PERSISTENCE_LOCALE'|g' /config/apps/decisioncenter.war/WEB-INF/classes/config/decisioncenter-configuration.properties
else
sed -i 's|DC_PERSISTENCE_LOCALE|'en_US'|g' /config/apps/decisioncenter.war/WEB-INF/classes/config/decisioncenter-configuration.properties
echo "no DC_PERSISTENCE_LOCALE set use default en_US"
sed -i 's|DC_PERSISTENCE_LOCALE|'en_US'|g' /config/apps/decisioncenter.war/WEB-INF/classes/config/decisioncenter-configuration.properties
fi

# Begin - Configuration for the user registry
Expand All @@ -34,36 +36,69 @@ then
echo "Use DB_DRIVER_URL: $DB_DRIVER_URL"
wget -nv $DB_DRIVER_URL
case $DB_DRIVER_URL in
*derby* ) mv derby* /config/resources
*derby* ) rm /config/resources/derby*
mv derby* /config/resources
cp /config/datasource-derby.xml /config/datasource.xml
;;
*mysql* ) mv mysql* /config/resources
*mysql* ) rm /config/resources/mysql*
mv mysql* /config/resources
cp /config/datasource-mysql.xml /config/datasource.xml
;;
*postgres* ) rm /config/resources/postgres*
mv postgres* /config/resources
cp /config/datasource-postgres.xml /config/datasource.xml
;;
*db2* ) rm /config/resources/db2*
mv db2* /config/resources
cp /config/datasource-db2.xml /config/datasource.xml
;;
esac
elif [ -n "$DB_TYPE" ]
then
echo "Use DB_TYPE: $DB_TYPE"
case $DB_TYPE in
*derby* ) /script/installDerby.sh
*derby* ) if [ ! -f /config/resources/derby* ]; then /script/installDerby.sh; fi
cp /config/datasource-derby.xml /config/datasource.xml
;;
*mysql* ) /script/installMySQL.sh
*mysql* ) if [ ! -f /config/resources/mysql* ]; then /script/installMySQL.sh; fi
cp /config/datasource-mysql.xml /config/datasource.xml
;;
# For postgreSQL, we do not have to install the driver here since it is installed by default at build time
*postgres* ) cp /config/datasource-postgres.xml /config/datasource.xml
;;
;;
# For DB2, we do not have to install the driver here since it is supposed to be provided through the drivers folder at build time
*db2* ) cp /config/datasource-db2.xml /config/datasource.xml
;;
esac
else
echo "Use PostgreSQL as database by default"
cp /config/datasource-postgres.xml /config/datasource.xml
fi
# End - Configuration for the database

# Begin - Change values for the datasource if required
if [ -n "$DB_SERVER_NAME" ]
then
sed -i 's|dbserver|'$DB_SERVER_NAME'|g' /config/datasource.xml
fi
if [ -n "$DB_PORT_NUMBER" ]
then
sed -i 's|5432|'$DB_PORT_NUMBER'|g' /config/datasource.xml
fi
if [ -n "$DB_NAME" ]
then
sed -i 's|odmdb|'$DB_NAME'|g' /config/datasource.xml
fi
if [ -n "$DB_USER" ]
then
sed -i 's|odmusr|'$DB_USER'|g' /config/datasource.xml
fi
if [ -n "$DB_PASSWORD" ]
then
sed -i 's|odmpwd|'$DB_PASSWORD'|g' /config/datasource.xml
fi
# End - Change values for the datasource if required

# Begin - Add DC Rest Api Web App
if [ -e /config/apps/decisioncenter-api.war ]
then
Expand All @@ -74,9 +109,4 @@ else
fi
# End - Add DC Rest Api Web App

if [ -n "$DBSERVER_NAME" ]
then
sed -i 's|dbserver|'$DBSERVER_NAME'|g' /config/datasource.xml
fi

/opt/ibm/docker/docker-server run defaultServer
13 changes: 13 additions & 0 deletions decisionserver/config/datasource-db2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<server>

<!-- decision server datasource -->
<library id="DB2Lib">
<fileset dir="${server.config.dir}/resources"/>
</library>

<jdbcDriver id="DB2Driver" libraryRef="DB2Lib"/>
<dataSource id="resdatasource" jndiName="jdbc/resdatasource" jdbcDriverRef="DB2Driver">
<properties.db2.jcc databaseName="odmdb" user="odmusr" password="odmpwd" serverName="dbserver" portNumber="50000" />
</dataSource>

</server>
4 changes: 2 additions & 2 deletions decisionserver/config/datasource-derby.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</library>
<jdbcDriver id="DerbyJdbcDriver" libraryRef="DerbyLib" />
<dataSource id="resdatasource" jndiName="jdbc/resdatasource" jdbcDriverRef="DerbyJdbcDriver">
<properties.derby.client databaseName="resdb" serverName="dbserver"
portNumber="1527" createDatabase="create" user="RES" password="RES" />
<properties.derby.client databaseName="odmdb" serverName="dbserver"
portNumber="1527" createDatabase="create" user="odmusr" password="odmpwd" />
</dataSource>
</server>
11 changes: 8 additions & 3 deletions decisionserver/config/datasource-mysql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@
<fileset dir="${server.config.dir}/resources"/>
</library>

<jdbcDriver id="MySQLDriver" libraryRef="MySQLLib"/>
<dataSource id="resdatasource" jndiName="jdbc/resdatasource" jdbcDriverRef="MySQLDriver">
<properties databaseName="odmdb" user="odm" password="odm" serverName="dbserver" portNumber="3306" />
<jdbcDriver id="MySQLDriver"
javax.sql.ConnectionPoolDataSource="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource"
javax.sql.DataSource="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
javax.sql.XADataSource="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource"
libraryRef="MySQLLib"/>

<dataSource id="resdatasource" jndiName="jdbc/resdatasource" jdbcDriverRef="MySQLDriver" type="javax.sql.ConnectionPoolDataSource">
<properties databaseName="odmdb" user="odmusr" password="odmpwd" serverName="dbserver" portNumber="3306" />
</dataSource>

</server>
6 changes: 3 additions & 3 deletions decisionserver/config/datasource-postgres.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
-->
<properties
databaseName="odmdb"
user="odm"
password="odm"
user="odmusr"
password="odmpwd"
portNumber="5432"
serverName="dbserver" />
</dataSource>

<jdbcDriver id="postgresql-driver"
javax.sql.XADataSource="org.postgresql.xa.PGXADataSource"
javax.sql.ConnectionPoolDataSource="org.postgresql.ds.PGConnectionPoolDataSource"
javax.sql.XADataSource="org.postgresql.xa.PGXADataSource"
libraryRef="postgresql-library"/>

<library id="postgresql-library">
Expand Down
3 changes: 2 additions & 1 deletion decisionserver/decisionrunner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ COPY $ODMDOCKERDIR/decisionserver/decisionrunner/config /config
COPY $ODMDOCKERDIR/decisionserver/decisionrunner/script $SCRIPT
COPY $ODMDOCKERDIR/common/security /config/resources/security
COPY $ODMDOCKERDIR/common/script $SCRIPT
COPY $ODMDOCKERDIR/common/drivers /config/resources

COPY ./executionserver/applicationservers/WLP855/DecisionRunner.war /config/apps/

RUN chmod -R a+x $SCRIPT && \
sync && \
$SCRIPT/installPostgres.sh && \
if [ ! -f /config/resources/postgres* ]; then $SCRIPT/installPostgres.sh; fi && \
cd /config/apps/extract && \
unzip -q ../DecisionRunner.war && \
cd ../ && \
Expand Down
Loading

0 comments on commit f95aa66

Please sign in to comment.