Before you begin
Make sure that a Docker registry is configured in your artifact repository (Nexus,
Artifactory).
Procedure
-
Open a command prompt or terminal and execute the following command to build
and deploy artifacts on a distant Nexus Docker registry.
$ mvn -Dgeneration.type=local -Dproduct.path=<STUDIO_HOME> -s <STUDIO_HOME>/configuration/maven_user_settings.xml \
deploy -Pdocker \
-f <GIT_PROJECT_PATH>/<STUDIO_PROJECT>/poms \
-pl jobs/process/demorest_0.1,jobs/routes/demorestroute_0.1,jobs/routes/directsedademo_0.1 \
-Djkube.docker.username=<username> -Djkube.docker.password=<password> -Djkube.docker.push.registry=<ARTIFACT_REPOSITORY_HOST>:<DOCKER_REGISTRY_PORT>
[INFO] Scanning for projects...
...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] <STUDIO_PROJECT> DemoREST-0.1.0 (0.1,Jobs) Microservice Jar [jar]
[INFO] <STUDIO_PROJECT> DirectSEDADemo-0.1.0 (0.1,Routes) Microservice Jar [jar]
[INFO] <STUDIO_PROJECT> DemoRESTRoute-0.1.0 (0.1,Routes) Microservice Jar [jar]
...
[INFO] --- fabric8-maven-plugin:4.0.0:push (push-image) @ DemoREST ---
[INFO] F8> The push refers to repository [<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorest]
[INFO] F8> latest: digest: sha256:a63c7e4672efc1632fd696eb24fe0a7dba89c0b5697b96b370f98546c6e2108e size: 1993
[INFO] F8> Pushed <STUDIO_PROJECT>/demorest in 8 seconds
[INFO] F8> The push refers to repository [<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorest]
[INFO] F8> 0.1.0: digest: sha256:a63c7e4672efc1632fd696eb24fe0a7dba89c0b5697b96b370f98546c6e2108e size: 1993
...
[INFO] --- fabric8-maven-plugin:4.0.0:push (push-image) @ DirectSEDADemo ---
[INFO] F8> The push refers to repository [<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/directsedademo]
[INFO] F8> latest: digest: sha256:0de9fe92ae8f4a39c7af7a676682f4a6868b4416deebc52acc4f581e0a2e16c4 size: 1992
[INFO] F8> Pushed <STUDIO_PROJECT>/directsedademo in 4 seconds
[INFO] F8> The push refers to repository [<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/directsedademo]
[INFO] F8> 0.1.0: digest: sha256:0de9fe92ae8f4a39c7af7a676682f4a6868b4416deebc52acc4f581e0a2e16c4 size: 1992
...
[INFO] --- fabric8-maven-plugin:4.0.0:push (push-image) @ DemoRESTRoute ---
[INFO] F8> The push refers to repository [<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorestroute]
[INFO] F8> latest: digest: sha256:080892fee69d06676da35aaf57bfe7ff7c4e1a544fb08b0ca86976b5d44e015e size: 1992
[INFO] F8> Pushed <STUDIO_PROJECT>/demorestroute in 5 seconds
[INFO] F8> The push refers to repository [<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorestroute]
[INFO] F8> 0.1.0: digest: sha256:080892fee69d06676da35aaf57bfe7ff7c4e1a544fb08b0ca86976b5d44e015e size: 1992
...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for <STUDIO_PROJECT> DemoREST-0.1.0 (0.1,Jobs) Microservice Jar 0.1.0:
[INFO]
[INFO] <STUDIO_PROJECT> DemoREST-0.1.0 (0.1,Jobs) Microservice Jar SUCCESS [02:54 min]
[INFO] <STUDIO_PROJECT> DirectSEDADemo-0.1.0 (0.1,Routes) Microservice Jar SUCCESS [ 35.323 s]
[INFO] <STUDIO_PROJECT> DemoRESTRoute-0.1.0 (0.1,Routes) Microservice Jar SUCCESS [ 32.586 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 04:08 min
[INFO] Finished at: 2019-08-12T10:12:03+02:00
[INFO] ------------------------------------------------------------------------
where
-
<STUDIO_HOME> corresponds to the Talend Studio installation path
-
<GIT_PROJECT_PATH> corresponds to the path
of your Git project or Git clone result
-
<STUDIO_PROJECT> corresponds to the Talend Studio project name that is the same
as the Git project name. Project names must be in upper case.
-
<ARTIFACT_REPOSITORY_HOST> corresponds to
the host of the artifact repository (Nexus, Artifactory)
-
<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>
corresponds to the host of the URL of the artifact repository Docker
registry (Nexus, Artifactory)
-
<DOCKER_REGISTRY_PORT> corresponds to the
port binded for accessing the Docker repository (specific to
Nexus)
Tip: Use the -Dstudio.prometheus.metrics=true
command while publishing to Docker in order to expose Camel metrics to
Prometheus and provide more details about the deployed Routes (number of
processed exchanges, number of errors, requests per seconds, etc).
-
Connect to the Docker Registry and pull from the distant Docker registry to the
local Docker registry.
$ docker login <ARTIFACT_REPOSITORY_HOST>:<DOCKER_REGISTRY_PORT>
Login Succeeded
$ docker pull <ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorestroute
Using default tag: latest
latest: Pulling from <ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorestroute
Digest: sha256:4c8afd00802eef89197c65f6855e2dfc1609ca518022526207fcb4c56709e958
Status: Downloaded newer image for <ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorestroute:latest
<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorestroute:latest
$ docker pull <ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorest
Using default tag: latest
latest: Pulling from repository/local-docker/jgr_docker_ci/demorest
Digest: sha256:a63c7e4672efc1632fd696eb24fe0a7dba89c0b5697b96b370f98546c6e2108e
Status: Downloaded newer image for <ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorest:latest
<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorest:latest
$ docker pull <ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/directsedademo
Using default tag: latest
latest: Pulling from repository/local-docker/jgr_docker_ci/directsedademo
Digest: sha256:0de9fe92ae8f4a39c7af7a676682f4a6868b4416deebc52acc4f581e0a2e16c4
Status: Downloaded newer image for <ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/directsedademo:latest
<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/directsedademo:latest
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorestroute latest 5901eb7a8c7d 1 minute ago 258MB
<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/directsedademo latest 36aaa145fd80 1 minute ago 237MB
<ARTIFACT_REPOSITORY_DOCKER_REGISTRY>/<STUDIO_PROJECT>/demorest latest afdaba21fb8a 1 minute ago 307MB