Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 3e4b13b

Browse files
author
Corneil du Plessis
authored
Improve deployment scripts (#5725)
[skip ci]
1 parent b669b50 commit 3e4b13b

File tree

9 files changed

+48
-42
lines changed

9 files changed

+48
-42
lines changed

spring-cloud-dataflow-docs/src/main/asciidoc/appendix-extend-classpath.adoc

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,42 @@ Users may require the addition of dependencies to the existing Stream applicatio
66

77
NOTE: The Spring Cloud Dataflow repository contains scripts to help with this task. The examples below assume you have cloned the `spring-cloud-dataflow` repository and are executing the scripts from `src/templates/add-deps`.
88

9-
10-
==== Containers
11-
12-
In order to add dependencies to existing container the following steps will be the approach.
13-
14-
* Create a folder with the extra dependencies.
15-
* Create a new container image while copying the files to the libraries folder.
16-
* Push the image to a private registry.
17-
18-
===== Environmental variables
19-
20-
* `DEPS_FOLDER` should be a full filename or path expression for files to copy to the container.
21-
* `CONTAINER_REPO` the source docker image name.
22-
* `CONTAINER_TAG` the tag of source image.
23-
* `PRIVATE_REGISTRY` the host name of the private registry.
24-
25-
===== Examples
26-
27-
[source,shell]
28-
....
29-
export CONTAINER_REPO="springcloud/spring-cloud-dataflow-server"
30-
export CONTAINER_TAG="2.9.5-jdk17"
31-
export PRIVATE_REGISTRY="our.private.registry"
32-
export DEPS_FOLDER="./extra-libs/"
33-
docker build -f Dockerfile -t "$PRIVATE_REGISTRY/$CONTAINER_REPO:$CONTAINER_TAG"
34-
docker push "$PRIVATE_REGISTRY/$CONTAINER_REPO:$CONTAINER_TAG"
35-
....
36-
37-
NOTE: As pointed out above, the `Dockerfile` lives in the `spring-cloud-dataflow` repository under `src/add-deps`.
38-
399
==== JAR File
4010

41-
When using CloudFoundry or local deployment you will need to update jar before publishing it to a private registry or Maven Local.
11+
_We suggest you publish the updated jar it to a private Maven repository and that the Maven Coordinates of the private registry is then used to register application with SCDF._
4212

4313
===== Example
4414

45-
This example adds the dependencies and then installs the jar to Maven local.
15+
This example:
16+
* assumes the jar is downloaded to `${appFolder}/${appName}-${appVersion}.jar`
17+
* adds the dependencies and then publishes the jar to Maven local.
4618

4719
[source,shell]
4820
....
4921
./gradlew -i publishToMavenLocal \
5022
-P appFolder="." \
5123
-P appGroup="org.springframework.cloud" \
5224
-P appName="spring-cloud-dataflow-server" \
53-
-P appVersion="2.9.5" \
25+
-P appVersion="2.11.2" \
5426
-P depFolder="./extra-libs"
5527
....
5628

5729
NOTE: Use the `publishMavenPublicationToMavenRepository` task to publish to a remote repository. Update the `gradle.properties` with the remote repository details. Alternatively move `repoUser` and `repoPassword` to ~/.gradle/gradle.properties
30+
31+
==== Containers
32+
33+
In order to create a container we suggest using https://buildpacks.io/docs/for-platform-operators/how-to/integrate-ci/pack[paketo pack cli] to create a container from the jar created in previous step.
34+
35+
[source, shell]
36+
....
37+
REPO=springcloud/spring-cloud-dataflow-server
38+
TAG=2.11.2
39+
JAR=build/spring-cloud-dataflow-server-${TAG}.jar
40+
JAVA_VERSION=8
41+
pack build --builder gcr.io/paketo-buildpacks/builder:base \
42+
--path "$JAR" \
43+
--trust-builder --verbose \
44+
--env BP_JVM_VERSION=${JAVA_VERSION} "$REPO:$TAG-jdk${JAVA_VERSION}-extra"
45+
....
46+
47+
NOTE: Publish the container to a private container registry and register the application docker uri with SCDF.

src/add-deps/Dockerfile

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/add-deps/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ task combinedJar(type: Jar) {
1010
into('BOOT-INF/lib') {
1111
from file(depsFolder)
1212
}
13-
archiveFileName = "${appName}.jar"
13+
archiveFileName = "${appName}-${appVersion}.jar"
1414
destinationDirectory = project.buildDir
1515
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
1616
}

src/add-deps/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
appGroup=org.springframework.cloud
22
appName=spring-cloud-dataflow-server
3-
appVersion=2.10.2
3+
appVersion=2.11.2
44
appFile=spring-cloud-dataflow-server.jar
55
appFolder=.
66
repoUrl=https://my.private.repo

src/deploy/carvel/configure-database.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ case $2 in
4242
"mysql57")
4343
DATABASE=mysql57
4444
;;
45+
"oracle")
46+
DATABASE=oracle
47+
;;
4548
*)
4649
echo "Unsupported or invalid database $2"
4750
exit 1
@@ -62,6 +65,9 @@ case $DATABASE in
6265
"postgresql")
6366
JDBC_DRIVER_CLASS=org.postgresql.Driver
6467
;;
68+
"oracle")
69+
JDBC_DRIVER_CLASS=oracle.jdbc.OracleDriver
70+
;;
6571
*)
6672
echo "Unsupported $DATABASE."
6773
;;

src/deploy/carvel/deploy-local-database.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,22 @@ if [ "$1" = "" ]; then
1212
echo "<database> must be provided. Choose one of postgresql or mariadb"
1313
exit 1
1414
fi
15+
JDBC_URL="jdbc:$DATABASE://$DATABASE.$DATABASE/dataflow"
1516
case $1 in
1617
"postgresql" | "postgres")
1718
DATABASE=postgresql
1819
;;
1920
"mariadb" | "maria")
2021
DATABASE=mariadb
2122
;;
23+
#"oracle")
24+
# DATABASE=oracle
25+
# JDBC_URL="jdbc:oracle:thin:@oracle.oracle:1521"
26+
# ;;
27+
"mysql57")
28+
DATABASE=mysql57
29+
JDBC_URL="jdbc:mysql://$DATABASE.$DATABASE/dataflow?permitMysqlScheme"
30+
;;
2231
*)
2332
echo "Unsupported or invalid database $1"
2433
exit 1
@@ -37,7 +46,6 @@ set -e
3746
kubectl rollout status deployment --namespace "$DATABASE" $DATABASE
3847
set +e
3948

40-
JDBC_URL="jdbc:$DATABASE://$DATABASE.$DATABASE/dataflow"
4149
"$SCDIR/configure-database.sh" dataflow $DATABASE "$JDBC_URL" $DATABASE database-username database-password
4250
"$SCDIR/configure-database.sh" skipper $DATABASE "$JDBC_URL" $DATABASE database-username database-password
4351
export DATABASE

src/deploy/k8s/configure-k8s.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ case "$K8S_DRIVER" in
5858
echo "Creating Minikube cluster with $K8S_DRIVER and k8s=$K8S_VERSION"
5959
# K8S_DRIVER=kvm2, docker, vmware, virtualbox, podman, vmwarefusion or hyperkit
6060
if [ "$MK_ARGS" = "" ]; then
61-
MK_ARGS="--cpus=8 --memory=12g"
61+
MK_ARGS="--cpus=8 --memory=16g --disk-size=50g"
6262
fi
6363
minikube start $MK_ARGS "--driver=$K8S_DRIVER" "--kubernetes-version=$K8S_VERSION"
6464
echo -e "Please run ${bold}'minikube tunnel'${end} in a separate shell to ensure a LoadBalancer is active."

src/deploy/k8s/load-image.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ if [ "$K8S_DRIVER" != "tmc" ] && [ "$K8S_DRIVER" != "gke" ] ; then
9191
else
9292
echo "Loading:$IMAGE:$DOCKER_IDS"
9393
fi
94-
minikube image load --pull=$PULL "$IMAGE"
94+
OPTIONS="--overwrite true --daemon true --pull $PULL"
95+
if [ "$PULL" == "false" ]; then
96+
OPTIONS="$OPTIONS --remote false"
97+
fi
98+
minikube image load "$IMAGE" $OPTIONS
9599
MK_IDS=$(minikube image ls --format table | grep -F "$NAME" | grep -F "$TAG" | awk '{print $6}')
96100
for did in $DOCKER_IDS; do
97101
for mid in $MK_IDS; do

src/deploy/versions.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ scdf-type:
1010
maintenance-snapshot: '1.5.4-SNAPSHOT'
1111
default:
1212
scdf-type: 'oss'
13-
version: 'snapshot'
14-
package-version: '2.11.3-SNAPSHOT'
13+
version: 'release'
14+
package-version: '2.11.2'

0 commit comments

Comments
 (0)