Skip to content

Commit

Permalink
Merge pull request #770 from planetf1/docs1
Browse files Browse the repository at this point in the history
  • Loading branch information
planetf1 authored May 12, 2023
2 parents fa6fb1c + 65bed5d commit cfebfe3
Show file tree
Hide file tree
Showing 8 changed files with 335 additions and 113 deletions.
1 change: 0 additions & 1 deletion site/docs/education/open-metadata-labs/running-natively.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ order to use it natively.
## Installing and configuring prerequisite software

--8<-- "docs/education/tutorials/building-egeria-tutorial/task-installing-java.md"
--8<-- "docs/education/tutorials/building-egeria-tutorial/task-installing-maven.md"
--8<-- "docs/education/tutorials/git-and-git-hub-tutorial/task-installing-git.md"
--8<-- "docs/education/tutorials/kafka-tutorial/task-installing-kafka.md"
--8<-- "docs/education/tutorials/kafka-tutorial/task-starting-kafka.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,12 @@ The build scripts that use these technologies ensure the software is built in th
- breaking the link between directory structure and maven artifacts
- extremely fast incremental builds

Our direction is for a Gradle build to replace Maven; however, [that work is still underway :material-dock-window:](https://github.com/odpi/egeria/issues/3370){ target=gh }. As such, you may still find git repositories that use [Maven](#building-with-maven).

As of release 3.0, most egeria.git components are building with gradle, but artifacts are not being created, and verification has not been done. Release 4.0 is when we expect to complete the transition.

Contributions to this work are welcome, as are issue reports! If you'd like to help complete this transition, see [odpi/egeria#3370](https://github.com/odpi/egeria/issues/3370){ target=gh }
As of version 4, Egeria can only be built using gradle.

##### Building with Maven

If building a version of Egeria prior to version 4, the maven instructions can be found below:

--8<-- "docs/education/tutorials/building-egeria-tutorial/task-building-with-maven.md"


Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Gradle runs the build in parallel threads so be sure any test cases are independ
No gradle installation is required, as we use the 'gradle wrapper' which will automatically install gradle if needed. This reduces the setup steps, and ensure everyone runs the same version of gradle.

=== "Rebuild a project with Gradle"
This is a regular incremental build, but will also run all tests and generate javadoc.
```shell
./gradlew build
```
Expand All @@ -26,18 +27,24 @@ No gradle installation is required, as we use the 'gradle wrapper' which will au
./gradlew build -x test -x javadoc
```

=== "Full clean build"
We avoid any use of cache, and ensure a full clean build. This may be needed when you want to recheck something that has no changed sources, but needs a rebuild -- for example to review compiler warning messages (not errors)
```shell
./gradlew clean build --no-build-cache
```

=== "Flexible platform option (egeria.git only)"
This build option creates an [OMAG Server Platform](/concepts/omag-server-platform) where the [registered services](/concepts/omag-subsystem/#registered-services) are optional. The OMAG Server Platform loads the registered services it finds on the loader path specified with the `-Dloader.path={directoryName}` option of its startup command. Use this option if you want to remove the registered services that you are not using, or you would like introduce your own registered services.

```shell
./gradlew -PadminChassisOnly build
```

The build can take 15 minutes to over an hour depending on the repository and on the speed/load on your machine. However eventually you will see the message:
The build will typically take from seconds to 10 minutes depending on the speed of your machine and the number of projects that need to be built.

```text
BUILD SUCCESSFUL in 10s
3 actionable tasks: 1 executed, 2 up-to-date
BUILD SUCCESSFUL in 4m 51s
3290 actionable tasks: 3172 executed, 118 up-to-date
```


Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

[Apache Maven :material-dock-window:](https://maven.apache.org/){ target=maven } is a build tool at is being phased out in the Egeria project, but is still required by some repositories. It is capable of code compilation, running unit tests, validating dependencies and Javadoc as well as build our distribution archive.

Egeria 4.0 and above cannot be built using maven.

where it is used, Egeria requires Maven 3.5 or higher. 3.6.x or above is recommended.

!!! cli "Check if Maven is installed"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Copyright Contributors to the ODPi Egeria project. -->


The [egeria build process](/education/tutorials/building-egeria-tutorial/overview) creates the distribution files for Egeria in the `open-metadata-distribution` module. To see its contents, after a full gradle build completes, use the following `cd` command to change to its `build/distributions` directory:
The [egeria build process](/education/tutorials/building-egeria-tutorial/overview) creates the distribution files for Egeria in the `open-metadata-distribution/open-metadata-assemblies` project. To see its contents, after a full gradle build completes, use the following `cd` command to change to its `build/distributions` directory:

```bash
cd open-metadata-distribution/open-metadata-assemblies/build/distributions
Expand All @@ -11,10 +11,10 @@ List the files:
```bash
ls
```
The distribution tar file is `{{release}}-distribution.tar.gz` or `egeria-3.14-distribution.tar.gz` in this example.
The distribution tar file is `{{release}}-distribution.tar.gz` or `egeria-4.1-distribution.tar.gz` in this example.

```bash
egeria-3.14-distribution.tar.gz
egeria-4.1-distribution.tar.gz
```

Create a directory for the install and copy the tar file into it. The two commands shown below create an install directory in your home directory and then copies the egeria distribution file into it.
Expand All @@ -40,7 +40,7 @@ gunzip egeria*-distribution.tar.gz
```bash
tar -xf egeria*-distribution.tar
```
A new directory is created called `{{release}}-distribution.tar.gz` or `egeria-3.14-distribution.tar.gz` in this example. Change to this new directory and list its contents as shown below.
A new directory is created called `{{release}}-distribution.tar.gz` or `egeria-4.1-distribution.tar.gz` in this example. Change to this new directory and list its contents as shown below.

```bash
cd egeria*gz
Expand All @@ -56,49 +56,49 @@ conformance-suite sample-data truststore.p12

As before, you may notice different files as Egeria evolves.

Under `server` is a directory for the [OMAG Server Platform](/concepts/omag-server-platform) that is used to run open metadata and governance services. This is the `server-chassis-spring-3.14.jar`.
Under `server` is a directory for the [OMAG Server Platform](/concepts/omag-server-platform) that is used to run open metadata and governance services. This is the `server-chassis-spring-4.1.jar`.

```bash
ls server
```
```bash
lib server-chassis-spring-3.14.jar
lib server-chassis-spring-4.1.jar
```
The `lib` directory is where the jar files for connectors, samples and new registered services are installed. The initial list includes the connectors that are located in the `egeria.git` repository.
```bash
ls server/lib
```
```bash
audit-log-console-connector-3.14.jar
audit-log-event-topic-connector-3.14.jar
audit-log-file-connector-3.14.jar
audit-log-slf4j-connector-3.14.jar
avro-file-connector-3.14.jar
basic-file-connector-3.14.jar
cohort-registry-file-store-connector-3.14.jar
configuration-encrypted-file-store-connector-3.14.jar
configuration-file-store-connector-3.14.jar
csv-file-connector-3.14.jar
data-folder-connector-3.14.jar
discovery-service-connectors-3.14.jar
dynamic-archiver-connectors-3.14.jar
elasticsearch-integration-connector-3.14.jar
files-integration-connectors-3.14.jar
governance-action-connectors-3.14.jar
governance-services-sample-3.14.jar
graph-repository-connector-jar-with-dependencies-3.14.jar
inmemory-open-metadata-topic-connector-3.14.jar
inmemory-repository-connector-3.14.jar
kafka-integration-connector-3.14.jar
kafka-open-metadata-topic-connector-3.14.jar
omrs-rest-repository-connector-3.14.jar
open-lineage-janus-connector-3.14.jar
open-metadata-archive-directory-connector-3.14.jar
open-metadata-archive-file-connector-3.14.jar
open-metadata-security-samples-3.14.jar
openapi-integration-connector-3.14.jar
openlineage-integration-connectors-3.14.jar
spring-rest-client-connector-3.14.jar
audit-log-console-connector-4.1.jar
audit-log-event-topic-connector-4.1.jar
audit-log-file-connector-4.1.jar
audit-log-slf4j-connector-4.1.jar
avro-file-connector-4.1.jar
basic-file-connector-4.1.jar
cohort-registry-file-store-connector-4.1.jar
configuration-encrypted-file-store-connector-4.1.jar
configuration-file-store-connector-4.1.jar
csv-file-connector-4.1.jar
data-folder-connector-4.1.jar
discovery-service-connectors-4.1.jar
dynamic-archiver-connectors-4.1.jar
elasticsearch-integration-connector-4.1.jar
files-integration-connectors-4.1.jar
governance-action-connectors-4.1.jar
governance-services-sample-4.1.jar
graph-repository-connector-jar-with-dependencies-4.1.jar
inmemory-open-metadata-topic-connector-4.1.jar
inmemory-repository-connector-4.1.jar
kafka-integration-connector-4.1.jar
kafka-open-metadata-topic-connector-4.1.jar
omrs-rest-repository-connector-4.1.jar
open-lineage-janus-connector-4.1.jar
open-metadata-archive-directory-connector-4.1.jar
open-metadata-archive-file-connector-4.1.jar
open-metadata-security-samples-4.1.jar
openapi-integration-connector-4.1.jar
openlineage-integration-connectors-4.1.jar
spring-rest-client-connector-4.1.jar
```

Copy the jar files for any additional connectors you want to use into the `lib` directory. The connectors available for Egeria are listed in the [Connector Catalog](/connectors).
Expand Down
149 changes: 149 additions & 0 deletions site/docs/guides/admin/omag-server-platform-logging-jsonexample.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<!-- SPDX-License-Identifier: CC-BY-4.0 -->
<!-- Copyright Contributors to the ODPi Egeria project 2020. -->

# Example Audit & Logging Configuration (json)

In this example:
- Egeria platforms, hosting servers, are running within Kubernetes
- Output from pods will be monitored by logging tools that work best with JSON format logs

We therefore want to
- configure the Egeria Audit Log to output JSON format to the console
- ensure logging output from other non-egeria components is also sent to the console in JSON format

See [OMAG Server Platform Logging](omag-server-platform-logging.md) for more information on configuration.

## Approach

By default,
- The Egeria Audit Logs for each server will be written to the console in plain text
- Any other logging within the server chassis will use slf4j-api, or will have an adapter within the executable that maps from other logging frameworks to slf4j-api
- In the server chassis we use Logback classic as the standard slf4j-api implementation

Therefore the simplest approach we will take is to
- configure the Egeria audit log to use slf4j-api
- create a logback configuration file which outputs in json.
- We will use a formatter from logstash, as this is very configurable and well supported by logging tools.

An alternative would be to use a different slf4j-api implementation, such as log4j2 (making sure to exclude logback), and configure that to output in json.

## Detailed steps
### Define a logback configuration file

Create the following file and place it in a well known directory:
``` xml
<!-- Example logging configuration for logback. Requires additional libraries -->
<configuration>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<timestamp/>
<mdc/>
<context/>
<logLevel/>
<loggerName/>
<threadName/>
<message/>
<logstashMarkers/>
<arguments/>
<stackTrace/>
</providers>
</encoder>
</appender>

<root level="debug">
<appender-ref ref="stdout"/>
</root>

</configuration>
```
### Downloading the additional libraries

The above logback configuration requires some additional libraries for the json output.

- net.logstash.logback:logstash-logback-encoder

This can be downloaded from maven central.

Download into a new directory, such as ~/libs/logging
``` bash
wget https://repo1.maven.org/maven2/net/logstash/logback/logstash-logback-encoder/7.3/logstash-logback-encoder-7.3.jar
```


### Launch the egeria platform

In this example we pass properties as invocation parameters, though these can also be configured in a properties file, or set via environment variables.

In this case we are running egeria from an unpacked distribution, and so additional libraries are in ./server/lib, whilst the executable jar is in ./server. We also add the location of the additional libraries we downloaded to the loader path (comma separated).

Replace the location of the configuration file as appropriate.

``` bash
java -Dlogging.config=/Users/jonesn/work/json-audit-log/logback-json.xml -Dloader.path=./server/lib,/Users/jonesn/libs/logging -jar server/server-chassis-spring-4.1-SNAPSHOT.jar
```
### Configure a server

Here we configure a simple metadata server as an example. The default audit log is deleted, and a new one created which uses slf4j-api.

``` bash
#!/bin/sh

# SPDX-License-Identifier: Apache-2.0
# Copyright Contributors to the Egeria project.

# Script will be run by k8s as part of our initialization job.
# Assumed here - platform up & responding to REST api, plus Kafka is available

# Note - expect to port this to python, aligned with our notebook configuration
# - this will facilitate error handling (vs very verbose scripting). Groovy an alternative
# Initial a version a script to get the basics working

EGERIA_ENDPOINT=https://localhost:9443
EGERIA_USER=garygeeke
EGERIA_SERVER=mds1

echo '-- Environment variables --'
env
echo '-- End of Environment variables --'

echo -e '\n-- Configuring platform with requires servers'
# Set the URL root
echo -e '\n\n > Setting server URL root:\n'
curl -f -k --verbose --basic admin:admin -X POST \
"${EGERIA_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${EGERIA_SERVER}/server-url-root?url=${EGERIA_ENDPOINT}"


# Use a local graph repo
echo -e '\n\n > Use local graph repo:\n'

curl -f -k --verbose --basic admin:admin -X POST \
"${EGERIA_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${EGERIA_SERVER}/local-repository/mode/local-graph-repository"

# -- Audit log settings

# Remove existing audit log
curl -f -k --verbose --basic admin:admin -X DELETE \
"${EGERIA_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${EGERIA_SERVER}/audit-log-destinations"

# Add slf audit log

#curl -f -k --verbose --basic admin:admin -X POST \
# --header "Content-Type: application/json" \
# "${EGERIA_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${EGERIA_SERVER}/audit-log-destinations/slf4j" \
# --data '{}'
# See https://httpie.io - Curl above not correct for required format.
http --verify=no POST "${EGERIA_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${EGERIA_SERVER}/audit-log-destinations/slf4j" <<END
[]
END

# Start up the server
echo -e '\n\n > Starting the server:\n'

curl -f -k --verbose --basic admin:admin -X POST --max-time 900 \
"${EGERIA_ENDPOINT}/open-metadata/admin-services/users/${EGERIA_USER}/servers/${EGERIA_SERVER}/instance"



echo '-- End of configuration'
```
5 changes: 4 additions & 1 deletion site/docs/guides/admin/omag-server-platform-logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@ Example:
logging.level.org.odpi.openmetadata.frameworks.auditlog.omag-server-1=INFO
logging.level.org.odpi.openmetadata.frameworks.auditlog.omag-server-2.RepositoryContentManager=ERROR
```
## Example logging configuration

--8<-- "snippets/abbr.md"
See [example of configuring Egeria's Audit Log, and debug logging, to output JSON via the console](omag-server-platform-logging-jsonexample.md)

--8<-- "snippets/abbr.md"
Loading

0 comments on commit cfebfe3

Please sign in to comment.