...
to test mr requires kafka11aaf and zookeeper
### Step 1: Build and run on local machine (Mac Air)
- in terminal
> $ git clone httpsssh://gerritsandovalfrOAM@gerrit.onap.org/r:29418/dmaap/messagerouter/messageservice && (cd messageservice && curl -Lo `git rev-parse --git-dir`/hooks/commit-msg https://gerrit.onap.org/r/tools/hooks/commit-msg; chmod +x `git rev-parse --git-dir`/hooks/commit-msg)
>
$ cd messageservice
- See docs/installation/installation.rst
- edit MsgRtrApi.properties
config.zk.servers=zookeeper
kafka.metadata.broker.list=kafka:9092
- docker-compose network maps service name(zookeeper, kafka) to IP
> cp bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp
- configure docker->properties->file sharing to include /var/tmp
> $ mvn clean install -DskipTests -Pdocker
> $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
onap/dmaap/dmaap-mr 1.1.11-SNAPSHOT-20190304T195732Z ec37060b0ef0 4 minutes ago 782MB
onap/dmaap/dmaap-mr 1.1.11-SNAPSHOT-latest ec37060b0ef0 4 minutes ago 782MB
onap/dmaap/dmaap-mr latest ec37060b0ef0 4 minutes ago 782MB
nexus3.onap.org:10003/onap/dmaap/dmaap-mr 1.1.11-SNAPSHOT-20190304T195732Z ec37060b0ef0 4 minutes ago 782MB
nexus3.onap.org:10003/onap/dmaap/dmaap-mr 1.1.11-SNAPSHOT-latest ec37060b0ef0 4 minutes ago 782MB
openjdk 8-jdk 5f8e49b0a018 3 weeks ago 624MB
- build kafka11aaf image (see separate guide)
- build zookeeper image (see separate guide)
> $ cd src/main/resources/docker-compose
4 cp docker-compose.yml docker-compose-local.yml
- create edit docker-compose-local.yml
image: onap/dmaap/zookeeper:latest
image: onap/dmaap/kafka01101:latest
image: onap/dmaap/dmaap-mr:latest
> docker-compose -f docker-compose-local.yml up -d
Test
- create sample file (any arbitrary content,e g "sample data")
> curl -H "Content-Type:text/plain" -X POST -d @sample.txt http://localhost:3904/events/TestTopic1TestTopic1
{"serverTimeMs": 645, ...
> curl -H "Content-Type:text/plain" -X GET http://localhost:3904/events/TestTopic1/CG1/C1?timeout=1000
["sample data"]
### Step 2: migrate to alpine
- edit messageservice/src/main/resources/Dockerfile
- from openjdk:8-jdk to openjdk:8-alpine
> mvn clean install -DskipTests -Pdocker -Ddocker.pull.registry=docker.io
> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
onap/dmaap/dmaap-mr 1.1.11-SNAPSHOT-20190306T122553Z e8fbf3bebd9b 46 seconds ago 244MB
onap/dmaap/dmaap-mr 1.1.11-SNAPSHOT-latest e8fbf3bebd9b 46 seconds ago 244MB
onap/dmaap/dmaap-mr latest e8fbf3bebd9b 46 seconds ago 244MB
nexus3.onap.org:10003/onap/dmaap/dmaap-mr 1.1.11-SNAPSHOT-20190306T122553Z e8fbf3bebd9b 46 seconds ago 244MB
nexus3.onap.org:10003/onap/dmaap/dmaap-mr 1.1.11-SNAPSHOT-latest e8fbf3bebd9b 46 seconds ago 244MB
onap/dmaap/dmaap-mr 1.1.11-SNAPSHOT-20190306T121402Z 62f0a2a98c62 12 minutes ago 244MB
nexus3.onap.org:10003/onap/dmaap/dmaap-mr 1.1.11-SNAPSHOT-20190306T121402Z 62f0a2a98c62 12 minutes ago 244MB
openjdk 8-jre-alpine 1b46cc2ba839 4 weeks ago 85MB> docker-compose -f docker-compose-local.yml up
Test as step 1
#### Step 3: migrate pom to fabric8 docker-maven-plugin
- Note: spotify docker-maven-plugin does not run on Arm
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on project datarouter-prov: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException:
java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider: ExceptionInInitializerError: Can't overwrite cause with java.lang.UnsatisfiedLinkError: cannot determine CPU -> [Help 1]
- See: https://github.com/spotify/docker-maven-plugin/issues/233
- Note: spotify dockerfile-maven-plugin is alternate to fabric8, but other ONAP teams are using fabric8 so there
appears to be no compelling reason to stick w spotify
- Note: docker pull/push repos must be managed
- edit messageservice/pom.xml
- add pull repo defintion
Note that onap ~/.m2/settings.xml defines
<docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
which forces an amd64 specific image.
to support other platforms, add to docker-maven-plugin configuration:
<pullRegistry>${docker.pull.registry}</pullRegistry>
and invoke mvn with appropriate pull repo if building on non-Intel machine, e.g. on Arm
> mvn install -DskipTests -Pdocker -Ddocker.pull.registry=docker.io
- add push repo definition
add <pushRegistry>${docker.push.registry}</pushRegistry>
push to local registry to test*
- create src/main/resources/docker/Dockerfile
> $ mvn install -DskipTests -Pdocker -Ddocker.push.registry=localhost:5000 docker:push
- Test, As per step 2
#### Step 4: build and run on Arm
- terminal on Arm machine
> $ git clone https://gerrit.onap.org/r/dmaap/messagerouter/messageservice
- copy modified files from workstation to Arm server
$ scp pom.xml root@147.75.94.202:/root/onap/dmaap/messageservice
$ scp src/main/resources/docker/Dockerfile root@147.75.94.202:/root/onap/dmaap/messageservice/src/main/resources/docker
$ scp src/main/resources/docker-compose/docker-compose-local.yml root@147.75.94.202:/root/onap/dmaap/messageservice/src/main/resources/docker-compose
$ scp src/main/resources/docker-compose/MsgRtrApi.properties root@147.75.94.202:/root/onap/dmaap/messageservice/src/main/resources/docker-compose
> $ mvn clean install -DskipTests -Pdocker -Ddocker.pull.registry=docker.io>
- build kafka11aaf image (see separate guide)
- build zookeeper image (see separate guide)
$ cd src/main/resources/docker-compose
> $ docker-compose -f docker-compose-local.yml up -d
test - Test as above
DMAAP KAFKA11aaf
## dmaap kafka
...