Skip to content

Commit 168cf5f

Browse files
authored
Merge pull request #309 from marklogic/release/2.4.0
Merge release/2.4.0 into master
2 parents b6dc395 + 5fb6ad5 commit 168cf5f

File tree

64 files changed

+1649
-252
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1649
-252
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Defines environment variables for docker-compose.
22
# Can be overridden via e.g. `MARKLOGIC_TAG=latest-10.0 docker-compose up -d --build`.
3-
MARKLOGIC_TAG=11.2.0-centos-1.1.2
3+
MARKLOGIC_TAG=latest

CONTRIBUTING.md

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
This guide covers how to develop and test this project. It assumes that you have cloned this repository to your local
22
workstation.
33

4-
Due to the use of the Sonar plugin for Gradle, you must use Java 11 or higher for developing and testing the project.
5-
The `build.gradle` file for this project ensures that the connector is built to run on Java 8 or higher.
4+
You must use Java 11 or higher for developing, testing, and building this project. If you wish to use Sonar as
5+
described below, you must use Java 17 or higher.
66

77
# Setup
88

99
To begin, you need to deploy the test application in this project to MarkLogic. You can do so either on your own
10-
installation of MarkLogic, or you can use `docker-compose` to install MarkLogic, optionally as a 3-node cluster with
10+
installation of MarkLogic, or you can use `docker compose` to install MarkLogic, optionally as a 3-node cluster with
1111
a load balancer in front of it.
1212

13-
## Installing MarkLogic with docker-compose
13+
## Installing MarkLogic with docker compose
1414

15-
If you wish to use `docker-compose`, perform the following steps before deploying the test application.
15+
If you wish to use `docker compose`, perform the following steps before deploying the test application.
1616

1717
1. [Install Docker](https://docs.docker.com/get-docker/).
1818
2. Ensure that you don't have a MarkLogic instance running locally (if you do, you may run into port conflicts in
1919
the next step).
20-
3. Run `docker-compose up -d --build`.
20+
3. Run `docker compose up -d --build`.
2121

2222
The above will result in a new MarkLogic instance with a single node.
2323

2424
Alternatively, if you would like to test against a 3-node MarkLogic cluster with a load balancer in front of it,
25-
run `docker-compose -f docker-compose-3nodes.yaml up -d --build`.
25+
run `docker compose -f docker-compose-3nodes.yaml up -d --build`.
2626

2727
## Deploying the test application
2828

@@ -45,8 +45,8 @@ To run the tests against the test application, run the following Gradle task:
4545

4646
## Generating code quality reports with SonarQube
4747

48-
In order to use SonarQube, you must have used Docker to run this project's `docker-compose.yml` file and you must
49-
have the services in that file running.
48+
In order to use SonarQube, you must have used Docker to run this project's `docker-compose.yml` file, and you must
49+
have the services in that file running and you must use Java 17 to run the Gradle `sonar` task.
5050

5151
To configure the SonarQube service, perform the following steps:
5252

@@ -62,8 +62,8 @@ To configure the SonarQube service, perform the following steps:
6262
10. Add `systemProp.sonar.token=your token pasted here` to `gradle-local.properties` in the root of your project, creating
6363
that file if it does not exist yet.
6464

65-
To run SonarQube, run the following Gradle tasks, which will run all the tests with code coverage and then generate
66-
a quality report with SonarQube:
65+
To run SonarQube, run the following Gradle tasks using Java 17, which will run all the tests with code coverage and
66+
then generate a quality report with SonarQube:
6767

6868
./gradlew test sonar
6969

@@ -83,20 +83,17 @@ you've introduced on the feature branch you're working on. You can then click on
8383
Note that if you only need results on code smells and vulnerabilities, you can repeatedly run `./gradlew sonar`
8484
without having to re-run the tests.
8585

86-
Our Sonar instance is also configured to scan for dependency vulnerabilities
87-
[via the dependency-check plugin](https://github.com/dependency-check/dependency-check-sonar-plugin). For more
88-
information, see the `dependencyCheck` block in this project's `build.gradle` file. To include dependency check results,
89-
just run the following (it's not included by default when running the `sonar` task):
86+
You can also force Gradle to run `sonar` if any tests fail:
9087

91-
./gradlew dependencyCheckAnalyze sonar
88+
./gradlew clean test sonar --continue
9289

9390
## Accessing MarkLogic logs in Grafana
9491

9592
This project's `docker-compose-3nodes.yaml` file includes
9693
[Grafana, Loki, and promtail services](https://grafana.com/docs/loki/latest/clients/promtail/) for the primary reason of
9794
collecting MarkLogic log files and allowing them to be viewed and searched via Grafana.
9895

99-
Once you have run `docker-compose`, you can access Grafana at http://localhost:3000 . Follow these instructions to
96+
Once you have run `docker compose`, you can access Grafana at http://localhost:3000 . Follow these instructions to
10097
access MarkLogic logging data:
10198

10299
1. Click on the hamburger in the upper left hand corner and select "Explore", or simply go to
@@ -123,7 +120,7 @@ This will produce a single jar file for the connector in the `./build/libs` dire
123120

124121
You can then launch PySpark with the connector available via:
125122

126-
pyspark --jars build/libs/marklogic-spark-connector-2.3-SNAPSHOT.jar
123+
pyspark --jars build/libs/marklogic-spark-connector-2.4-SNAPSHOT.jar
127124

128125
The below command is an example of loading data from the test application deployed via the instructions at the top of
129126
this page.
@@ -199,7 +196,7 @@ The Spark master GUI is at <http://localhost:8080>. You can use this to view det
199196

200197
Now that you have a Spark cluster running, you just need to tell PySpark to connect to it:
201198

202-
pyspark --master spark://NYWHYC3G0W:7077 --jars build/libs/marklogic-spark-connector-2.3-SNAPSHOT.jar
199+
pyspark --master spark://NYWHYC3G0W:7077 --jars build/libs/marklogic-spark-connector-2.4-SNAPSHOT.jar
203200

204201
You can then run the same commands as shown in the PySpark section above. The Spark master GUI will allow you to
205202
examine details of each of the commands that you run.
@@ -218,12 +215,12 @@ You will need the connector jar available, so run `./gradlew clean shadowJar` if
218215
You can then run a test Python program in this repository via the following (again, change the master address as
219216
needed); note that you run this outside of PySpark, and `spark-submit` is available after having installed PySpark:
220217

221-
spark-submit --master spark://NYWHYC3G0W:7077 --jars build/libs/marklogic-spark-connector-2.3-SNAPSHOT.jar src/test/python/test_program.py
218+
spark-submit --master spark://NYWHYC3G0W:7077 --jars build/libs/marklogic-spark-connector-2.4-SNAPSHOT.jar src/test/python/test_program.py
222219

223220
You can also test a Java program. To do so, first move the `com.marklogic.spark.TestProgram` class from `src/test/java`
224221
to `src/main/java`. Then run `./gradlew clean shadowJar` to rebuild the connector jar. Then run the following:
225222

226-
spark-submit --master spark://NYWHYC3G0W:7077 --class com.marklogic.spark.TestProgram build/libs/marklogic-spark-connector-2.3-SNAPSHOT.jar
223+
spark-submit --master spark://NYWHYC3G0W:7077 --class com.marklogic.spark.TestProgram build/libs/marklogic-spark-connector-2.4-SNAPSHOT.jar
227224

228225
Be sure to move `TestProgram` back to `src/test/java` when you are done.
229226

Jenkinsfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pipeline{
4040
buildDiscarder logRotator(artifactDaysToKeepStr: '7', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '')
4141
}
4242
environment{
43-
JAVA11_HOME_DIR="/home/builder/java/jdk-11.0.2"
43+
JAVA17_HOME_DIR="/home/builder/java/jdk-17.0.2"
4444
GRADLE_DIR =".gradle"
4545
DMC_USER = credentials('MLBUILD_USER')
4646
DMC_PASSWORD = credentials('MLBUILD_PASSWORD')
@@ -61,9 +61,9 @@ pipeline{
6161
docker-compose down -v || true
6262
docker-compose up -d --build
6363
'''
64-
runtests('JAVA11_HOME_DIR')
64+
runtests('JAVA17_HOME_DIR')
6565
withSonarQubeEnv('SONAR_Progress') {
66-
runSonarScan('JAVA11_HOME_DIR')
66+
runSonarScan('JAVA17_HOME_DIR')
6767
}
6868
}
6969
post{
@@ -83,7 +83,7 @@ pipeline{
8383
}
8484
steps{
8585
sh label:'publish', script: '''#!/bin/bash
86-
export JAVA_HOME=$JAVA11_HOME_DIR
86+
export JAVA_HOME=$JAVA17_HOME_DIR
8787
export GRADLE_USER_HOME=$WORKSPACE/$GRADLE_DIR
8888
export PATH=$GRADLE_USER_HOME:$JAVA_HOME/bin:$PATH
8989
cp ~/.gradle/gradle.properties $GRADLE_USER_HOME;
@@ -110,7 +110,7 @@ pipeline{
110110
docker-compose down -v || true
111111
MARKLOGIC_TAG=latest-10.0 docker-compose up -d --build
112112
'''
113-
runtests('JAVA11_HOME_DIR')
113+
runtests('JAVA17_HOME_DIR')
114114
}
115115
post{
116116
always{

build.gradle

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,17 @@ plugins {
22
id 'java-library'
33
id 'net.saliman.properties' version '1.5.2'
44
id 'com.github.johnrengelman.shadow' version '8.1.1'
5-
id "com.marklogic.ml-gradle" version "4.7.0"
5+
id "com.marklogic.ml-gradle" version "5.0.0"
66
id 'maven-publish'
7-
id 'signing'
87
id "jacoco"
9-
id "org.sonarqube" version "4.4.1.3373"
10-
id "org.owasp.dependencycheck" version "10.0.3"
8+
id "org.sonarqube" version "5.1.0.4882"
119
}
1210

1311
group 'com.marklogic'
14-
version '2.3.1'
12+
version '2.4.0'
1513

1614
java {
17-
// To support reading RDF files, Apache Jena is used - but that requires Java 11. If we want to do a 2.2.0 release
18-
// without requiring Java 11, we'll remove the support for reading RDF files along with the Jena dependency.
15+
// To support reading RDF files, Apache Jena is used - but that requires Java 11.
1916
sourceCompatibility = 11
2017
targetCompatibility = 11
2118
}
@@ -55,8 +52,8 @@ dependencies {
5552
exclude group: "com.fasterxml.jackson.dataformat"
5653
}
5754

58-
// Required for converting JSON to XML. Using 2.14.2 to align with Spark 3.4.1.
59-
shadowDependencies "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.14.2"
55+
// Required for converting JSON to XML. Using 2.15.2 to align with Spark 3.5.3.
56+
shadowDependencies "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.2"
6057

6158
// Need this so that an OkHttpClientConfigurator can be created.
6259
shadowDependencies 'com.squareup.okhttp3:okhttp:4.12.0'
@@ -68,7 +65,7 @@ dependencies {
6865

6966
shadowDependencies "org.jdom:jdom2:2.0.6.1"
7067

71-
testImplementation ('com.marklogic:ml-app-deployer:4.8.0') {
68+
testImplementation ('com.marklogic:ml-app-deployer:5.0.0') {
7269
exclude group: "com.fasterxml.jackson.core"
7370
exclude group: "com.fasterxml.jackson.dataformat"
7471

@@ -85,27 +82,18 @@ dependencies {
8582
}
8683

8784
testImplementation "ch.qos.logback:logback-classic:1.3.14"
88-
testImplementation "org.slf4j:jcl-over-slf4j:1.7.36"
85+
testImplementation "org.slf4j:jcl-over-slf4j:2.0.13"
8986
testImplementation "org.skyscreamer:jsonassert:1.5.1"
9087
}
9188

92-
// See https://jeremylong.github.io/DependencyCheck/dependency-check-gradle/configuration.html for more information.
93-
dependencyCheck {
94-
// Need a JSON report to integrate with Sonar. And HTML is easier for humans to read.
95-
formats = ["HTML", "JSON"]
96-
// We don't include compileOnly since that includes Spark, and Spark and its dependencies are not actual dependencies
97-
// of our connector.
98-
scanConfigurations = ["shadowDependencies"]
99-
suppressionFile = "config/dependency-check-suppressions.xml"
100-
}
101-
10289
test {
10390
useJUnitPlatform()
10491
finalizedBy jacocoTestReport
10592
// Allows mlHost to override the value in gradle.properties, which the test plumbing will default to.
10693
environment "mlHost", mlHost
10794
}
10895

96+
// See https://docs.gradle.org/current/userguide/jacoco_plugin.html .
10997
jacocoTestReport {
11098
dependsOn test
11199
reports {
@@ -117,8 +105,6 @@ sonar {
117105
properties {
118106
property "sonar.projectKey", "marklogic-spark"
119107
property "sonar.host.url", "http://localhost:9000"
120-
// See https://github.com/dependency-check/dependency-check-sonar-plugin for more information.
121-
property "sonar.dependencyCheck.jsonReportPath", "build/reports/dependency-check-report.json"
122108
}
123109
}
124110

@@ -136,7 +122,8 @@ if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
136122
// for an explanation of why these are needed when running the tests on Java 17.
137123
jvmArgs = [
138124
'--add-exports=java.base/sun.nio.ch=ALL-UNNAMED',
139-
'--add-opens=java.base/sun.util.calendar=ALL-UNNAMED'
125+
'--add-opens=java.base/sun.util.calendar=ALL-UNNAMED',
126+
'--add-opens=java.base/sun.security.action=ALL-UNNAMED'
140127
]
141128
}
142129
}
@@ -178,9 +165,6 @@ javadoc.options.addStringOption('Xdoclint:none', '-quiet')
178165
artifacts {
179166
archives javadocJar, sourcesJar
180167
}
181-
signing {
182-
sign configurations.archives
183-
}
184168

185169
publishing {
186170
publications {

docker-compose-3nodes.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '3.8'
21
name: marklogic_spark_3nodes
32

43
services:
@@ -30,7 +29,7 @@ services:
3029
# by this host. Note that each MarkLogic host has its 8000-8002 ports exposed externally so that the apps on those
3130
# ports can each be accessed if needed.
3231
bootstrap_3n:
33-
image: "marklogicdb/marklogic-db:${MARKLOGIC_TAG}"
32+
image: "progressofficial/marklogic-db:${MARKLOGIC_TAG}"
3433
platform: linux/amd64
3534
container_name: bootstrap_3n
3635
hostname: bootstrap_3n.local
@@ -50,7 +49,7 @@ services:
5049
- internal_net
5150

5251
node2:
53-
image: "marklogicdb/marklogic-db:${MARKLOGIC_TAG}"
52+
image: "progressofficial/marklogic-db:${MARKLOGIC_TAG}"
5453
platform: linux/amd64
5554
container_name: node2
5655
hostname: node2.local
@@ -74,7 +73,7 @@ services:
7473
- internal_net
7574

7675
node3:
77-
image: "marklogicdb/marklogic-db:${MARKLOGIC_TAG}"
76+
image: "progressofficial/marklogic-db:${MARKLOGIC_TAG}"
7877
platform: linux/amd64
7978
container_name: node3
8079
hostname: node3.local

docker-compose.yaml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: marklogic_spark
44
services:
55

66
marklogic:
7-
image: "marklogicdb/marklogic-db:${MARKLOGIC_TAG}"
7+
image: "progressofficial/marklogic-db:${MARKLOGIC_TAG}"
88
platform: linux/amd64
99
environment:
1010
- MARKLOGIC_INIT=true
@@ -19,24 +19,20 @@ services:
1919

2020
# Copied from https://docs.sonarsource.com/sonarqube/latest/setup-and-upgrade/install-the-server/#example-docker-compose-configuration .
2121
sonarqube:
22-
# Using 10.2 to avoid requiring Java 17 for now.
23-
image: sonarqube:10.2.1-community
22+
image: sonarqube:10.6.0-community
2423
depends_on:
2524
- postgres
2625
environment:
2726
SONAR_JDBC_URL: jdbc:postgresql://postgres:5432/sonar
2827
SONAR_JDBC_USERNAME: sonar
2928
SONAR_JDBC_PASSWORD: sonar
3029
volumes:
31-
- ./docker/sonarqube/data:/opt/sonarqube/data
32-
- ./docker/sonarqube/logs:/opt/sonarqube/logs
33-
# Allows for Sonar plugins to be installed by including plugin jar files in this directory.
34-
- ./docker/sonarqube/extensions:/opt/sonarqube/extensions
30+
- sonarqube_data:/opt/sonarqube/data
3531
ports:
3632
- "9000:9000"
3733

3834
postgres:
39-
image: postgres:12
35+
image: postgres:15
4036
environment:
4137
POSTGRES_USER: sonar
4238
POSTGRES_PASSWORD: sonar
@@ -46,7 +42,5 @@ services:
4642

4743
volumes:
4844
sonarqube_data:
49-
sonarqube_extensions:
50-
sonarqube_logs:
5145
postgresql:
5246
postgresql_data:
Binary file not shown.

docs/getting-started/jupyter.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ connector and also to initialize Spark:
3232

3333
```
3434
import os
35-
os.environ['PYSPARK_SUBMIT_ARGS'] = '--jars "/path/to/marklogic-spark-connector-2.3.1.jar" pyspark-shell'
35+
os.environ['PYSPARK_SUBMIT_ARGS'] = '--jars "/path/to/marklogic-spark-connector-2.4.0.jar" pyspark-shell'
3636
3737
from pyspark.sql import SparkSession
3838
spark = SparkSession.builder.master("local[*]").appName('My Notebook').getOrCreate()
3939
spark.sparkContext.setLogLevel("WARN")
4040
spark
4141
```
4242

43-
The path of `/path/to/marklogic-spark-connector-2.3.1.jar` should be changed to match the location of the connector
43+
The path of `/path/to/marklogic-spark-connector-2.4.0.jar` should be changed to match the location of the connector
4444
jar on your filesystem. You are free to customize the `spark` variable in any manner you see fit as well.
4545

4646
Now that you have an initialized Spark session, you can run any of the examples found in the

docs/getting-started/pyspark.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ shell by pressing `ctrl-D`.
2929

3030
Run PySpark from the directory that you downloaded the connector to per the [setup instructions](setup.md):
3131

32-
pyspark --jars marklogic-spark-connector-2.3.1.jar
32+
pyspark --jars marklogic-spark-connector-2.4.0.jar
3333

3434
The `--jars` command line option is PySpark's method for utilizing Spark connectors. Each Spark environment should have
3535
a similar mechanism for including third party connectors; please see the documentation for your particular Spark

docs/getting-started/setup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ have an instance of MarkLogic running, you can skip step 4 below, but ensure tha
3131
extracted directory contains valid connection properties for your instance of MarkLogic.
3232

3333
1. From [this repository's Releases page](https://github.com/marklogic/marklogic-spark-connector/releases), select
34-
the latest release and download the `marklogic-spark-getting-started-2.3.1.zip` file.
34+
the latest release and download the `marklogic-spark-getting-started-2.4.0.zip` file.
3535
2. Extract the contents of the downloaded zip file.
3636
3. Open a terminal window and go to the directory created by extracting the zip file; the directory should have a
37-
name of "marklogic-spark-getting-started-2.3.1".
37+
name of "marklogic-spark-getting-started-2.4.0".
3838
4. Run `docker-compose up -d` to start an instance of MarkLogic
3939
5. Ensure that the `./gradlew` file is executable; depending on your operating system, you may need to run
4040
`chmod 755 gradlew` to make the file executable.

0 commit comments

Comments
 (0)