Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Processed bsm features #2

Closed
wants to merge 64 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
b01d1a8
updates to use gihub artifacts for jpo-ode references
Michael7371 Jul 16, 2024
d9cdb94
env variable rename and documentation
Michael7371 Jul 16, 2024
85061b2
Add release notes and update the pom.xml version
drewjj Sep 6, 2024
7bef71f
Merge pull request #68 from usdot-jpo-ode/Update/release-notes-1.4.0
drewjj Sep 9, 2024
23adfe7
update Jpo-ode submodule to the latest version
SaikrishnaBairamoni Sep 30, 2024
2904a68
Merge pull request #69 from usdot-jpo-ode/release/2024-q3
SaikrishnaBairamoni Sep 30, 2024
e88017c
Update pom.xml
SaikrishnaBairamoni Sep 30, 2024
712b505
Update pom.xml
SaikrishnaBairamoni Sep 30, 2024
e72a111
Update pom.xml
SaikrishnaBairamoni Sep 30, 2024
3fe0077
Merge pull request #70 from usdot-jpo-ode/hotfix_1.4.1
SaikrishnaBairamoni Sep 30, 2024
ed6ffd2
update submodule ref with latest jpo-ode version
SaikrishnaBairamoni Sep 30, 2024
1800d42
Merge pull request #71 from usdot-jpo-ode/hotfix_1.4.2
dan-du-car Sep 30, 2024
7339843
Merge pull request #72 from usdot-jpo-ode/master
dan-du-car Oct 7, 2024
d1cd7e6
Adding zstd compression to GeoJsonConverter
John-Wiens Oct 23, 2024
380672f
updates to test ci cd with updated build pipeline
Michael7371 Oct 23, 2024
38a9a8a
Merge branch 'develop' into testing-github-artifacts
Michael7371 Oct 23, 2024
89b7397
fix environmental vars in docker build pipeline
Michael7371 Oct 23, 2024
77659b1
fixing other ci pipelines with new build process
Michael7371 Oct 23, 2024
e2bac23
Made kafka linger ms configurable
John-Wiens Oct 23, 2024
cd173e6
switching linger ms to 50 ms
John-Wiens Oct 23, 2024
67adda1
fixing ci workflow
Michael7371 Oct 23, 2024
8630476
testing artifact publishing
Michael7371 Oct 23, 2024
ddefcc8
fix failing action
Michael7371 Oct 23, 2024
fe4c8c7
fix syntax error
Michael7371 Oct 23, 2024
8f4f12c
github artifact env variables renaming
Michael7371 Oct 23, 2024
e60d991
testing different config
Michael7371 Oct 23, 2024
c789e3c
testing repackage skip
Michael7371 Oct 23, 2024
532b660
update testing with a token that can read and write packages
Michael7371 Oct 24, 2024
168a194
updates to use the jpo-utils repository
Michael7371 Oct 24, 2024
874254e
removing pull request trigger on artifact publishing
Michael7371 Oct 24, 2024
f0e31a1
updates to sample.env and docs
Michael7371 Oct 24, 2024
1fc3815
updates to the documentation on environmental variables
Michael7371 Oct 25, 2024
2c2cad9
adding docker compose errors to all required environmental variables
Michael7371 Oct 28, 2024
e3ff03c
Merge pull request #73 from usdot-jpo-ode/compression
John-Wiens Oct 28, 2024
a8d8a22
fix docker compose errors
Michael7371 Oct 28, 2024
4867495
fixing dockerfile warning
Michael7371 Oct 28, 2024
6d77cef
adding docs for docker-compose profiles
Michael7371 Oct 28, 2024
0efc72f
updates to address PR comments
Michael7371 Oct 28, 2024
d25ef4d
improved dockerfile caching
Michael7371 Oct 28, 2024
233b9ff
Merge pull request #75 from usdot-jpo-ode/Feature/submodule-refactor-…
Michael7371 Oct 28, 2024
cf47633
Make J2735 optional values optional in the JSON schema
drewjj Nov 18, 2024
bcba8c7
Upgrade ProcessedMap schema version to 2020 since GCP doesn't support…
drewjj Nov 18, 2024
ed7dcf1
Update schema versions to 2020
drewjj Nov 18, 2024
c7e854e
Added Logic to Generate timestamp from odeReceivedAt
John-Wiens Nov 20, 2024
7b3042f
Switching adopt builder to temurin
John-Wiens Nov 26, 2024
6f99eb1
Merge pull request #77 from usdot-jpo-ode/timestamp-modification
drewjj Nov 27, 2024
488b5b1
Merge pull request #78 from usdot-jpo-ode/adopt-workflow-fix
Michael7371 Dec 5, 2024
e8b0e41
Switch the Position3D back to a reference
drewjj Dec 10, 2024
0daa80f
Merge pull request #76 from usdot-jpo-ode/processedmap-schema-update
drewjj Dec 10, 2024
fe441eb
adding caching to github actions
Michael7371 Dec 24, 2024
02ed49d
Merge pull request #80 from usdot-jpo-ode/github-actions-caching
John-Wiens Dec 24, 2024
7143df9
Change ProcessedBsm to a Feature. Move metadata properties from Proc…
iyourshaw Dec 31, 2024
65daf7d
Update related classes and tests
iyourshaw Jan 1, 2025
63a4a57
Update sample bsm for test
iyourshaw Jan 6, 2025
2d280dd
Add more conditions to deserializer test
iyourshaw Jan 6, 2025
11cb4c3
Add serializer test for bsm
iyourshaw Jan 6, 2025
fa856a2
Update BsmFeatureTest
iyourshaw Jan 6, 2025
773053e
Fix tests
iyourshaw Jan 6, 2025
741a5df
Add more conditions to converter test
iyourshaw Jan 6, 2025
ee37a39
Fix converter; include metadata
iyourshaw Jan 6, 2025
e8e1dee
Make ProcessedBsmCollection generic
iyourshaw Jan 6, 2025
d80403c
Test artifact publish
iyourshaw Jan 6, 2025
ab14d59
Update imports
iyourshaw Jan 6, 2025
f385694
Test publish on pr edited
iyourshaw Jan 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/artifact-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Publish Java Package

on:
push:
tags:
- 'jpo-geojsonconverter-*'
pull_request:
types:
- edited

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: 'maven'

- name: Remove snapshot from version
run: |
cd jpo-geojsonconverter
mvn versions:set -DremoveSnapshot

- name: Build with Maven
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
MAVEN_GITHUB_TOKEN_NAME: ${{ vars.MAVEN_GITHUB_TOKEN_NAME }}
MAVEN_GITHUB_TOKEN: ${{ secrets.MAVEN_GITHUB_TOKEN }}
MAVEN_GITHUB_ORG: ${{ github.repository_owner }}
run: |
cd jpo-geojsonconverter
mvn -s settings.xml -B package --file pom.xml -DskipTests -Ppackage-jar

- name: Publish to GitHub Packages
run: |
cd jpo-geojsonconverter
mvn -s settings.xml --batch-mode -Dgithub_organization=${{ github.repository_owner }} deploy -DskipTests -Ppackage-jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_GITHUB_TOKEN_NAME: ${{ vars.MAVEN_GITHUB_TOKEN_NAME }}
MAVEN_GITHUB_TOKEN: ${{ secrets.MAVEN_GITHUB_TOKEN }}
MAVEN_GITHUB_ORG: ${{ github.repository_owner }}
19 changes: 15 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v6
with:
build-args: |
MAVEN_GITHUB_TOKEN_NAME=${{ vars.MAVEN_GITHUB_TOKEN_NAME }}
MAVEN_GITHUB_TOKEN=${{ secrets.MAVEN_GITHUB_TOKEN }}
MAVEN_GITHUB_ORG=${{ github.repository_owner }}
secrets: |
MAVEN_GITHUB_TOKEN: ${{ secrets.MAVEN_GITHUB_TOKEN }}
cache-from: type=gha
cache-to: type=gha,mode=max

sonar:
runs-on: ubuntu-latest
Expand All @@ -25,11 +34,13 @@ jobs:
with:
java-version: "21"
distribution: "temurin"
cache: 'maven'
- name: Run Sonar
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
MAVEN_GITHUB_TOKEN_NAME: ${{ vars.MAVEN_GITHUB_TOKEN_NAME }}
MAVEN_GITHUB_TOKEN: ${{ secrets.MAVEN_GITHUB_TOKEN }}
MAVEN_GITHUB_ORG: ${{ github.repository_owner }}
run: |
cd jpo-ode
mvn install -DskipTests
cd ../jpo-geojsonconverter
mvn -e -X clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.projectKey=usdot-jpo-ode_jpo-geojsonconverter -Dsonar.projectName=jpo-geojsonconverter -Dsonar.organization=usdot-jpo-ode -Dsonar.host.url=https://sonarcloud.io -Dsonar.branch.name=$GITHUB_REF_NAME
cd jpo-geojsonconverter
mvn -s settings.xml -e -X clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.projectKey=usdot-jpo-ode_jpo-geojsonconverter -Dsonar.projectName=jpo-geojsonconverter -Dsonar.organization=usdot-jpo-ode -Dsonar.host.url=https://sonarcloud.io -Dsonar.branch.name=$GITHUB_REF_NAME
11 changes: 10 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Docker build

on:
pull_request:
types: [opened, synchronize, reopened]
types: [opened, synchronize, reopened]

jobs:
jpo-geojsonconverter:
Expand All @@ -14,3 +14,12 @@ jobs:
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v6
with:
build-args: |
MAVEN_GITHUB_TOKEN_NAME=${{ vars.MAVEN_GITHUB_TOKEN_NAME }}
MAVEN_GITHUB_TOKEN=${{ secrets.MAVEN_GITHUB_TOKEN }}
MAVEN_GITHUB_ORG=${{ github.repository_owner }}
secrets: |
MAVEN_GITHUB_TOKEN: ${{ secrets.MAVEN_GITHUB_TOKEN }}
cache-from: type=gha
cache-to: type=gha,mode=max
8 changes: 8 additions & 0 deletions .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,11 @@ jobs:
with:
push: true
tags: usdotjpoode/geojsonconverter:${{ env.TAG }}
build-args: |
MAVEN_GITHUB_TOKEN_NAME=${{ vars.MAVEN_GITHUB_TOKEN_NAME }}
MAVEN_GITHUB_TOKEN=${{ secrets.MAVEN_GITHUB_TOKEN }}
MAVEN_GITHUB_ORG=${{ github.repository_owner }}
secrets: |
MAVEN_GITHUB_TOKEN: ${{ secrets.MAVEN_GITHUB_TOKEN }}
cache-from: type=gha
cache-to: type=gha,mode=max
7 changes: 3 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[submodule "jpo-ode"]
path = jpo-ode
url = https://github.com/usdot-jpo-ode/jpo-ode.git
branch = develop
[submodule "jpo-utils"]
path = jpo-utils
url = https://github.com/usdot-jpo-ode/jpo-utils
29 changes: 12 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
FROM maven:3.8-eclipse-temurin-21-alpine as builder
FROM maven:3.8-eclipse-temurin-21-alpine AS builder

WORKDIR /home

# Copy only the files needed to avoid putting all sorts of junk from your local env on to the image
COPY ./jpo-ode/pom.xml ./jpo-ode/
COPY ./jpo-ode/jpo-ode-common/pom.xml ./jpo-ode/jpo-ode-common/
COPY ./jpo-ode/jpo-ode-common/src ./jpo-ode/jpo-ode-common/src
COPY ./jpo-ode/jpo-ode-plugins/pom.xml ./jpo-ode/jpo-ode-plugins/
COPY ./jpo-ode/jpo-ode-plugins/src ./jpo-ode/jpo-ode-plugins/src
COPY ./jpo-ode/jpo-ode-core/pom.xml ./jpo-ode/jpo-ode-core/
COPY ./jpo-ode/jpo-ode-core/src ./jpo-ode/jpo-ode-core/src/
COPY ./jpo-ode/jpo-ode-svcs/pom.xml ./jpo-ode/jpo-ode-svcs/
COPY ./jpo-ode/jpo-ode-svcs/src ./jpo-ode/jpo-ode-svcs/src
ARG MAVEN_GITHUB_TOKEN

Check warning on line 5 in Dockerfile

View workflow job for this annotation

GitHub Actions / jpo-geojsonconverter

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "MAVEN_GITHUB_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 5 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ARG "MAVEN_GITHUB_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ARG MAVEN_GITHUB_ORG

COPY ./jpo-geojsonconverter/pom.xml ./jpo-geojsonconverter/
COPY ./jpo-geojsonconverter/src ./jpo-geojsonconverter/src

WORKDIR /home/jpo-ode
ENV MAVEN_GITHUB_TOKEN=$MAVEN_GITHUB_TOKEN

Check warning on line 8 in Dockerfile

View workflow job for this annotation

GitHub Actions / jpo-geojsonconverter

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "MAVEN_GITHUB_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Check warning on line 8 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "MAVEN_GITHUB_TOKEN") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/
ENV MAVEN_GITHUB_ORG=$MAVEN_GITHUB_ORG

RUN mvn install -DskipTests
COPY ./jpo-geojsonconverter/pom.xml ./jpo-geojsonconverter/
COPY ./jpo-geojsonconverter/settings.xml ./jpo-geojsonconverter/

# Download dependencies alone to cache them first
WORKDIR /home/jpo-geojsonconverter
RUN mvn -s settings.xml dependency:resolve

RUN mvn clean package -DskipTests
# Copy the source code and build the geojson converter
COPY ./jpo-geojsonconverter/src ./src
RUN mvn -s settings.xml install -DskipTests

FROM eclipse-temurin:21-jre-alpine

Expand Down
80 changes: 71 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,18 +213,18 @@ Recommended machine specs running Docker to run the GeoJsonConverter:
- Minimum RAM: 16 GB
- Minimum storage space: 100 GB
- Supported operating systems:
- Ubuntu 18.04 Linux (Recommended)
- Windows 10 Professional (Professional version required for Docker virtualization)
- Ubuntu 20.04 Linux (Recommended)
- Windows 10/11 Professional (Professional version required for Docker virtualization)
- OSX 10 Mojave

The GeoJsonConverter software can run on most standard Window, Mac, or Linux based computers with
Pentium core processors. Performance of the software will be based on the computing power and available RAM in
the system. Larger data flows can require much larger space requirements depending on the
amount of data being processed by the software. The GeoJsonConverter software application was developed using the open source programming language Java. If running the GeoJsonConverter outside of Docker, the application requires the Java 11 runtime environment.
amount of data being processed by the software. The GeoJsonConverter software application was developed using the open source programming language Java. If running the GeoJsonConverter outside of Docker, the application requires the Java 21 runtime environment.

### Software Prerequisites

The GeoJsonConverter is a micro service that runs as an independent application but serves the sole purpose of converting JSON objects created by the JPO-ODE via Apache Kafka. To support these JSON objects, the GeoJsonConverter application utilizes some classes from the JPO-ODE repository. This is included into the GeoJsonConverter as a submodule but the JPO-ODE should also be run independently of the jpo-geojsonconverter. The JPO-ODE is still required to launch Kafka, Zookeeper, the ASN1 decoder and create the required Kafka topics. All other required dependencies will automatically be downloaded and installed as part of the Docker build process.
The GeoJsonConverter is a micro service that runs as an independent application but serves the sole purpose of converting JSON objects created by the JPO-ODE via Apache Kafka. To support these JSON objects, the GeoJsonConverter application utilizes some classes from the JPO-ODE. These classes are referenced in the GeoJsonConverter by pulling the built `.jar` artifact from GitHub Maven Central. The JPO-ODE is still required to launch Kafka, Zookeeper, the ASN1 decoder and create the required Kafka topics. All other required dependencies will automatically be downloaded and installed as part of the Docker build process.

- Docker: <https://docs.docker.com/engine/installation/>
- Docker-Compose: <https://docs.docker.com/compose/install/>
Expand All @@ -247,7 +247,7 @@ Read the following guides to familiarize yourself with GeoJsonConverter's Docker
The GeoJsonConverter configuration is customized through the environment variables provided to Docker when Docker-Compose runs the Docker built GeoJsonConverter image. You may customize the Kafka broker endpoint.

**Important!**
You must rename `sample.env` to `.env` for Docker to automatically read the file. Do not push this file to source control.
You must rename `sample.env` to `.env` in both the [root directory](sample.env) and in [jpo-utils](jpo-utils/sample.env) for Docker to automatically read the file. Do not push this file to source control.

[Back to top](#toc)

Expand Down Expand Up @@ -303,11 +303,57 @@ docker-compose ps

Verify the jpo-ode, kafka, zookeeper, asn1-decoder and asn1-encoder are running before performing step 3.

#### Step 3 - Build and run jpo-geojsonconverter application
#### Step 3 - Generate GitHub Token

A GitHub token is required to pull artifacts from GitHub repositories. This is required to obtain the jpo-ode jars and must be done before attempting to build this repository.

1. Log into GitHub.
2. Navigate to Settings -> Developer settings -> Personal access tokens.
3. Click "New personal access token (classic)".
1. As of now, GitHub does not support `Fine-grained tokens` for obtaining packages.
4. Provide a name and expiration for the token.
5. Select the `read:packages` scope.
6. Click "Generate token" and copy the token.
7. Copy the token name and token value into your `.env` file.
8. Create a copy of [settings.xml](jpo-geojsonconverter/settings.xml) and save it to `~/.m2/settings.xml`
9. Update the variables in your `~/.m2/settings.xml` with the token value and target jpo-ode organization. Here is an example filled in `settings.xml` file:

```XML
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<activeProfiles>
<activeProfile>default</activeProfile>
</activeProfiles>
<servers>
<server>
<id>github</id>
<username>jpo_geojsonconverter</username>
<password>ghp_token-string-value</password>
</server>
</servers>
<profiles>
<profile>
<id>default</id>
<repositories>
<repository>
<id>github</id>
<name>GitHub Apache Maven Packages</name>
<url>https://maven.pkg.github.com/usdot-jpo-ode/jpo-ode</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
</settings>
```

#### Step 4 - Build and run jpo-geojsonconverter application

**Notes:**
- Docker builds may fail if you are on a corporate network due to DNS resolution errors.
- In order for Docker to automatically read the environment variable file, you must rename it from `sample.env` to `.env`. **This file will contain private keys, do not put add it to version control.**
- In order for Docker to automatically read the environment variable file, you must rename it from `sample.env` to `.env`. **This file will contain private keys, do not put add it to version control.**. A copy of the `sample.env` file must be created in [jpo-utils](jpo-utils/sample.env) in order for the base applications (kafka, mongo, etc.) to start up correctly
- Unless you intend to run geojsonconverter without jpo-ode, replace the contents of docker-compose.yml with those of docker-compose-standalone.yml.

Navigate to the root directory of the jpo-geojsonconverter project and run the following command:
Expand Down Expand Up @@ -343,13 +389,29 @@ docker-compose ps

### Purpose & Usage

- The DOCKER_HOST_IP environment variable is used to communicate with the bootstrap server that the instance of Kafka is running on.
#### Runtime Environmental Variables:

These variables are required for the image during runtime:

- The `DOCKER_HOST_IP` environment variable is used to communicate with the bootstrap server that the instance of Kafka is running on.
- The `GEOMETRY_OUTPUT_MODE` environmental variable is used to enable the Processed Map topology to create Well Known Text formatted messages on the `topic.ProcessedMapWKT` topic. Options are `GEOJSON_ONLY` or `WKT`, if the variable is not set it will default to `GEOJSON_ONLY`.
-
#### Image Building Environmental Variables:

These variables are passed into the Docker image as build arguments and allow for pulling the jpo-ode `.jar` files from GitHub Maven Central.

- The `MAVEN_GITHUB_TOKEN` environment variable is the value of the generated token from xxx used for pulling the jpo-ode java image.
- The `MAVEN_GITHUB_ORG` environment variable is the name of the GitHub organization to use for the jpo-ode repository.

### Values
In order to utilize Confluent Cloud:

- DOCKER_HOST_IP must be set to the bootstrap server address (excluding the port)

- `KAFKA_TYPE` must be set to "CONFLUENT"
- `CONFLUENT_KEY` must be set to the API key being utilized for CC
- `CONFLUENT_SECRET` must be set to the API secret being utilized for CC

[Back to top](#toc)

<!--
Expand All @@ -375,7 +437,7 @@ This section outlines the software technology stacks of the GeoJsonConverter.

### ODE Code

- [Java 11](https://openjdk.java.net/)
- [Java](https://openjdk.java.net/)
- [Maven](https://maven.apache.org/)
- [Spring Boot](http://spring.io/projects/spring-boot)
- [Logback](https://logback.qos.ch/)
Expand Down
14 changes: 0 additions & 14 deletions docker-compose-standalone.yml

This file was deleted.

15 changes: 0 additions & 15 deletions docker-compose.confluent.yml

This file was deleted.

Loading
Loading