...
We have seen how the pom.xml file create the ~/ccsdk/distribution/odlsli/target/docker-stage directory in preparation for building the docker image. The next step is to inspect the Dockerfile that creates the image, discussed here.
Building the
...
docker image
By running the command 'mvn clean process-sources' and getting a BUILD SUCCESS, a properly constructed directory will be created at ~/git/ccsdk/distribution/odlsli/target/docker-stage/.
Before building the image, remember that the Dockerfile begins with a local image of OpenDaylight Oxygen: onap/ccsdk-odl-oxygen-image${project.version} (currently 0.3.0-SNAPSHOT). One can download the image from NEXUS_DOCKER_IMAGE and then rename it as a local image using the commands below.
Code Block | ||
---|---|---|
| ||
%: docker pull ${NEXUS_DOCKER_REPO}/onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT
0.3.0-SNAPSHOT: Pulling from onap/ccsdk-odl-oxygen-image
95871a411089: Pull complete
f7253e37cce8: Pull complete
12d05d7bd5c4: Pull complete
db27ec99c6c2: Pull complete
8fd62e3405ff: Pull complete
ce430a842b90: Pull complete
de7dcf5d4be1: Pull complete
e3de3d1054ec: Pull complete
d66bd2234856: Pull complete
6be70fc7e3a6: Pull complete
Digest: sha256:80da6c8e0f70d0dddd2be462634b297fc0dc5256cb93619b30a66441d1a89cb8
Status: Downloaded newer image for nexus3.onap.org:10001/onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT
%: docker tag ${NEXUS_DOCKER_REPO}/onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT |
The section of the Dockerfile that sets the environment variables for the features for the repositories is repeated here.
Code Block | ||
---|---|---|
| ||
ENV CCSDK_SLI_CORE_REPO mvn:org.onap.ccsdk.sli.core/ccsdk-sli-core-all/${ccsdk.sli.core.version}/xml/features
ENV CCSDK_SLI_ADAPTORS_REPO mvn:org.onap.ccsdk.sli.adaptors/ccsdk-sli-adaptors-all/${ccsdk.sli.adaptors.version}/xml/features
ENV CCSDK_SLI_NORTHBOUND_REPO mvn:org.onap.ccsdk.sli.northbound/ccsdk-sli-northbound-all/${ccsdk.sli.northbound.version}/xml/features
ENV CCSDK_SLI_PLUGINS_REPO mvn:org.onap.ccsdk.sli.plugins/ccsdk-sli-plugins-all/${ccsdk.sli.plugins.version}/xml/features |
These variables enable all of the features in a repository to be installed using a single reference, e.g., <repository-name>-all.
Building the docker image
By running the command 'mvn clean process-sources' and getting a BUILD SUCCESS, a properly constructed directory will be created at ~/git/ccsdk/distribution/odlsli/target/docker-stage/.
Before building the image, remember that the Dockerfile begins with a local image of OpenDaylight Oxygen: onap/ccsdk-odl-oxygen-image${project.version} (currently 0.3.0-SNAPSHOT). One can download the image from NEXUS_DOCKER_IMAGE and then rename it as a local image using the commands below.
Code Block | ||
---|---|---|
| ||
%: docker pull ${NEXUS_DOCKER_REPO}/onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT 0.3.0-SNAPSHOT%: Pulling from onap/ccsdk-odl-oxygen-image 95871a411089: Pull complete f7253e37cce8: Pull complete 12d05d7bd5c4: Pull complete db27ec99c6c2: Pull complete 8fd62e3405ff: Pull complete ce430a842b90: Pull complete de7dcf5d4be1: Pull complete e3de3d1054ec: Pull complete d66bd2234856: Pull complete 6be70fc7e3a6: Pull complete Digest: sha256:80da6c8e0f70d0dddd2be462634b297fc0dc5256cb93619b30a66441d1a89cb8 Status: Downloaded newer image for nexus3.onap.org:10001/onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT %: docker tag ${NEXUS_DOCKER_REPO}/onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT onap/ccsdk-odl-oxygen-image:0.3.0-SNAPSHOT %: docker images REPOSITORYdocker images REPOSITORY TAG IMAGE ID CREATED SIZE onap/ccsdk-odl-oxygen-image 0.3.0-SNAPSHOT bb02ebe49933 8 hours ago 1.72GB nexus3.onap.org:10001/onap/ccsdk-odl-oxygen-image 0.3.0-SNAPSHOT bb02ebe49933 8 hours ago 1.72GB nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image 0.3-STAGING-latest eb208aa7f163 4 days ago 1.04GB nexus3.onap.org:10001/onap/ccsdk-odlsli-image 0.3-STAGING-latest 665a42becd61 4 days ago 1.8GB mysql/mysql-server 5.6 8d97ef4de156 3 months ago 226MB |
...
Code Block | ||||
---|---|---|---|---|
| ||||
%: docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4e3ba68fb7bb nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest "/bin/bash -c 'cd /o…" 3 days ago Up 3 days 0.0.0.0:3000->3100/tcp ccsdk_dgbuilder_container a68fc2f266e6 nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.3-STAGING-latest "/opt/onap/ccsdk/bin…" 3 days ago Up 3 days 0.0.0.0:8383->8181/tcp ccsdk_odlsli_container 26e84acaae56 mysql/mysql-server:5.6 "/entrypoint.sh mysq…" 3 days ago Up 3 days (healthy) 0.0.0.0:32790->3306/tcp ccsdk_db_container %: docker stop ccsdk_odlsli_container ccsdk_odlsli_container %: docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 4e3ba68fb7bb nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest "/bin/bash -c 'cd /o…" 3 days ago Up 3 days 0.0.0.0:3000->3100/tcp ccsdk_dgbuilder_container 26e84acaae56 mysql/mysql-server:5.6 "/entrypoint.sh mysq…" 3 days ago Up 3 days (healthy) 0.0.0.0:32790->3306/tcp ccsdk_db_container %: docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f550d9a98fb74e3ba68fb7bb nexus3.onap.org:10001/onap/sdnrccsdk-dgbuilder-image:0.3.0-STAGING-SNAPSHOTlatest "/bin/bash -c 'cd /o…" 3 days ago Up 3 days "/bin/sh -c /opt/ona…0.0.0.0:3000->3100/tcp ccsdk_dgbuilder_container a68fc2f266e6 nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.3-STAGING-latest "/opt/onap/ccsdk/bin…" 103 minutesdays ago Exited (130137) 529 seconds ago sdnr 4e3ba68fb7bb ccsdk_odlsli_container 26e84acaae56 nexus3.onap.org:10001/onap/ccsdk-dgbuilder-image:0.3-STAGING-latest "/bin/bash -c 'cd /o…" 3 days ago mysql/mysql-server:5.6 "/entrypoint.sh mysq…" Up 3 days ago Up 3 days (healthy) 0.0.0.0:300032790->3100>3306/tcp ccsdk_dgbuilderdb_container a68fc2f266e6 nexus3.onap.org:10001/onap/ccsdk-odlsli-image:0.3-STAGING-latest "/%: |
Remember that the entrypoint script /opt/onap/ccsdk
...
/bin/startODL.sh will execute and that it waits to login to the db server, so SDNR will not progress if it cannot login to the MySQL server. We want to connect SDNR to ccsdk_db_container, and we inspect the CCSDK containers to learn about their network.
We now have the information we need to start the container, and we use the command described here to launch it.
Alternatively, one can edit the docker-compose.yml file to use the newly created onap/sndr:0.3.0-SNAPSHOT image rather than the ccsdk-odlsli-image pulled from NEXUS_DOCKER_REPO. That will also create and launch the new SDNR container.
Creating the zip installation files for karaf features
We have seen how the karaf features for CCSDK are included in the dependencies section of the pom.xml file in ~/ccsdk/distribution/odlsli/ and that the features are referenced as files with the name structure <feature-name>-installer.<version>-repo.zip. The next step is to understand how these zip installation files are created. A good example is the "sliapi" feature, which is in the gerrit repository ccsdk/sli/core, shown here.
The sliapi directory contains the usual directories for a karaf feature with an additional directory "installer." This directory contains the code that creates the installation zip file that is referenced in the dependencies section of the ODLSLI pom.xml file.
Inspecting the installer pom.xml file
Below is the annotated pom.xml file. It executes two maven phases: prepare-package and package. Maven executes the prepare-package phase before the package phase, although, in the pom.xml file, the prepare-package code appears after the prepare code. In the annotations, the sequence is indicated by number.
Building the features files for the repositories
The section of the Dockerfile that sets the environment variables for the features for the repositories is repeated here.
Code Block | ||
---|---|---|
| ||
ENV CCSDK_SLI_CORE_REPO mvn:org.onap.ccsdk.sli.core/ccsdk-sli-core-all/${ccsdk.sli.core.version}/xml/features
ENV CCSDK_SLI_ADAPTORS_REPO mvn:org.onap.ccsdk.sli.adaptors/ccsdk-sli-adaptors-all/${ccsdk.sli.adaptors.version}/xml/features
ENV CCSDK_SLI_NORTHBOUND_REPO mvn:org.onap.ccsdk.sli.northbound/ccsdk-sli-northbound-all/${ccsdk.sli.northbound.version}/xml/features
ENV CCSDK_SLI_PLUGINS_REPO mvn:org.onap.ccsdk.sli.plugins/ccsdk-sli-plugins-all/${ccsdk.sli.plugins.version}/xml/features |
These variables enable all of the features in a repository to be installed using a single reference, e.g., <repository-name>-all.
Remember that the entrypoint script /opt/onap/ccsdk/bin/startODL.sh will execute and that it waits to login to the db server, so SDNR will not progress if it cannot login to the MySQL server. We want to connect SDNR to ccsdk_db_container, so we inspect the CCSDK containers to learn about their network.
We now have the information we need to start the container, and we use the command described here to launch it.
Alternatively, one can edit the docker-compose.yml file to use the newly created onap/sndr:0.3.0-SNAPSHOT image rather than the ccsdk-odlsli-image pulled from NEXUS_DOCKER_REPO. That will also create and launch the new SDNR container.
Creating the zip installation files for karaf features
We have seen how the karaf features for CCSDK are included in the dependencies section of the pom.xml file in ~/ccsdk/distribution/odlsli/ and that the features are referenced as files with the name structure <feature-name>-installer.<version>-repo.zip. The next step is to understand how these zip installation files are created. A good example is the "sliapi" feature, which is in the gerrit repository ccsdk/sli/core, shown here.
The sliapi directory contains the usual directories for a karaf feature with an additional directory "installer." This directory contains the code that creates the installation zip file that is referenced in the dependencies section of the ODLSLI pom.xml file.
Inspecting the installer pom.xml file
Below is the annotated pom.xml file. It executes two maven phases: prepare-package and package. Maven executes the prepare-package phase before the package phase, although, in the pom.xml file, the prepare-package code appears after the prepare code. In the annotations, the sequence is indicated by number.
...