Skip to content

Commit

Permalink
Remove shading of coherence.jar (#26)
Browse files Browse the repository at this point in the history
* Remove shading of coherence.jar
* Add 21.06 to GitHub actions
* Update instructions for grid-edition
  • Loading branch information
tmiddlet2666 authored Jul 5, 2021
1 parent 64f638c commit b794d34
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 81 deletions.
1 change: 1 addition & 0 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- 20.12
- 20.12.1
- 20.12.2
- 21.06

steps:
- name: Checkout
Expand Down
49 changes: 23 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
## Overview

This document describes how to build and run the Coherence Demonstration application.
The application showcases Coherence gen
eral features, scalability capabilities including:
The application showcases Coherence general features, scalability capabilities including:

* Clustering and Data Sharding
* Scalability and High Availability
Expand All @@ -22,8 +21,9 @@ eral features, scalability capabilities including:
* Federation (Grid Edition feature only)
* Lambda Support
* OpenTracing Support

When you run the application locally, it results in a single self-contained JAR, javadoc and source.

You can run the application locally using `mvn exec:exec` or run on Kubernetes using the Coherence Operator. See the table
of contents below for instructions.

The demonstration uses AngularJS 1.7.5, Bootstrap 3.3.4, and a number of other frameworks. The UI interacts with Coherence using the REST API.

Expand Down Expand Up @@ -106,27 +106,20 @@ mvn clean install
The `target` directory contains a list of files:

```bash
coherence-demo-{version}-SNAPSHOT.jar - Executable JAR file, see instructions below
coherence-demo-{version}-SNAPSHOT-javadoc.jar - javadoc
coherence-demo-{version}-SNAPSHOT-sources.jar - sources
```

Run the JAR file in the `target` directory:
Run demo application

```bash
java -jar target/coherence-demo-4.0.1-SNAPSHOT.jar
mvn exec:exec
```

The following screenshot shows the application running with 5 cache servers started.

![Coherence Demo](assets/coherence-demo.png "Coherence Demo")

You can use the following to run the application with the `Metrics` endpoint enabled:

```bash
java -Dcoherence.metrics.http.enabled=true -jar target/coherence-demo-4.0.1-SNAPSHOT.jar
```

A Coherence Cache server and HTTP server are started on port 8080 for serving REST and application data. When the Cache server starts, the application loads on the default web browser at http://127.0.0.1:8080/application/index.html.

The following features are available to demonstrate in the application:
Expand All @@ -153,6 +146,14 @@ Federation Features - Grid Edition Only
To shut down the application, select **Shutdown** option from the **Tools** menu. This shuts down all the processes including the secondary cluster if started.

> **Note:** Secondary cluster will not form if you are running on a virtual private network due to security restrictions.

You can use the following to run the application with the `Metrics` endpoint enabled:

```bash
mvn -Dmetrics.enabled=true exec:exec
```

From the `Tools` menu choose `Show Raw Metrics` to view the raw metrics.

### Modify the Defaults

Expand All @@ -161,20 +162,11 @@ To shut down the application, select **Shutdown** option from the **Tools** menu
The default HTTP hostname is 127.0.0.1 and default port is 8080. To modify these you can add the `http.hostname` or `http.port` properties on startup:

```bash
java -Dhttp.hostname=myhostname -Dhttp.port=9000 -jar coherence-demo-4.0.1-SNAPSHOT.jar
mvn -Dhttp.hostname=myhostname -Dhttp.port=9000 exec:exec
```
By changing the `http.hostname` you can access the application outside of
your local machine.

**Default Cluster Names**

When starting up the application, the timezone is analyzed and default names are selected for the primary and secondary cluster (see [Launcher.java](https://github.com/coherence-community/coherence-demo/tree/master/src/main/java/com/oracle/coherence/demo/application/Launcher.java)). If you want to customize the name, do the following:

```bash
java -Dprimary.cluster=NewYork -Dsecondary.cluster=Boston -jar coherence-demo-4.0.1-SNAPSHOT.jar
```
If you want to use a cluster name with a space, you must enclose it in quotes.

## Run the Application on Kubernetes

The steps to run the application on Kubernetes comprises the following:
Expand Down Expand Up @@ -218,12 +210,12 @@ The steps to run the application on Kubernetes comprises the following:
mvn clean install -P docker
```

This creates an image named `coherence-demo:4.0.1-SNAPSHOT` which contains everything needed to run the demo.
This creates an image named `coherence-demo:5.0.0-SNAPSHOT` which contains everything needed to run the demo.

> Note: If you are running against a remote Kubernetes cluster, you need to push the Docker
> image to your repository accessible to that cluster. You also need to prefix the image name in the `yaml` files used in the `helm` commands below.
> Find your Docker image id with `docker images` and tag it with your prefix: `docker tag image youname/coherence-demo:4.0.1-SNAPSHOT` and
> them push using `docker push youname/coherence-demo:4.0.1-SNAPSHOT`.
> Find your Docker image id with `docker images` and tag it with your prefix: `docker tag image youname/coherence-demo:5.0.0-SNAPSHOT` and
> them push using `docker push youname/coherence-demo:5.0.0-SNAPSHOT`.

1. **Install the Oracle Coherence Operator**

Expand Down Expand Up @@ -532,6 +524,11 @@ mvn clean install -P grid-edition -Dcoherence.version=14.1.1-0-0
```

> **Note:** The `coherence.version` property must be set to your installed Coherence Grid Edition version.

Run the application using:
```bash
mvn exec:exec -Pgrid-edition -Dcoherence.version=14.1.1-0-0
```

## View Cluster Metrics via Grafana

Expand Down
78 changes: 29 additions & 49 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@

<groupId>com.oracle.coherence</groupId>
<artifactId>coherence-demo</artifactId>
<version>4.0.1-SNAPSHOT</version>
<version>5.0.0-SNAPSHOT</version>

<properties>
<!-- The groupId of the Coherence product -->
<coherence.group.id>com.oracle.coherence.ce</coherence.group.id>

<!-- dependency versions -->
<bedrock.version>5.0.11</bedrock.version>
<coherence.version>20.12.2</coherence.version>
<coherence.version>21.06</coherence.version>
<com.sun.xml.bind.version>2.3.0</com.sun.xml.bind.version>
<copy.rename.maven.plugin.version>1.0</copy.rename.maven.plugin.version>
<derby.version>10.15.2.0</derby.version>
Expand Down Expand Up @@ -60,10 +60,14 @@
<maven.exec.plugin.version>1.6.0</maven.exec.plugin.version>
<maven.javadoc.plugin.version>3.2.0</maven.javadoc.plugin.version>
<maven.resources.plugin.version>3.1.0</maven.resources.plugin.version>
<maven.shade.plugin.version>3.2.0</maven.shade.plugin.version>
<maven.replacer.plugin.version>1.5.3</maven.replacer.plugin.version>
<maven.source.plugin.version>2.1.2</maven.source.plugin.version>
<maven.version>3.6.0</maven.version>

<!-- startup options -->
<metrics.enabled>false</metrics.enabled>
<http.hostname>127.0.0.1</http.hostname>
<http.port>8080</http.port>
</properties>

<dependencies>
Expand Down Expand Up @@ -319,56 +323,32 @@
</execution>
</executions>
</plugin>

<!-- mvn exec plugin -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${maven.exec.plugin.version}</version>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>-Xmx512m</argument>
<argument>-Xms512m</argument>
<argument>-Dcoherence.log.level=3</argument>
<argument>-Dcoherence.management=all</argument>
<argument>-Dcoherence.metrics.http.enabled=${metrics.enabled}</argument>
<argument>-Dhttp.hostname=${http.hostname}</argument>
<argument>-Dhttp.port=${http.port}</argument>
<argument>com.oracle.coherence.demo.application.Launcher</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<!-- profile to include shaded jar -->
<profile>
<id>stand-alone</id>
<activation>
<property>
<name>!docker</name>
</property>
</activation>
<build>
<plugins>
<!-- create a single jar with everything in it -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven.shade.plugin.version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.oracle.coherence.demo.application.Launcher
</mainClass>
<manifestEntries>
<Implementation-GroupId>com.oracle.coherence</Implementation-GroupId>
<Implementation-Description>Demonstration</Implementation-Description>
<Implementation-Vendor>Oracle</Implementation-Vendor>
<Implementation-Version>${coherence.version}</Implementation-Version>
<Implementation-Build>demo</Implementation-Build>
<Specification-Vendor>Oracle</Specification-Vendor>
<Specification-Version>${actual.coherence.version}</Specification-Version>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>grid-edition</id>
<activation>
Expand Down
4 changes: 2 additions & 2 deletions yaml/demo-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
cacheConfig: cache-config.xml
metrics:
enabled: true
image: coherence-demo:4.0.1-SNAPSHOT
image: coherence-demo:5.0.0-SNAPSHOT
imagePullPolicy: Always
replicas: 2
---
Expand Down Expand Up @@ -55,6 +55,6 @@ spec:
metrics:
enabled: true
port: 9612
image: coherence-demo:4.0.1-SNAPSHOT
image: coherence-demo:5.0.0-SNAPSHOT
imagePullPolicy: Always
replicas: 1
4 changes: 2 additions & 2 deletions yaml/primary-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
metrics:
enabled: true
port: 9612
image: coherence-demo:4.0.1-SNAPSHOT
image: coherence-demo:5.0.0-SNAPSHOT
imagePullPolicy: Always
replicas: 3
---
Expand Down Expand Up @@ -60,6 +60,6 @@ spec:
metrics:
enabled: true
port: 9612
image: coherence-demo:4.0.1-SNAPSHOT
image: coherence-demo:5.0.0-SNAPSHOT
imagePullPolicy: Always
replicas: 1
4 changes: 2 additions & 2 deletions yaml/secondary-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
metrics:
enabled: true
port: 9612
image: coherence-demo:4.0.1-SNAPSHOT
image: coherence-demo:5.0.0-SNAPSHOT
imagePullPolicy: Always
replicas: 3
---
Expand Down Expand Up @@ -61,6 +61,6 @@ spec:
metrics:
enabled: true
port: 9612
image: coherence-demo:4.0.1-SNAPSHOT
image: coherence-demo:5.0.0-SNAPSHOT
imagePullPolicy: Always
replicas: 1

0 comments on commit b794d34

Please sign in to comment.