Skip to content

Add Coherence Dockerfiles and scripts #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions OracleCoherence/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fmw_12.1.3.0.0_coherence_Disk1_1of1.zip
jdk-8u25-linux-x64.rpm
89 changes: 89 additions & 0 deletions OracleCoherence/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# LICENSE CDDL 1.0 + GPL 2.0
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This is the Dockerfile for Coherence 12.1.3 Standalone Distribution
#
# REQUIRED BASE IMAGE TO BUILD THIS IMAGE
# ---------------------------------------
# Visit for more info:
# - https://registry.hub.docker.com/_/oraclelinux/
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
# (1) fmw_12.1.3.0.0_coherence_Disk1_1of1.zip
# Download the Standalone installer from http://www.oracle.com/technetwork/middleware/coherence/downloads/index.html
#
# (2) jdk-8u25-linux-x64.rpm
# Download from http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
#
# HOW TO BUILD THIS IMAGE
# -----------------------
# Put all downloaded files in the same directory as this Dockerfile
# Run:
# $ sudo sh build.sh
#

# Pull base image
# ---------------
FROM oraclelinux:7

# Maintainer
# ----------
MAINTAINER Bruno Borges <bruno.borges@oracle.com>

# Environment variables required for this build (do NOT change)
ENV JAVA_RPM jdk-8u25-linux-x64.rpm
ENV FMW_PKG fmw_12.1.3.0.0_coherence_Disk1_1of1.zip
ENV FMW_JAR fmw_12.1.3.0.0_coherence.jar
ENV FMW_DIR coherence12130
ENV COHERENCE_HOME /u01/$FMW_DIR/coherence

# Install and configure Oracle JDK 8u25
# -------------------------------------
COPY config/$JAVA_RPM /root/
RUN rpm -i /root/$JAVA_RPM && rm /root/$JAVA_RPM
ENV JAVA_HOME /usr/java/default
ENV CONFIG_JVM_ARGS -Djava.security.egd=file:/dev/./urandom

# Setup required packages (unzip), filesystem, and oracle user
# ------------------------------------------------------------
RUN yum install -y unzip && \
mkdir /u01 && chmod a+xr /u01 && \
useradd -b /u01 -m -s /bin/bash oracle && \
echo oracle:oracle | chpasswd

# Copy files required to build this image
COPY config/$FMW_PKG /u01/
COPY config/oraInst.loc /u01/oraInst.loc
COPY config/install.file /u01/install.file

WORKDIR /u01
RUN chown oracle:oracle -R /u01
USER oracle

# Installation of Coherence
RUN unzip /u01/$FMW_PKG -d /u01/oracle/ > /dev/null && \
rm $FMW_PKG && \
mkdir /u01/oracle/.inventory

WORKDIR /u01/oracle

RUN java -jar $FMW_JAR -silent -responseFile /u01/install.file -invPtrLoc /u01/oraInst.loc -jreLoc $JAVA_HOME && \
rm $FMW_JAR && \
ln -s /u01/oracle/$FMW_DIR /u01/oracle/coherence

WORKDIR /u01/oracle/$FMW_DIR

# Cleanup
USER root
RUN rm /u01/oraInst.loc /u01/install.file && \
yum erase -y unzip && \
yum clean all

VOLUME /u01/oracle/coherence_config

USER oracle

# Define default command to start bash.
CMD ["bash"]
3 changes: 3 additions & 0 deletions OracleCoherence/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Unless otherwise noted, all files in this distribution are released
under the Common Development and Distribution License (CDDL) 1.0
and GNU Public License 2.0 licenses.
57 changes: 57 additions & 0 deletions OracleCoherence/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Oracle Coherence 12c Docker Image

This is a Dockerfile for [Oracle Coherence 12c](http://www.oracle.com/technetwork/middleware/coherence/overview/index.html). The purpose of this Docker container is to facilitate the setup of development and integration testing environments for developers.

This image uses the Standalone Distribution of Coherence 12c.

**IMPORTANT**: Oracle **does not support Coherence on Docker**, including but not limited to Development, Integration, and Production environments.

## Oracle Linux Base Image
For more information and documentation, read the [Docker Images from Oracle Linux](https://registry.hub.docker.com/_/oraclelinux/) page.

### Standalone Distribution
Fore more information on the Coherence 12c Standalone Distribution, visit [Coherence 12.1.3 Documentation](http://docs.oracle.com/middleware/1213/coherence/index.html).

## How to Build

Follow this procedure:

1. Checkout the GitHub weblogic-docker repository

$ git checkout git@github.com:oracle/docker-images.git

2. Go to the **OracleCoherence** folder

$ cd OracleCoherence

3. [Download](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) and drop the Oracle JDK 8u25 RPM 64bit file **jdk-8u25-linux-x64.rpm** in this folder

Linux x64 135.6 MB jdk-8u25-linux-x64.rpm

4. [Download](http://www.oracle.com/technetwork/middleware/coherence/downloads/index.html) and drop the Coherence 12c Standalone Distribution file **fmw_12.1.3.0.0_coherence_Disk1_1of1.zip** in this folder

Coherence Stand-Alone Install (87 MB) - fmw_12.1.3.0.0_coherence_Disk1_1of1.zip

5. Execute the build script as **root**

$ sudo sh buildDockerImage.sh

## Booting up Oracle Coherence 12c on Docker

Along with the Dockerfile, two scripts are also provided to help you run Cache Servers, and the Coherence Console (without local storage).

Start a CacheServer:
$ sudo sh dockCacheServer.sh [fullpath dir w/ tangosol-coherence-override.xml and cache configs]

Start Coherence Console:
$ sudo sh dockCoherenceConsole.sh [fullpath dir w/ tangosol-coherence-override.xml and cache configs]

## Issues
If you find any issues with this Docker project, please report through the [GitHub Issues page](https://github.com/oracle/docker-images/issues).

## License
To download and run Coherence 12c Distribution regardless of inside or outside a Docker container, and regardless of which distribution, you must agree and accept the [OTN Standard License Terms](http://www.oracle.com/technetwork/licenses/standard-license-152015.html).

To download and run Oracle JDK regardless of inside or outside a Docker container, you must agree and accept the [Oracle Binary Code License Agreement for Java SE](http://www.oracle.com/technetwork/java/javase/terms/license/index.html).

All scripts and files hosted in this project on GitHub [docker-images/OracleCoherence](https://github.com/oracle/docker-images/OracleCoherence) repository required to build the Docker images are, unless otherwise noted, released under the Common Development and Distribution License (CDDL) 1.0 and GNU Public License 2.0 licenses, except for the files listed above with their specific licenses.
61 changes: 61 additions & 0 deletions OracleCoherence/bin/buildDockerImage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
DOCKING="false"
SCRIPTS_DIR="$( cd "$( dirname "$0" )" && pwd )"
. $SCRIPTS_DIR/setDockerEnv.sh

cd $SCRIPTS_DIR/..

JAVA_VERSION="8u25"
JAVA_PKG="config/jdk-${JAVA_VERSION}-linux-x64.rpm"
JAVA_PKG_MD5="6a8897b5d92e5850ef3458aa89a5e9d7"
FMW_PKG="config/fmw_12.1.3.0.0_coherence_Disk1_1of1.zip"
FMW_PKG_MD5="a4affba654a0664284e6a454341f3e93"

# Validate Java Package
echo "====================="

if [ ! -e $JAVA_PKG ]
then
echo "Download the Oracle JDK ${JAVA_VERSION} RPM for 64 bit and"
echo "drop the file $JAVA_PKG in this folder before"
echo "building this image!"
exit
fi

MD5="$JAVA_PKG_MD5 $JAVA_PKG"
MD5_CHECK="`md5sum $JAVA_PKG`"

if [ "$MD5" != "$MD5_CHECK" ]
then
echo "MD5 for $JAVA_PKG does not match! Download again!"
exit
fi

#
# Validate FMW Package
echo "====================="

if [ ! -e $FMW_PKG ]
then
echo "Download the Coherence 12c Standalone installer and"
echo "drop the file $FMW_PKG in this folder before"
echo "building this Coherence Docker image!"
exit
fi

MD5="$FMW_PKG_MD5 $FMW_PKG"
MD5_CHECK="`md5sum $FMW_PKG`"

if [ "$MD5" != "$MD5_CHECK" ]
then
echo "MD5 for $FMW_PKG does not match! Download again!"
exit
fi

echo "====================="

docker build -t $DOCKER_IMAGE_NAME .

echo ""
echo "Coherence Docker Container is ready to be used. To start, run 'dockCacheServer.sh -h'"

12 changes: 12 additions & 0 deletions OracleCoherence/bin/dockCacheServer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

SCRIPTS_DIR="$( cd "$( dirname "$0" )" && pwd )"
. $SCRIPTS_DIR/setDockerEnv.sh $*

# RUN THE DOCKER COMMAND
docker run -d \
--net=host \
-v $1:/u01/oracle/coherence_config \
$DOCKER_IMAGE_NAME java -cp /u01/oracle/coherence_config:/u01/oracle/coherence/coherence/lib/coherence.jar \
com.tangosol.net.DefaultCacheServer

12 changes: 12 additions & 0 deletions OracleCoherence/bin/dockCoherenceConsole.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh

SCRIPTS_DIR="$( cd "$( dirname "$0" )" && pwd )"
. $SCRIPTS_DIR/setDockerEnv.sh $*

# RUN THE DOCKER COMMAND
docker run -ti \
--net=host \
-v $1:/u01/oracle/coherence_config \
$DOCKER_IMAGE_NAME java -cp /u01/oracle/coherence_config:/u01/oracle/coherence/coherence/lib/coherence.jar \
-Dtangosol.coherence.distributed.localstorage=false com.tangosol.net.CacheFactory

20 changes: 20 additions & 0 deletions OracleCoherence/bin/setDockerEnv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
DOCKER_IMAGE_NAME="oracle/coherence:12.1.3"

SCRIPTS_DIR="$( cd "$( dirname "$0" )" && pwd )"

if [ "$1" = "" ] || [ "$1" = "-h" ]; then
MAY_SHOW_USAGE="true"
fi

if [ "$DOCKING" != "false" ] && [ "$MAY_SHOW_USAGE" = "true" ]; then
echo ""
echo "Oracle Coherence 12c on Docker"
echo "------------------------------"
echo "Usage: $0 <full-path-cache-config-folder>"
echo ""
echo "You must point a folder containing 'tangosol-coherence-override.xml' and your Cache configuration files."
echo "Example: # $0 $SCRIPTS_DIR/../example-grid"
echo ""
exit 0
fi
Empty file.
12 changes: 12 additions & 0 deletions OracleCoherence/config/install.file
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[ENGINE]

#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0

[GENERIC]

#The oracle home location. This can be an existing Oracle Home or a new Oracle Home
ORACLE_HOME=/u01/oracle/coherence12130

#Set this variable value to the Installation Type selected. e.g. Typical, Typical With Examples.
INSTALL_TYPE=Typical With Examples
1 change: 1 addition & 0 deletions OracleCoherence/config/jdk-8u25-linux-x64.rpm.download
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Download this package from Oracle.
2 changes: 2 additions & 0 deletions OracleCoherence/config/oraInst.loc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
inventory_loc=/u01/oracle/.inventory
inst_group=oracle
5 changes: 5 additions & 0 deletions OracleCoherence/example-grid/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Coherence Example Grid for Docker
==============
These files were extracted from the Coherence 12.1.3 documentation.

[4 Building Your First Coherence Application](https://docs.oracle.com/middleware/1213/coherence/develop-applications/gs_example.htm#COHDG5039)
23 changes: 23 additions & 0 deletions OracleCoherence/example-grid/example-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0"?>

<cache-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.oracle.com/coherence/coherence-cache-config"
xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-cache-config coherence-cache-config.xsd">
<caching-scheme-mapping>
<cache-mapping>
<cache-name>hello-example</cache-name>
<scheme-name>distributed</scheme-name>
</cache-mapping>
</caching-scheme-mapping>

<caching-schemes>
<distributed-scheme>
<scheme-name>distributed</scheme-name>
<service-name>DistributedCache</service-name>
<backing-map-scheme>
<local-scheme/>
</backing-map-scheme>
<autostart>true</autostart>
</distributed-scheme>
</caching-schemes>
</cache-config>
26 changes: 26 additions & 0 deletions OracleCoherence/example-grid/tangosol-coherence-override.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version='1.0'?>

<coherence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.oracle.com/coherence/coherence-operational-config"
xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-operational-config coherence-operational-config.xsd">
<cluster-config>
<member-identity>
<cluster-name>example-cluster</cluster-name>
</member-identity>

<multicast-listener>
<address>224.3.6.0</address>
<port>9999</port>
<time-to-live>0</time-to-live>
</multicast-listener>
</cluster-config>

<configurable-cache-factory-config>
<init-params>
<init-param>
<param-type>java.lang.String</param-type>
<param-value system-property="tangosol.coherence.cacheconfig">example-config.xml</param-value>
</init-param>
</init-params>
</configurable-cache-factory-config>
</coherence>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Download Oracle Coherence Standalone from http://www.oracle.com/technetwork/middleware/coherence/downloads/index.html and drop the file fmw_12.1.3.0.0_coherence_Disk1_1of1.zip in this folder
1 change: 1 addition & 0 deletions OracleCoherence/jdk-8u25-linux-x64.rpm.download
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Download this package from Oracle.