How to set up a local DMaaP installation in Docker for testing

It is sometimes convenient to have a local installation of DMaaP on your machine for testing purposes. For example, for testing policies, you can connect the Policy Framework to a local installation of DMaaP and use curl to issue the policy REST calls to the local DMaaP. For this howto, in order to avoid a dependency on A&AI, checks towards A&AI are commented out. This howto was written on the Amsterdam versions of DMaaP. It was executed on a Macbook Pro running macOS 10.13.3.

Step-by-step guide

  1. Create a new directory, let's call it "local-dmaap", and go into the directory

    mkdir <path-to>/local-dmaap cd <path-to>/local-dmaap
  2. Clone the DMaaP msgrtr and messageservice repositories

    git clone https://gerrit.onap.org/r/dmaap/messagerouter/msgrtr git clone https://gerrit.onap.org/r/dmaap/messagerouter/messageservice
  3. Check out the Amsterdam branches of the DMaaP repos

    cd msgrtr git co amsterdam cd ../messageservice git co amsterdam cd ..
  4. In order to remove the need to install A&AI, comment out as follows in msgrtr src/main/java/com/att/nsa/cambria/service/impl/TopicServiceImpl.java:

  5. Build the msgrtr, skipping tests if you wish. Once the build completes, we're finished in msgrtr.

  6. In messageservice, the start-kafka.sh script breaks with the latest version of Scala and Kafka unless a new line is added to the end of the server.properties file. Edit the messageservice src/main/resources/docker-compose/start-kafka.sh as follows:

  7. Ensure that the version of msgrtr dependency used in messageservice pom.xml is the local one created above, check your pom.xml in messageservice, specifically you must specify if msgrtr is a SNAPSHOT version. for example, see below:

  8. Build the message service, skipping tests if you wish.

  9. Ensure Docker is running on your machine. Clear down all relevant containers and images in your docker that might interfere with DMaaP. Use the commands below WITH CARE!

  10. In messageservice, copy the "appl" directory to target/classes/docker. This copies the configuration for DMaaP into the location in which we will build the docker images and the docker-compose setup.

  11. In messageservice, copy the "startup.sh" script target/classes/docker. This is the startup shell script for the DMaaP message service in Docker.

  12. If /var/tmp/MsgRtr.properties file or directory exists on /var/tmp,delete it. This is the file where we will specify the local properties for Kafka/Zookeeper for DMaaP.

  13. Copy the template MsgRtr properties to /var/tmp

  14. Edit /var/tmp/MsgRtrApi.properties as follows to put in the host names and ports for Kafka and Zookeeper in our docker-compose setup:

  15. Build the adapted DMaaP docker image, it will be tagged as dmaap:localadapt

  16. Now we prepare the docker-compose setup for DMaaP. Go to messageservice/target/classes/docker-compose and edit Dockerfile, changing the KAFKA_VERSION to 1.0.0 and the SCALA_VERSION to 2.12

  17. Edit docker-compose.yml to change the name of th DMaaP docker image to use our locally adapted DMaaP image:

  18. On macOS only, edit docker-compose.yml to change var/tmp to /private/var/tmp (ensure you have /private/var/tmp shared with Docker on macOS).

  19. Start DMaaP, crossing your fingers really tightly!

  20. Check that DMaaP is running with a curl request to list topics

  21. Create a topic called MyTopic

  22. List the topics again, our topic should now be there:











Related articles