Skip to content

Commit

Permalink
Merge release/2.1.0 branch into master (#77)
Browse files Browse the repository at this point in the history
<!-- Thanks for the contribution, this is awesome. -->

# PR Details
Merge the release/2.1.0 branch into the master branch as part of the
release process. This merge should be tagged and then deployed on the
new production website.

Note: #76
Should be merged first
## Description

<!--- Describe your changes in detail -->

## Related GitHub Issue

<!--- This project only accepts pull requests related to open GitHub
issues or Jira Keys -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please DO NOT name partially fixed issues, instead open an issue
specific to this fix -->
<!--- Please link to the issue here: -->

## Related Jira Key

[Map-88](https://usdot-carma.atlassian.net/browse/MAP-88)

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [ ] Defect fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that cause existing functionality
to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] I have added any new packages to the sonar-scanner.properties file
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the
[**CONTRIBUTING**](https://github.com/usdot-fhwa-stol/carma-platform/blob/develop/Contributing.md)
document.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
  • Loading branch information
SaikrishnaBairamoni authored Dec 30, 2024
2 parents cedbd48 + 2875a2e commit 7a6d7b7
Show file tree
Hide file tree
Showing 101 changed files with 8,548 additions and 435 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@ jobs:
options: --user root
steps:
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install # This action is to install and build subfolders in project
run: |
cd $GITHUB_WORKSPACE
export LD_LIBRARY_PATH=/__w/connectedvcs-tools/connectedvcs-tools/fedgov-cv-lib-asn1c/third_party_lib
cd /__w/connectedvcs-tools/connectedvcs-tools/fedgov-cv-parent && mvn -e -X clean install -Dmaven.test.failure.ignore=true
cd /__w/connectedvcs-tools/connectedvcs-tools/fedgov-cv-lib-asn1c && mvn -e -X clean install -Dmaven.test.failure.ignore=true
cd /__w/connectedvcs-tools/connectedvcs-tools/fedgov-cv-mapencoder && mvn -e -X clean install -Dmaven.test.failure.ignore=true
cd /__w/connectedvcs-tools/connectedvcs-tools/fedgov-cv-rgaencoder && mvn -e -X clean install -Dmaven.test.failure.ignore=true
cd /__w/connectedvcs-tools/connectedvcs-tools/fedgov-cv-message-builder && mvn -e -X clean install -Dmaven.test.failure.ignore=true
cd /__w/connectedvcs-tools/connectedvcs-tools/fedgov-cv-ISDcreator-webapp && mvn -e -X clean install -Dmaven.test.failure.ignore=true
cd /__w/connectedvcs-tools/connectedvcs-tools/fedgov-cv-TIMcreator-webapp && mvn -e -X clean install -Dmaven.test.failure.ignore=true
cd /__w/connectedvcs-tools/connectedvcs-tools/fedgov-cv-map-services-proxy && mvn -e -X clean install -Dmaven.test.failure.ignore=true
jar cvf /__w/connectedvcs-tools/connectedvcs-tools/root.war -C /__w/connectedvcs-tools/connectedvcs-tools/root .
- name: Archive generated Class files
uses: actions/upload-artifact@v3 # Archive the generated class files after the build action used for deployment
uses: actions/upload-artifact@v4 # Archive the generated class files after the build action used for deployment
with:
name: Class files
path: |
Expand Down Expand Up @@ -94,12 +95,14 @@ jobs:
sonar.projectBaseDir=$GITHUB_WORKSPACE
sonar.projectKey=usdot-fhwa-stol_connectedvcs-tools
sonar.projectName=connectedvcs-tools
sonar.exclusions=**/target/**
sonar.coverage.jacoco.xmlReportPaths=$GITHUB_WORKSPACE/connectedvcs-tools/connectedvcs-tools/fedgov-cv-TIMcreator-webapp/target/site/jacoco/jacoco.xml,\
$GITHUB_WORKSPACE/connectedvcs-tools/connectedvcs-tools/fedgov-cv-ISDcreator-webapp/target/site/jacoco/jacoco.xml,\
$GITHUB_WORKSPACE/connectedvcs-tools/connectedvcs-tools/fedgov-cv-lib-asn1c/target/site/jacoco/jacoco.xml,\
$GITHUB_WORKSPACE/connectedvcs-tools/connectedvcs-tools/fedgov-cv-mapencoder/target/site/jacoco/jacoco.xml,\
$GITHUB_WORKSPACE/connectedvcs-tools/connectedvcs-tools/fedgov-cv-message-builder/target/site/jacoco/jacoco.xml,\
$GITHUB_WORKSPACE/connectedvcs-tools/connectedvcs-tools/fedgov-cv-map-services-proxy/target/site/jacoco/jacoco.xml
sonar.java.binaries=/__w/connectedvcs-tools/connectedvcs-tools/fedgov-cv-TIMcreator-webapp/target,\
/__w/connectedvcs-tools/connectedvcs-tools/fedgov-cv-ISDcreator-webapp/target,\
/__w/connectedvcs-tools/connectedvcs-tools/fedgov-cv-lib-asn1c/target,\
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ target/
.classpath
.vscode/
root.war
private-resources.war
75 changes: 48 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
FROM gradle:7.4.2-jdk8 AS gradle-build
ARG TOKEN
RUN git clone https://$TOKEN@github.com/usdot-fhwa-stol/CARMASensitive.git
ARG USE_SSL
RUN ls -la && pwd
FROM maven:3.8.5-jdk-8-slim AS mvn-build
ADD . /root
COPY . /root

# Install gettext to use envsubst
RUN apt-get update && \
apt-get install -y gettext-base && \
apt-get clean

# Update the web.xml based on SSL selection
RUN if [ "$USE_SSL" = "true" ]; then \
export SECURITY_CONSTRAINT="<security-constraint><web-resource-collection><web-resource-name>Everything</web-resource-name><url-pattern>/*</url-pattern></web-resource-collection><user-data-constraint><transport-guarantee>CONFIDENTIAL</transport-guarantee></user-data-constraint></security-constraint>"; \
else \
export SECURITY_CONSTRAINT=""; \
fi && \
envsubst '$SECURITY_CONSTRAINT' < /root/root/WEB-INF/web.xml > /tmp/web.xml.tmp && \
mv /tmp/web.xml.tmp /root/root/WEB-INF/web.xml && \
envsubst '$SECURITY_CONSTRAINT' < /root/fedgov-cv-TIMcreator-webapp/src/main/webapp/WEB-INF/web.xml > /tmp/web.xml.tmp && \
mv /tmp/web.xml.tmp /root/fedgov-cv-TIMcreator-webapp/src/main/webapp/WEB-INF/web.xml && \
envsubst '$SECURITY_CONSTRAINT' < /root/fedgov-cv-ISDcreator-webapp/src/main/webapp/WEB-INF/web.xml > /tmp/web.xml.tmp && \
mv /tmp/web.xml.tmp /root/fedgov-cv-ISDcreator-webapp/src/main/webapp/WEB-INF/web.xml

# Run the Maven build
RUN cd /root/fedgov-cv-parent \
&& mvn install -DskipTests
RUN cd /root/fedgov-cv-lib-asn1c \
&& mvn install -DskipTests
RUN cd /root/fedgov-cv-mapencoder \
&& mvn install -DskipTests
RUN cd /root/fedgov-cv-message-builder \
&& mvn install -DskipTests
RUN cd /root/fedgov-cv-ISDcreator-webapp \
&& mvn install -DskipTests
RUN cd /root/fedgov-cv-TIMcreator-webapp \
&& mvn install -DskipTests
RUN cd /root/fedgov-cv-map-services-proxy \
&& mvn clean install -DskipTests
RUN jar cvf /root/private-resources.war -C /root/private-resources .
RUN jar cvf /root/root.war -C /root/root .
COPY ./build.sh /root
WORKDIR /root
RUN ./build.sh


FROM jetty:9.4.46-jre8-slim
ARG USE_SSL
# Install the generated WAR files
COPY --from=mvn-build /root/fedgov-cv-ISDcreator-webapp/target/isd.war /var/lib/jetty/webapps
COPY --from=mvn-build /root/fedgov-cv-TIMcreator-webapp/target/tim.war /var/lib/jetty/webapps
Expand All @@ -36,16 +42,31 @@ RUN mkdir -p /var/lib/jetty/webapps/third_party_lib
COPY --from=mvn-build /root/fedgov-cv-lib-asn1c/third_party_lib/libasn1c.so /var/lib/jetty/webapps/third_party_lib
COPY --from=mvn-build /root/fedgov-cv-lib-asn1c/third_party_lib/libasn1c_x64.so /var/lib/jetty/webapps/third_party_lib
COPY --from=mvn-build /root/fedgov-cv-lib-asn1c/third_party_lib/libasn1c_x86.so /var/lib/jetty/webapps/third_party_lib
COPY --from=mvn-build /root/fedgov-cv-lib-asn1c/third_party_lib/libasn1c_rga.so /var/lib/jetty/webapps/third_party_lib

#Create env file
# Create library path env
USER root
ENV LD_LIBRARY_PATH /var/lib/jetty/webapps/third_party_lib
ENV LD_LIBRARY_PATH=/var/lib/jetty/webapps/third_party_lib
RUN ldconfig

RUN cd /var/lib/jetty \
&& echo 'log4j2.version=2.23.1' >> start.d/logging-log4j2.ini
RUN java -jar $JETTY_HOME/start.jar --create-files
WORKDIR /var/lib/jetty
RUN echo 'log4j2.version=2.23.1' >> start.d/logging-log4j2.ini && \
java -jar "$JETTY_HOME"/start.jar --create-files

# Prepare files for SSL
COPY keystore* /tmp/
COPY ssl.ini /tmp/

RUN java -jar $JETTY_HOME/start.jar --add-to-start=https
COPY --from=gradle-build /home/gradle/CARMASensitive/maptool/keystore* /var/lib/jetty/etc/
COPY --from=gradle-build /home/gradle/CARMASensitive/maptool/ssl.ini /var/lib/jetty/start.d/
# Conditionally add SSL or non-SSL based on the USE_SSL environment variable
RUN if [ "$USE_SSL" = "true" ]; then \
if [ -f /tmp/ssl.ini ]; then \
java -jar "$JETTY_HOME"/start.jar --add-to-start=https; \
cp /tmp/keystore* /var/lib/jetty/etc/; \
cp /tmp/ssl.ini /var/lib/jetty/start.d/; \
else \
echo "SSL is enabled, but keystore or ssl.ini files are missing."; \
exit 1; \
fi; \
else \
java -jar "$JETTY_HOME"/start.jar --add-to-start=http; \
fi
20 changes: 7 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,23 @@ This repository is a monorepo combining the repository histories of each of the
ConnectedVCS Tool packages. Each subfolder corresponds to one of the original
repositories used for ConnectedVCS Tools development.

## Setup Path
1. After cloning the repo, set up LD_LIBRARY_PATH by running `LD_LIBRARY_PATH="[path_to_connectedvcs-tools]/fedgov-cv-lib-asn1c/third_party_lib"`.
2. Then, run `export LD_LIBRARY_PATH`.
## Docker Instructions
Build and setup instructions for the docker image can be found in the [Docker Instructions](docs/Docker_Instructions.md).

## Build Instructions
1. Install JDK and Maven.
2. Run `sudo ./build.sh`.

## Deployment
1. Locate `root.war`,`isd.war` and `tim.war` in `connectedvcs-tools/`, `connectedvcs-tools/fedgov-cv-ISDcreator-webapp/target` and `connectedvcs-tools/fedgov-cv-TIMcreator-webapp/target` respectively.
2. Deploy as servlets in conjunction with Apache Tomcat.
## Local Instructions
Build and setup instructions for running ConnectedVCS Tools locally can be found in the [Local Instructions](docs/Local_Instructions.md).

## Contribution
Welcome to the ConnectedVCS Tools contributing guide. Please read this guide to learn about our development process, how to propose pull requests and improvements, and how to build and test your changes to this project. [ConnectedVCS Tools Contributing Guide](Contributing.md)
Welcome to the ConnectedVCS Tools contributing guide. Please read this guide to learn about our development process, how to propose pull requests and improvements, and how to build and test your changes to this project. [ConnectedVCS Tools Contributing Guide](Contributing.md).

## Code of Conduct
Please read our [ConnectedVCS Tools Code of Conduct](Code_of_Conduct.md) which outlines our expectations for participants within the Connected Vehicle (CV) community, as well as steps to reporting unacceptable behavior. We are committed to providing a welcoming and inspiring community for all and expect our code of conduct to be honored. Anyone who violates this code of conduct may be banned from the community.

## Attribution
The development team would like to acknowledge the people who have made direct contributions to the design and code in this repository. [ConnectedVCS Tools Attribution](ATTRIBUTION.md)
The development team would like to acknowledge the people who have made direct contributions to the design and code in this repository. [ConnectedVCS Tools Attribution](ATTRIBUTION.md).

## License
By contributing to the Federal Highway Administration (FHWA) ConnectedVCS Tools, you agree that your contributions will be licensed under its Apache License 2.0 license. [ConnectedVCS Tools License](LICENSE)
By contributing to the Federal Highway Administration (FHWA) ConnectedVCS Tools, you agree that your contributions will be licensed under its Apache License 2.0 license. [ConnectedVCS Tools License](LICENSE).

## Contact
For more information, contact CAVSupportServices@dot.gov.
Expand Down
7 changes: 6 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ mvn install -DskipTests=true
cd ../fedgov-cv-mapencoder/
mvn install -DskipTests=true

cd ../fedgov-cv-rgaencoder/
mvn install -DskipTests=true

cd ../fedgov-cv-message-builder/
mvn install -DskipTests=true

Expand All @@ -20,4 +23,6 @@ mvn install -DskipTests=true
cd ../fedgov-cv-map-services-proxy/
mvn install -DskipTests=true

jar cvf ../root.war -C ../root .
jar cvf ../private-resources.war -C ../private-resources .
jar cvf ../root.war -C ../root .

16 changes: 16 additions & 0 deletions docs/BingMaps_API_Key_Guidance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Bing Maps API Key Guidance
----------------------------

**NOTE: Bing Maps is now deprectated. We will be migrating to a different map provider.**

The current version of the MAP Creation Tool uses Bing Maps for its base map. An API key must be generated by each individual user if a personal deployment of the tool is desired. By default, we recommend securing your API keys according to the official instructions on [Enhanced Security for Bing Maps API Keys](https://blogs.bing.com/maps/2018-05/Announcing-Enhanced-Security-for-Bing-Maps-API-Keys). Enabling security will ensure no bad actors will be able to abuse the use of your personal API keys.

In case the tool will not be publically available, the security feature does not need to be enabled. However, it is still recommended to periodically check the usage of your keys.

### **Getting a Bing Maps API Key**

An account with Bing Maps can be created using the [Bing Maps Portal](https://www.bingmapsportal.com/). After an account is created, you may follow the official instructions on [Creating a Bing Maps Key](https://learn.microsoft.com/en-us/bingmaps/getting-started/bing-maps-dev-center-help/getting-a-bing-maps-key).

### **Using your API Key**

Once a key is obtained, please insert your key and any arbitrary username in the [ISDcreator-webapp-keys](/private-resources/js/ISDcreator-webapp-keys.js) file and build your updated ConnectedVCS Tools using either the [Local](/docs/Local_Instructions.md) or [Docker](/docs/Docker_Instructions.md) build instructions.
56 changes: 56 additions & 0 deletions docs/Docker_Instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Running Dockerized ConnectedVCS Tools
If you are running ConnectedVCS Tools using a docker image, you can use the following instructions:

**NOTE:** Bing Maps is now deprecated and new users are no longer allowed to create API keys. We will be migrating to a different map provider and updating this documentation soon.

## Prerequisites
ConnectedVCS Tools has been developed using Ubuntu 20.04 and Ubuntu 22.04. Further testing with other operating systems is needed before guidance is created. For the moment, please use Ubuntu 20.04 or later [Ubuntu LTS Release](https://releases.ubuntu.com/).

### Install Docker CE
Instructions for installing Docker may change, so please use the current instructions at the Docker website:
https://docs.docker.com/desktop/install/linux-install/.

## Run the ConnectedVCS Tools Image

### Build a Custom Image

1. Clone the ConnectedVCS Tools respository:
```
git clone https://github.com/usdot-fhwa-stol/connectedvcs-tools.git
```
2. Note: Placeholder for map API key generation.

3. Enter a map API key and username in [ISDcreator-webapp-keys](/private-resources/js/ISDcreator-webapp-keys.js)
and API key in [application.properties](/fedgov-cv-map-services-proxy/src/main/resources/application.properties#L2).

4. Create a new Google Maps API Key using the [Google Maps Platform](https://developers.google.com/maps/documentation/javascript/get-api-key#create-api-keys).
- Please read the [Google Maps API Key Guidance](/docs/GoogleMaps_API_Key_Guidance.md).
5. Enter your key to the end of the Geocomplete src link (indicated by "google.map.api.key") at the [application.properties](/fedgov-cv-map-services-proxy/src/main/resources/application.properties#L1)

6. Using SSL vs not using SSL:

- If using SSL certificates, you may look up instructions to generate a keystore and SSL certficiates with your certificate authority (CA) of choice. In this case, the ssl.ini and keystore files will need to be updated or replaced to copy your applicable keystore information to the image. **NOTE**: The current ssl.ini and keystore files are examples only. Please update or replace before running the following command.
```
sudo docker build -t usdotfhwastol/connectedvcs-tools:<tag> --build-arg USE_SSL=true .
```
- If running the tool without certificates, no changes are needed. Run the following command.
```
sudo docker build -t usdotfhwastol/connectedvcs-tools:<tag> --build-arg USE_SSL=false .
```
### Run Image with SSL certificate
```
sudo docker run -d -p 443:443 usdotfhwastol/connectedvcs-tools:<tag>
```
### Run Image without SSL certificate
```
sudo docker run -d -p 8080:8080 usdotfhwastol/connectedvcs-tools:<tag>
```
## Access the ConnectedVCS Tools Interface
1. In your browser, navigate to:
- with SSL: https://127.0.0.1:443/
- without SSL: http://127.0.0.1:8080/
14 changes: 14 additions & 0 deletions docs/GoogleMaps_API_Key_Guidance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Google Maps API Key Guidance
----------------------------

The current version of the MAP Creation Tool uses Google Maps for the Places Autocomplete plugin. This plugin allows a user to input an address in the searchbar at the top of the MAP Creation Tool page and autonavigate to the address. To enable the plugin, an API key must be generated by each individual user if a personal deployment of the tool is desired. By default, we recommend securing your API keys according to the official instructions on [Google Maps Platform security guidance](https://developers.google.com/maps/api-security-best-practices#restricting-api-keys). Enabling security will ensure no bad actors will be able to abuse the use of your personal API keys.

In case the tool will not be publically available, the security feature does not need to be enabled. However, it is still recommended to periodically check the usage of your keys.

### **Getting a Google Maps API Key**

An account with Google Maps and an API Key can be created using the [Google Maps Platform](https://developers.google.com/maps/documentation/javascript/get-api-key#create-api-keys).

### **Using your API Key**

Once a key is obtained, please insert your key to the end of the Geocomplete src link (indicated by "YOUR_API_KEY") at the [index.html](/fedgov-cv-ISDcreator-webapp/src/main/webapp/index.html) file and build your updated ConnectedVCS Tools using either the [Local](/docs/Local_Instructions.md) or [Docker](/docs/Docker_Instructions.md) build instructions.
Loading

0 comments on commit 7a6d7b7

Please sign in to comment.