Skip to content

Commit c499986

Browse files
author
Dennis Labordus
authored
Merge pull request #243 from com-pas/develop
New release
2 parents 212a35c + 2a06d48 commit c499986

File tree

18 files changed

+406
-249
lines changed

18 files changed

+406
-249
lines changed

.github/workflows/build-project.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ jobs:
3737
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
3838
restore-keys: ${{ runner.os }}-m2
3939

40-
- name: Set up JDK 1.11
40+
- name: Set up JDK 17
4141
uses: actions/setup-java@v3
4242
with:
4343
distribution: 'zulu'
44-
java-version: '11'
44+
java-version: '17'
4545

4646
- name: Create custom Maven Settings.xml
4747
uses: whelk-io/maven-settings-xml-action@v20

.github/workflows/release-project.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ jobs:
4242
shell: bash
4343
# Extra the tagname form the git reference, value of GITHUB_REF will be something like refs/tags/<tag_name>.
4444
run: echo "##[set-output name=tagname;]$(echo ${GITHUB_REF##*/})"
45-
- name: Set up JDK 1.11
45+
- name: Set up JDK 17
4646
uses: actions/setup-java@v3
4747
with:
4848
distribution: 'zulu'
49-
java-version: '11'
49+
java-version: '17'
5050

5151
- name: Create custom Maven Settings.xml
5252
uses: whelk-io/maven-settings-xml-action@v20

.github/workflows/sonarcloud-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ jobs:
3030
with:
3131
fetch-depth: 0
3232

33-
- name: Set up JDK 11
33+
- name: Set up JDK 17
3434
uses: actions/setup-java@v3
3535
with:
3636
distribution: 'zulu'
37-
java-version: '11'
37+
java-version: '17'
3838
- name: Cache SonarCloud packages
3939
uses: actions/cache@v3
4040
with:

.mvn/wrapper/maven-wrapper.properties

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
1-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.1/apache-maven-3.8.1-bin.zip
2-
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
18+
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SPDX-License-Identifier: Apache-2.0
1010
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5925/badge)](https://bestpractices.coreinfrastructure.org/projects/5925)
1111
[![Slack](https://raw.githubusercontent.com/com-pas/compas-architecture/master/public/LFEnergy-slack.svg)](http://lfenergy.slack.com/)
1212

13-
# compas-scl-data-service
13+
# CoMPAS SCL Data Service
1414

1515
Service to store and retrieve the SCL XML to a database.
1616

@@ -21,8 +21,9 @@ to [documentation](doc/compas-scl-data-service.md).
2121

2222
There are currently two database implementations available.
2323

24-
- For more information about the BaseX Implementation go to [BaseX](doc/basex.md). (Profile activated by default.)
25-
- For more information about the PostgreSQL Implementation go to [PostgreSQL](doc/postgresql.md).
24+
- For more development information about the BaseX Implementation go to [BaseX](doc/basex.md). (Profile activated by
25+
default.)
26+
- For more development information about the PostgreSQL Implementation go to [PostgreSQL](doc/postgresql.md).
2627

2728
> **Note:** When switching between implementation it's a good practise to first execute a maven clean to remove
2829
> old dependencies from the target directory in the app module.

app/src/main/docker/Dockerfile-basex.jvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
###
2424
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6
2525

26-
ARG JAVA_PACKAGE=java-11-openjdk-headless
26+
ARG JAVA_PACKAGE=java-17-openjdk-headless
2727
ARG RUN_JAVA_VERSION=1.3.8
2828
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
2929
# Install java and the run-java script

app/src/main/docker/Dockerfile-postgresql.jvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
###
2424
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.6
2525

26-
ARG JAVA_PACKAGE=java-11-openjdk-headless
26+
ARG JAVA_PACKAGE=java-17-openjdk-headless
2727
ARG RUN_JAVA_VERSION=1.3.8
2828
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'
2929
# Install java and the run-java script

app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/CompasCommonResource.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import javax.ws.rs.core.MediaType;
2323
import java.util.Arrays;
2424
import java.util.Comparator;
25-
import java.util.stream.Collectors;
2625

2726
import static org.lfenergy.compas.scl.data.rest.Constants.READ_ROLE;
2827

@@ -54,7 +53,7 @@ public TypeListResponse list(@HeaderParam("Authorization") String authHeader) {
5453
.filter(sclFileType -> roles.contains(sclFileType.name() + "_" + READ_ROLE))
5554
.map(sclFileType -> new Type(sclFileType.name(), sclFileType.getDescription()))
5655
.sorted(Comparator.comparing(Type::getDescription))
57-
.collect(Collectors.toList()));
56+
.toList());
5857
return response;
5958
}
6059

doc/basex.md

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,31 @@ Below environment variable(s) can be used to configure the connection to BaseX,
1919

2020
## Development
2121

22-
### Application depends on a running BaseX instance
22+
### Building the application
23+
24+
You can use Maven to build the application and see if all tests are working using:
25+
26+
```shell script
27+
./mvnw clean verify
28+
```
29+
30+
This should normally be enough to also run the application, but there were cases that we need to build using:
31+
32+
```shell script
33+
./mvnw clean install
34+
```
35+
36+
This to make the local modules available for the app module to run the application.
37+
38+
### Running the application in dev mode
39+
40+
You can run your application in dev mode that enables live coding using:
41+
42+
```shell script
43+
./mvnw -DskipTests=true -Dquarkus.profile=dev-basex package io.quarkus:quarkus-maven-plugin::dev
44+
```
45+
46+
#### Application depends on a running BaseX instance
2347

2448
Check [basexhttp on DockerHub](https://hub.docker.com/r/basex/basexhttp) for a running BaseX docker container. This is
2549
needed when running the SCL Data Service locally. Not needed to run the tests.
@@ -37,34 +61,48 @@ docker run --rm --name compas_basex \
3761
> **Note:** Replace <BASEX-DIR> with a directory on your local machine, for instance "~/basex".
3862
> All data will be stored in this directory under "data". This way data isn't lost after stopping the docker container.
3963
40-
### Building the application
64+
#### Application depends on a running KeyCloak instance
4165

42-
You can run the following command to build the BaseX version of the application.
66+
Beside a BaseX Database there is also a KeyCloak instance need to be running on port 8089 by default.
67+
See [README.md](../README.md#security) for default values, if custom keycloak is used.
4368

44-
```shell script
45-
./mvnw clean verify
46-
```
69+
There is a preconfigured keycloak instance available in
70+
the [CoMPAS Deployment Repository](https://github.com/com-pas/compas-deployment). This repository can be cloned and
71+
when going to this directory the following command can be executed to create a local Docker Image with configuration.
4772

48-
### Running the application in dev mode
73+
```shell
74+
cd <CoMPAS Deployment Repository Directory>/compas/keycloak
75+
docker build -t compas_keycloak .
76+
```
4977

50-
You can run your application in dev mode that enables live coding using:
78+
There is now a Docker Image `compas_keycloak` created that can be started using the following command
5179

52-
```shell script
53-
./mvnw -DskipTests=true -Dquarkus.profile=dev-basex package io.quarkus:quarkus-maven-plugin::dev
80+
```shell
81+
docker run --rm --name compas_keycloak \
82+
-p 8089:8080
83+
-d compas_keycloak:latest
5484
```
5585

56-
### Creating a native executable
86+
### Creating a Docker image with native executable
5787

58-
You can create a native executable using:
88+
The releases created in the repository will create a docker image with a native executable. If you're running a Linux
89+
system it's possible to create and run the executable locally. You can create a Docker image with native executable
90+
using:
5991

6092
```shell script
61-
./mvnw -P native package
93+
./mvnw package -Pnative-image
6294
```
6395

64-
This will run the native executable build in a container. In the native profile the property
65-
"quarkus.native.container-build" is set to 'true'.
66-
6796
You can then execute your native executable with: `./app/target/basex-quarkus-app/app-local-SNAPSHOT-runner`
6897

69-
If you want to learn more about building native executables, please see https://quarkus.io/guides/maven-tooling.html
70-
and https://quarkus.io/guides/writing-native-applications-tips.
98+
### Creating a Docker image with JVM executable
99+
100+
There is also a profile to create a Docker Image which runs the application using a JVM. You can create a Docker Image
101+
with JVM executable using:
102+
103+
```shell script
104+
./mvnw package -Pjvm-image
105+
```
106+
107+
The JVM Image can also (temporary) be created by the release action if there are problems creating or running the
108+
native executable.

doc/compas-scl-data-service.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,10 @@ There a some BaseX specific choices made in storing the SCL.
6666

6767
### PostgreSQL
6868

69-
TODO
69+
There a some PostgreSQL choices made in storing the SCL.
70+
71+
- For the PostgreSQL version we use FlyWay to maintain the database schema.
72+
- All SCL XML Files are stored in a table called `scl_file`.
73+
- For every new version of an SCL XML File a new record is created.
74+
- The full XML is stored in a text field `scl_data`.
75+
- We can use the XPath function of PostgreSQL to retrieve extra info from the XML.

0 commit comments

Comments
 (0)