Skip to content

Commit

Permalink
Merge pull request #555 from CDOT-CV/dev
Browse files Browse the repository at this point in the history
Code Cleanup, Submodule Replacement, Error Handling Improvements & Deployment Enhancements
  • Loading branch information
dan-du-car authored Sep 24, 2024
2 parents b944014 + 0f66b7d commit bb847a3
Show file tree
Hide file tree
Showing 96 changed files with 1,152 additions and 25,675 deletions.
30 changes: 15 additions & 15 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ FROM eclipse-temurin:21-jdk
# will be updated to match your local UID/GID (when using the dockerFile property).
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_UID=1234
ARG USER_GID=$USER_UID

# Configure apt
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get -y install --no-install-recommends apt-utils dialog 2>&1 \
#
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
&& groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
# [Optional] Add sudo support for the non-root user
&& apt-get install -y sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME\
&& chmod 0440 /etc/sudoers.d/$USERNAME \
#
# Verify git, needed tools installed
&& apt-get -y install git openssh-client less iproute2 procps curl lsb-release zip unzip sed kafkacat telnet
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get -y install --no-install-recommends apt-utils dialog 2>&1

# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user.
RUN groupadd --gid $USER_GID $USERNAME
RUN useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME
# [Optional] Add sudo support for the non-root user
RUN apt-get install -y sudo
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME
RUN chmod 0440 /etc/sudoers.d/$USERNAME

# Verify git, needed tools installed
RUN apt-get -y install git openssh-client less iproute2 procps curl lsb-release zip unzip sed kafkacat telnet

#-------------------Install SDKMan----------------------------------
RUN curl -s https://get.sdkman.io | bash
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/artifact-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Publish Java Package

on:
push:
tags:
- 'jpo-ode-*'

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: 'adopt'

- name: Remove snapshot from version
run: mvn versions:set -DremoveSnapshot

- name: Build with Maven
run: mvn -B clean package --file pom.xml -DskipTests -Ppackage-jar

- name: Publish to GitHub Packages
run: mvn --batch-mode -Dgithub_organization=${{ github.repository_owner }} deploy -DskipTests -Ppackage-jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Replcae Docker tag
- name: Replace Docker tag
id: set_tag
run: echo "TAG=$(echo ${GITHUB_REF##*/} | sed 's/\//-/g')" >> $GITHUB_ENV

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,7 @@ settings.xml
/jpo-security-svcs/*.log
/qa/test-harness/*.log
/qa/test-harness/.vscode

#########################
### jpo-cvdp ###
ppm_data/*
7 changes: 3 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
[submodule "jpo-cvdp"]
path = jpo-cvdp
url = https://github.com/usdot-jpo-ode/jpo-cvdp.git
[submodule "jpo-s3-deposit"]
path = jpo-s3-deposit
url = https://github.com/usdot-jpo-ode/jpo-s3-deposit.git
branch = master
[submodule "jpo-security-svcs"]
path = jpo-security-svcs
url = https://github.com/usdot-jpo-ode/jpo-security-svcs.git
Expand All @@ -17,3 +13,6 @@
[submodule "qa/test-harness/ode-output-validator-library"]
path = qa/test-harness/ode-output-validator-library
url = https://github.com/usdot-jpo-ode/ode-output-validator-library.git
[submodule "jpo-utils"]
path = jpo-utils
url = https://github.com/usdot-jpo-ode/jpo-utils.git
3 changes: 0 additions & 3 deletions .sonarqube/sonar-scanner.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ sonar.modules= asn1_codec, \
jpo-ode-core, \
jpo-ode-plugins, \
jpo-ode-svcs, \
jpo-s3-deposit, \
jpo-sdw-depositor, \
jpo-security-svcs

Expand All @@ -17,7 +16,6 @@ jpo-ode-consumer-example.sonar.projectBaseDir = /home/circleci/project/jpo-ode
jpo-ode-core.sonar.projectBaseDir = /home/circleci/project/jpo-ode-core
jpo-ode-plugins.sonar.projectBaseDir = /home/circleci/project/jpo-ode-plugins
jpo-ode-svcs.sonar.projectBaseDir = /home/circleci/project/jpo-ode-svcs
jpo-s3-deposit.sonar.projectBaseDir = /home/circleci/project/jpo-s3-deposit
jpo-sdw-depositor.sonar.projectBaseDir = /home/circleci/project/jpo-sdw-depositor
jpo-security-svcs.sonar.projectBaseDir = /home/circleci/project/jpo-security-svcs

Expand All @@ -28,7 +26,6 @@ jpo-ode-consumer-example.sonar.sources = src
jpo-ode-core.sonar.sources = src
jpo-ode-plugins.sonar.sources = src
jpo-ode-svcs.sonar.sources = src
jpo-s3-deposit.sonar.sources = src
jpo-sdw-depositor.sonar.sources = src
jpo-security-svcs.sonar.sources = src

Expand Down
17 changes: 6 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,10 @@ WORKDIR /home
COPY --from=builder /home/jpo-ode-svcs/src/main/resources/application.properties /home
COPY --from=builder /home/jpo-ode-svcs/src/main/resources/logback.xml /home
COPY --from=builder /home/jpo-ode-svcs/target/jpo-ode-svcs.jar /home
COPY ./scripts/startup_jpoode.sh /home

ENTRYPOINT ["java", \
"-Djava.rmi.server.hostname=$DOCKER_HOST_IP", \
"-Dcom.sun.management.jmxremote.port=9090", \
"-Dcom.sun.management.jmxremote.rmi.port=9090", \
"-Dcom.sun.management.jmxremote", \
"-Dcom.sun.management.jmxremote.local.only=true", \
"-Dcom.sun.management.jmxremote.authenticate=false", \
"-Dcom.sun.management.jmxremote.ssl=false", \
"-Dlogback.configurationFile=/home/logback.xml", \
"-jar", \
"/home/jpo-ode-svcs.jar"]
RUN apk add openssh
RUN apk add openrc
RUN rc-update add sshd

ENTRYPOINT ["sh", "/home/startup_jpoode.sh"]
39 changes: 22 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,38 @@
default:
$(info Make target options:)
$(info `make start` to build and run the ODE)
$(info `make start` to run the ODE)
$(info `make build` to build the ODE)
$(info `make stop` to stop the ODE)
$(info `make delete` to destroy the current Docker containers)
$(info `make delete` to stop the ODE and remove the volumes)
$(info `make rebuild` to stop, delete, and then rebuild the containers)
$(info `make clean-build` to rebuild the containers without using the cache)

start:
ifeq ("$(wildcard ./jpo-ode-private)", "")
$(error "ERROR: Directory `jpo-ode-private` not found in ${PWD}")
endif
ifeq ("$(wildcard ./asn1_codec/asn1c_combined/J2735_201603DA.ASN)", "")
cp ./jpo-ode-private/j2735/J2735_201603DA.ASN ./asn1_codec/asn1c_combined/J2735_201603DA.ASN
endif
ifndef DOCKER_HOST_IP
$(error ERROR: Environment variable DOCKER_HOST_IP is not set)
ifeq ("$(wildcard .env)", "")
$(error "ERROR: jpo-ode Environment file `.env` not found in ${PWD}")
endif
ifndef DOCKER_SHARED_VOLUME
$(error ERROR: Environment variable DOCKER_SHARED_VOLUME is not set)
ifeq ("$(wildcard ./jpo-utils/.env)", "")
$(error "ERROR: jpo-utils Environment file `.env` not found in ${PWD}")
endif
docker compose up -d

build:
ifeq ("$(wildcard .env)", "")
$(warning "WARNING: Environment file `.env` not found in ${PWD}")
$(error "ERROR: jpo-ode Environment file `.env` not found in ${PWD}")
endif
ifeq ("$(wildcard ./jpo-utils/.env)", "")
$(error "ERROR: jpo-utils Environment file `.env` not found in ${PWD}")
endif
docker-compose up --build -d
docker compose build

stop:
docker-compose down
docker compose down

delete:
docker-compose rm -fvs
docker compose down -v

rebuild:
$(MAKE) stop delete start
$(MAKE) stop delete build start

clean-build:
docker compose build --no-cache
Loading

0 comments on commit bb847a3

Please sign in to comment.