This is an automated email from the ASF dual-hosted git repository. nickallen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/metron.git
The following commit(s) were added to refs/heads/master by this push: new eaee9f8 METRON-2266 REST debug instructions (merrimanr via nickwallen) closes apache/metron#1520 eaee9f8 is described below commit eaee9f84f27c9fcf35cf2b0492352016b5b88b76 Author: merrimanr <merrim...@gmail.com> AuthorDate: Mon Sep 30 10:56:08 2019 -0400 METRON-2266 REST debug instructions (merrimanr via nickwallen) closes apache/metron#1520 --- metron-interface/metron-rest/README.md | 19 ++++++++ metron-interface/metron-rest/pom.xml | 49 +++++++++++++++++++++ .../readme-images/debug-configuration.png | Bin 0 -> 119283 bytes .../readme-images/debug-maven-profile.png | Bin 0 -> 240634 bytes 4 files changed, 68 insertions(+) diff --git a/metron-interface/metron-rest/README.md b/metron-interface/metron-rest/README.md index aa28260..a5b0e2e 100644 --- a/metron-interface/metron-rest/README.md +++ b/metron-interface/metron-rest/README.md @@ -26,6 +26,7 @@ This module provides a RESTful API for interacting with Metron. * [Security](#security) * [API](#api) * [Testing](#testing) +* [Local Development](#local-development) ## Prerequisites @@ -1125,6 +1126,24 @@ METRON_SPRING_OPTIONS="--kerberos.enabled=true" The metron-rest application will be available at http://node1:8082/swagger-ui.html#/. +## Local Development + +The REST application can be run in DEBUG mode in an IDE (integrated development environment). This can be a useful tool for development and troubleshooting issues because it enables fast iteration and breakpoints anywhere in code that runs in REST. +The following instructions are for Intellij. + +1. Build Metron from the root directory with `mvn clean install -DskipTests` +1. Spin up full dev (required to start REST locally) +1. Create a Run/Debug Configuration in Intellij using the dropdown in the top right or the `Run > Edit Configurations...` menu item +1. Add a `Spring Boot` Configuration and set the properties as shown in the screenshot below: +![debug configuration](readme-images/debug-configuration.png) +1. Using the Maven Projects tab, set check the `local-dev` profile in the `Profiles` section: +![debug maven profile](readme-images/debug-maven-profile.png) +1. Start the `REST` Configuration in Debug mode using the Debug button in the top right or the `Run > Debug 'REST'` menu item + +The REST application should now available at `http://localhost:8080/swagger-ui.html`. + +Note: Some endpoints may not work correctly due to the networking setup in full dev. This includes endpoints that connect to Kafka, HDFS and HBase. Copying the `hbase-site.xml` file from `/etc/hbase/conf/` on full dev to `/metron-interface/metron-rest/src/main/resources` locally will suppress the Zookeeper errors on startup. + ## License This project depends on the Java Transaction API. See https://java.net/projects/jta-spec/ for more details. diff --git a/metron-interface/metron-rest/pom.xml b/metron-interface/metron-rest/pom.xml index c67a5d5..66dd99e 100644 --- a/metron-interface/metron-rest/pom.xml +++ b/metron-interface/metron-rest/pom.xml @@ -702,5 +702,54 @@ </build> </profile> + <profile> + + <id>local-dev</id> + <dependencies> + <dependency> + <groupId>org.apache.metron</groupId> + <artifactId>metron-parsers</artifactId> + <version>${project.parent.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.metron</groupId> + <artifactId>metron-parsing-storm</artifactId> + <version>${project.parent.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.metron</groupId> + <artifactId>metron-parsers-common</artifactId> + <version>${project.parent.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.metron</groupId> + <artifactId>metron-indexing-common</artifactId> + <version>${project.parent.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.metron</groupId> + <artifactId>metron-elasticsearch-common</artifactId> + <version>${project.parent.version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.javassist</groupId> + <artifactId>javassist</artifactId> + <version>3.19.0-GA</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.apache.metron</groupId> + <artifactId>stellar-common</artifactId> + <version>${project.parent.version}</version> + <scope>compile</scope> + </dependency> + </dependencies> + </profile> + </profiles> </project> diff --git a/metron-interface/metron-rest/readme-images/debug-configuration.png b/metron-interface/metron-rest/readme-images/debug-configuration.png new file mode 100644 index 0000000..ccea8e0 Binary files /dev/null and b/metron-interface/metron-rest/readme-images/debug-configuration.png differ diff --git a/metron-interface/metron-rest/readme-images/debug-maven-profile.png b/metron-interface/metron-rest/readme-images/debug-maven-profile.png new file mode 100644 index 0000000..29da9c5 Binary files /dev/null and b/metron-interface/metron-rest/readme-images/debug-maven-profile.png differ