Skip to content

Commit 8a7340d

Browse files
author
Dennis Labordus
authored
Merge pull request #239 from com-pas/update-readme
Updated documentation for development
2 parents 425cf50 + 0929d52 commit 8a7340d

File tree

4 files changed

+87
-48
lines changed

4 files changed

+87
-48
lines changed

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.

doc/basex.md

Lines changed: 38 additions & 22 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,7 +61,7 @@ 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-
### Application depends on a running KeyCloak instance
64+
#### Application depends on a running KeyCloak instance
4165

4266
Beside a BaseX Database there is also a KeyCloak instance need to be running on port 8089 by default.
4367
See [README.md](../README.md#security) for default values, if custom keycloak is used.
@@ -59,34 +83,26 @@ docker run --rm --name compas_keycloak \
5983
-d compas_keycloak:latest
6084
```
6185

62-
### Building the application
86+
### Creating a Docker image with native executable
6387

64-
You can run the following command to build the BaseX version of the application.
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:
6591

6692
```shell script
67-
./mvnw clean verify
93+
./mvnw package -Pnative-image
6894
```
6995

70-
### Running the application in dev mode
71-
72-
You can run your application in dev mode that enables live coding using:
73-
74-
```shell script
75-
./mvnw -DskipTests=true -Dquarkus.profile=dev-basex package io.quarkus:quarkus-maven-plugin::dev
76-
```
96+
You can then execute your native executable with: `./app/target/basex-quarkus-app/app-local-SNAPSHOT-runner`
7797

78-
### Creating a native executable
98+
### Creating a Docker image with JVM executable
7999

80-
You can create a native executable using:
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:
81102

82103
```shell script
83-
./mvnw -P native package
104+
./mvnw package -Pjvm-image
84105
```
85106

86-
This will run the native executable build in a container. In the native profile the property
87-
"quarkus.native.container-build" is set to 'true'.
88-
89-
You can then execute your native executable with: `./app/target/basex-quarkus-app/app-local-SNAPSHOT-runner`
90-
91-
If you want to learn more about building native executables, please see https://quarkus.io/guides/maven-tooling.html
92-
and https://quarkus.io/guides/writing-native-applications-tips.
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.

doc/postgresql.md

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,31 @@ Table: scl_file
4040

4141
## Development
4242

43-
### Application depends on a running PostgreSQL instance
43+
### Building the application
44+
45+
You can use Maven to build the application and see if all tests are working using:
46+
47+
```shell script
48+
./mvnw clean verify
49+
```
50+
51+
This should normally be enough to also run the application, but there were cases that we need to build using:
52+
53+
```shell script
54+
./mvnw clean install
55+
```
56+
57+
This to make the local modules available for the app module to run the application.
58+
59+
### Running the application in dev mode
60+
61+
You can run your application in dev mode that enables live coding using:
62+
63+
```shell script
64+
./mvnw -DskipTests=true -Dquarkus.profile=dev-postgresql package io.quarkus:quarkus-maven-plugin::dev
65+
```
66+
67+
#### Application depends on a running PostgreSQL instance
4468

4569
Check [PostgreSQL on DockerHub](https://hub.docker.com/_/postgres?tab=description) for a running PostgreSQL docker
4670
container. Use the following command to start the docker container.
@@ -59,7 +83,7 @@ docker run --rm --name compas_postgresql \
5983
> All data will be stored in this directory under "compas". This way data isn't lost after stopping the docker
6084
> container.
6185
62-
### Application depends on a running KeyCloak instance
86+
#### Application depends on a running KeyCloak instance
6387

6488
Beside a PostgreSQL Database there is also a KeyCloak instance need to be running on port 8089 by default.
6589
See [README.md](../README.md#security) for default values, if custom keycloak is used.
@@ -81,34 +105,26 @@ docker run --rm --name compas_keycloak \
81105
-d compas_keycloak:latest
82106
```
83107

84-
### Building the application
108+
### Creating a Docker image with native executable
85109

86-
You can run the following command to build the PostgreSQL version of the application.
110+
The releases created in the repository will create a docker image with a native executable. If you're running a Linux
111+
system it's possible to create and run the executable locally. You can create a Docker image with native executable
112+
using:
87113

88114
```shell script
89-
./mvnw clean verify
115+
./mvnw package -Pnative-image
90116
```
91117

92-
### Running the application in dev mode
93-
94-
You can run your application in dev mode that enables live coding using:
95-
96-
```shell script
97-
./mvnw -DskipTests=true -Dquarkus.profile=dev-postgresql package io.quarkus:quarkus-maven-plugin::dev
98-
```
118+
You can then execute your native executable with: `./app/target/postgresql-quarkus-app/app-local-SNAPSHOT-runner`
99119

100-
### Creating a native executable
120+
### Creating a Docker image with JVM executable
101121

102-
You can create a native executable using:
122+
There is also a profile to create a Docker Image which runs the application using a JVM. You can create a Docker Image
123+
with JVM executable using:
103124

104125
```shell script
105-
./mvnw -P native package
126+
./mvnw package -Pjvm-image
106127
```
107128

108-
This will run the native executable build in a container. In the native profile the property
109-
"quarkus.native.container-build" is set to 'true'.
110-
111-
You can then execute your native executable with: `./app/target/postgresql-quarkus-app/app-local-SNAPSHOT-runner`
112-
113-
If you want to learn more about building native executables, please see https://quarkus.io/guides/maven-tooling.html
114-
and https://quarkus.io/guides/writing-native-applications-tips.
129+
The JVM Image can also (temporary) be created by the release action if there are problems creating or running the
130+
native executable.

0 commit comments

Comments
 (0)