Skip to content

Commit

Permalink
Prepare for JPA rewrite
Browse files Browse the repository at this point in the history
Signed-off-by: Niels Thykier <[email protected]>
  • Loading branch information
Niels Thykier committed Jun 8, 2022
1 parent 4daedd0 commit cb976bc
Show file tree
Hide file tree
Showing 59 changed files with 730 additions and 1,605 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/*-sources.jar
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# https://editorconfig.org/
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true

[*.{bat,cmd}]
end_of_line = crlf

[pom.xml]
indent_style = tab
indent_size = 2
27 changes: 12 additions & 15 deletions .github/workflows/docker_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,16 @@ name: Docker
# documentation.

on:
push:
branches:
- master
- live-*
create:
tags:
- v*

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

Expand All @@ -27,14 +25,16 @@ jobs:
packages: write

steps:
- name: Branch name
run: |-
tag_name=$(echo "${GITHUB_REF}" | sed 's/.*\///g; s/master/latest/')
echo DOCKER_TAG_NAME=${tag_name}
echo DOCKER_TAG_NAME=${tag_name} >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v2
submodules: recursive

- name: Set up Java JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17
cache: 'maven'

- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v12
Expand All @@ -45,8 +45,6 @@ jobs:
- name: maven build
run: mvn -B package --file pom.xml

- name: print context
run: echo "$GITHUB_CONTEXT"

# Build and push Docker image
# https://github.com/marketplace/actions/docker-build-push-action
Expand All @@ -58,5 +56,4 @@ jobs:
githubOrg: dcsaorg
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
tags: ${{ env.DOCKER_TAG_NAME }}
addLatest: ${{ false }}
addLatest: ${{ true }}
93 changes: 63 additions & 30 deletions .github/workflows/microservices.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,69 @@
name: Microservices CI
name: DCSA-UI-Support MASTER CI

on: [push]
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Fetch backend
uses: actions/checkout@v2
with:
path: DCSA-UI-Support
submodules: recursive
- name: Set up Java JDK
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache local Maven repository
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v12
with:
repositories: '[{ "id": "github", "name": "DCSA Backend repo", "url": "https://maven.pkg.github.com/dcsaorg/DCSA-Core", "releases": { "enabled": "true" }, "snapshots": { "enabled": "true" } }]'
servers: '[{ "id": "github", "username": "${{ secrets.DCSA_USER }}", "password": "${{ secrets.DCSA_PACKAGES_PAT }}" }]'

- name: Build API
run: cd DCSA-UI-Support && mvn package -DskipTests -X #Need to skip the tests as they depend on a running DB

- name: Run the UI Support microservice plus database
run: cd DCSA-UI-Support && docker-compose -f docker-compose.yml up -d -V

- uses: actions/checkout@v2
with:
path: DCSA-UI-Support
submodules: recursive

- name: Set up Java JDK
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17
cache: 'maven'

- name: maven-settings-xml-action
uses: whelk-io/maven-settings-xml-action@v12
with:
repositories: '[{ "id": "github", "name": "DCSA Backend repo", "url": "https://maven.pkg.github.com/dcsaorg/DCSA-Core", "releases": { "enabled": "true" }, "snapshots": { "enabled": "true" } }]'
servers: '[{ "id": "github", "username": "${{ secrets.DCSA_USER }}", "password": "${{ secrets.DCSA_PACKAGES_PAT }}" }]'

- name: Build UI-Support
run: cd DCSA-UI-Support && mvn clean -U -B package -Ddcsa.artifacttype=-SNAPSHOT

- name: Build and run the microservices
run: cd DCSA-UI-Support && docker-compose -f docker-compose.yml up -d -V --build

- name: Fetch Backend Status
run: |
sleep 10
status=$(curl -s http://localhost:9091/v1/actuator/health | jq -r '.status')
retries=12
while [[ "$status" != "UP" ]] && [[ $retries -gt 0 ]]; do
echo "Status is '$status' - waiting 5 secs ($retries retries left)"
sleep 5
retries=$((retries - 1))
status=$(curl -s http://localhost:9091/v1/actuator/health | jq -r '.status')
done
echo "Final status is '$status'"
if [[ "$status" != "UP" ]]; then
curl -v http://localhost:9091/v1/actuator/health
docker ps
docker logs dcsa-ui-support_dcsa-ui-support_1
fi
echo "::set-output name=STATUS::$status"
id: healthcheck

- name: Confirm microservice status
if: ${{ steps.healthcheck.outputs.STATUS == 'UP' }}
run: |
echo "The DCSA-UI-Support service is UP."
- name: Run Integration Tests
run: |
cd DCSA-UI-Support && java -jar ui-support-integration-tests/target/dcsa-ui-support-integration-tests-with-dependencies.jar
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.flattened-pom.xml
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
Expand Down Expand Up @@ -28,4 +29,4 @@ target/
build/

### VS Code ###
.vscode/
.vscode/
2 changes: 1 addition & 1 deletion DCSA-Information-Model
Submodule DCSA-Information-Model updated 40 files
+4 −4 .github/workflows/microservices.yml
+2 −1 datamodel/Dockerfile
+1 −1 datamodel/README.md
+374 −230 datamodel/initdb.d/03_dcsa_im_v3_0.sql
+23 −14 datamodel/initdb.d/04_load_reference_data.sql
+385 −61 datamodel/initdb.d/05_reference_implementation_support.sql
+32 −1 datamodel/initdb.d/06_metadata.sql
+4 −4 datamodel/referencedata.d/cargomovementtypes.csv
+6 −5 datamodel/referencedata.d/codelistresponsibleagencycodes.csv
+1 −1 datamodel/referencedata.d/communicationchannelqualifier.csv
+0 −0 datamodel/referencedata.d/cutofftimecodes.csv
+2 −1 datamodel/referencedata.d/documenttypecodes.csv
+7 −0 datamodel/referencedata.d/eblsolutionproviders.csv
+1 −2 datamodel/referencedata.d/equipmenteventtypecodes.csv
+1 −0 datamodel/referencedata.d/errorcodes.csv
+1 −1 datamodel/referencedata.d/incotermscodes.csv
+5 −0 datamodel/referencedata.d/packagecodes.csv
+8 −4 datamodel/referencedata.d/partyfunctioncodes.csv
+1 −1 datamodel/referencedata.d/paymentterms.csv
+8 −0 datamodel/referencedata.d/portcallstatuscodes.csv
+4 −4 datamodel/referencedata.d/receiptdeliverytypes.csv
+5 −1 datamodel/referencedata.d/referencetypes.csv
+3 −1 datamodel/referencedata.d/shipmenteventtypecodes.csv
+15 −10 datamodel/referencedata.d/shipmentlocationtypes.csv
+1 −1 datamodel/referencedata.d/transportplanstagetypes.csv
+0 −7 datamodel/referencedata.d/unitofmeasure.csv
+9 −0 datamodel/referencedata.d/unitofmeasures.csv
+1 −1 datamodel/referencedata.d/valueaddedservicecodes.csv
+0 −0 datamodel/referencedata.d/vesselsharingagreementtypes.csv
+6 −3 datamodel/samples.d/README.md
+1,026 −852 datamodel/samples.d/facilities.csv
+0 −1 datamodel/samples.d/porttimezones.csv
+58 −78 datamodel/samples.d/timestampdefinitions.csv
+23 −23 datamodel/samples.d/update_facilities.py
+6 −1 datamodel/samples.d/update_porttimezones.py
+1 −1 datamodel/testdata.d/07_load_sample_data.sql
+1,688 −152 datamodel/testdata.d/08_01_test_data_ebl.sql
+185 −75 datamodel/testdata.d/08_02_test_data_tnt.sql
+47 −33 datamodel/testdata.d/08_03_test_data_ovs.sql
+904 −0 datamodel/testdata.d/08_04_test_data_bkg.sql
14 changes: 4 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
FROM debian:buster
FROM eclipse-temurin:17-jre-alpine

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get -y upgrade \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \
openjdk-11-jre-headless \
&& rm -rf /var/lib/apt/lists/*

EXPOSE 9090
EXPOSE 9091
ENV db_hostname dcsa_db
COPY run-in-container.sh /run.sh
RUN chmod +x /run.sh
COPY src/main/resources/application.yaml .
COPY target/dcsa_ui_support-*.jar .
COPY ui-support-service/src/main/resources/application.yml .
COPY ui-support-service/target/dcsa-ui-support-service.jar .
CMD ["/run.sh"]
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ services:
.
ports:
- 9091:9091
environment:
- "db_hostname=dcsa-test-db"
- "SPRING_PROFILES_ACTIVE=${SPRING_PROFILES_ACTIVE:-nosecurity}"
- "SPRING_DATASOURCE_PASSWORD=9c072fe8-c59c-11ea-b8d1-7b6577e9f3f5"
- "ROOT_LOG_LEVEL=${ROOT_LOG_LEVEL:-INFO}"
- "DCSA_LOG_LEVEL=${DCSA_LOG_LEVEL:-INFO}"
logging:
options:
max-file: '10'
Expand Down
2 changes: 2 additions & 0 deletions lombok.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This is the top of the project
config.stopBubbling = true
Loading

0 comments on commit cb976bc

Please sign in to comment.