mkkp / e-demokracia

E-Demokracia
1 stars 1 forks source link

= edemokracia Application

== Using the generated application

This application is generated from the model defined in the upper directory or the given consumed model.

To compile and run project use judo.sh script. Linux and MacOS are supported. Maybe it works with WSL2, but it's not tested, and it can have poor performance. For more details please run ./judo.sh --help

=== Prerequisite

==== Docker Most commands rely on Docker, therefore it is expected to be installed. The judo.sh will install the required tools with https://sdkman.io/[sdkman].

[source,]

docker run --user $RANDOM:$RANDOM --rm hello-world

==== Maven

To work with the model we have to set up the distribution repository in your ~/.m2/settings.xml

[source,]

edemokracia-distribution YOURUSER YOURPASS

=== Build application To build the application, execute

[source,]

./judo.sh build

=== Start the application After build it can be started

[source,]

./judo.sh start

The commands can be chained:

[source,]

./judo.sh build start

=== Stop the application After start or reckless, karaf is not terminated automatically. To stop type:

[source,]

./judo.sh stop

=== Check status To check the running instances, use:

[source,]

./judo.sh status

=== Reckless mode There are several situations when minimal change performed on model. To decrease the model-to-deploy time the reckless command can be used. It will enable caching, disabling validation to perform maximum speed. It causes sometimes errors. On that case it can be fixed with a build.

[source,]

./judo.sh reckless

=== Compile with maven

To create and package karaf service, run:

[source,]

mvn clean install

It uses the model version and frontend version defined in pom.xml. In development sometimes other version is required (for example locally compiled ESM) On that case model-version and frontend-version can be overridden.

[source,]

mvn clean install -Dmodel-version=1.0.0-SNAPSHOT -Dfrontend-version=1.0.0-SNAPSHOT

== Profiles

Sometimes maven compiling can be slow. In order to investigate what is causing potential issues we can run maven with:

-Dprofile -DprofileFormat=HTML

Using these flags, maven will generate a HTML report in the .profiler directory.

== Layout

=== model

The model project. It creates the intermediate models from ESM model and stores in /model/target/generated-resources/model/ directory. This model is packed as OSGi bundle which is used the JUDO runtime. It also attach 4 OSGi bundles:

=== schema

The schema is used to make transition between model states in RDBMS. Schema supports incremental DDL. It creates standalone CLI and docker images to update a database to new model state.

=== app

The implementations for model defined custom operations.

=== sdk

SDK API codes which can be implemented as custom Java operations in app or other custom subprojects.

=== internal

SDK API wrapper which are technical services to bind the user defined Java custom operations.

=== frontend-react

It contains the generator project and the generated react frontend source. It uses maven with frontend maven plugin to create deployable web bundle which is served as static content in karaf runtime.

=== karaf-features

The description of the karaf service. It aggregates bundle definitions and configurations for the backend service in src/main/feature/features.xml.

=== karaf-offline

The assembled karaf service which can be deployed. We can use the run-offline.sh script to run it

=== docker

The docker image builder which is including karaf-offline.

[source,]

mvn clean install -DcreateDocker

== Run service

After the project compilation every artifact is created to be able to start karaf service. Keycloak service have to be accessed by backend for all apps.

=== Keycloak

By default JUDO apps integrate with keycloak in order to provide authentication and authorization features. Keycloak must be running in order for applications to start up.

It is accessible in port 8080 by default, so in browser:

http://localhost:8080

== Settings

Settings can be set up as https://internal-documentation.judo.technology/getting-started/introduction.html[judo-documentation] describes.