Skip to content

Commit

Permalink
Add WAR file documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi committed Dec 19, 2024
1 parent 11c2032 commit 5dea5a9
Showing 1 changed file with 31 additions and 57 deletions.
88 changes: 31 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,65 @@
Aristotle
=========
Wilhelm Webservice
==================

![Java Version Badge][Java Version Badge]
[![Apache License Badge]][Apache License, Version 2.0]

Aristotle is a [JSR 370] [JAX-RS] webservice of CRUD operations against a graph database. It supports Neo4J now.
__wilhelm-ws__ is a [JSR 370] [JAX-RS] webservice exclusively serving [wilhelmlang.com](https://wilhelmlang.com/)

Start Locally in Jetty
----------------------
Development
-----------

Navigate to a dedicated directory; make sure port 8080 is not occupied and the following environment variables are set:
### Getting Source Code

```console
export NEO4J_URI=
export NEO4J_USERNAME=
export NEO4J_PASSWORD=
export NEO4J_DATABASE=
git@github.com:QubitPi/wilhelm-ws.git
cd wilhelm-ws
```

Then start webservice with:
#### Running Tests

```bash
./jetty-start.sh
```console
mvn clean verify
```

Press `Ctr-C` to stop the webservice and delete generated directories if needed when done.
### Generating WAR file

Test
----
wilhelm-ws favors running in an external Jetty container, so its executable is not a fat JAR but a WAR which can be
compiled up with

```console
mvn clean verify
mvn clean package
```

Deployment
----------
### Starting Webservice Locally

At this moment deployment is manual and pretty much follows [jetty-start.sh](./jetty-start.sh)

### Sending Logs to ELK Cloud
Navigate to a dedicated directory; make sure port 8080 is not occupied and the following environment variables are set:

Simply add Logstash integration and install agent on the production server. The logs will be available on integration
dashboard.
```console
export NEO4J_URI=
export NEO4J_USERNAME=
export NEO4J_PASSWORD=
export NEO4J_DATABASE=
```

### Gateway Registration
Then start webservice with:

```bash
export GATEWAY_PUBLIC_IP=<gateway IP>

# vocabulary paged & count
curl -v -i -s -k -X POST https://api.paion-data.dev:8444/services \
--data name=wilhelm-ws-languages \
--data url="http://${GATEWAY_PUBLIC_IP}:8080/v1/neo4j/languages"
curl -i -k -X POST https://api.paion-data.dev:8444/services/wilhelm-ws-languages/routes \
--data "paths[]=/wilhelm/languages" \
--data name=wilhelm-ws-languages

# expand
curl -v -i -s -k -X POST https://api.paion-data.dev:8444/services \
--data name=wilhelm-ws-expand \
--data url="http://${GATEWAY_PUBLIC_IP}:8080/v1/neo4j/expand"
curl -i -k -X POST https://api.paion-data.dev:8444/services/wilhelm-ws-expand/routes \
--data "paths[]=/wilhelm/expand" \
--data name=wilhelm-ws-expand

# search
curl -v -i -s -k -X POST https://api.paion-data.dev:8444/services \
--data name=wilhelm-ws-search \
--data url="http://${GATEWAY_PUBLIC_IP}:8080/v1/neo4j/search"
curl -i -k -X POST https://api.paion-data.dev:8444/services/wilhelm-ws-search/routes \
--data "paths[]=/wilhelm/search" \
--data name=wilhelm-ws-search
./jetty-start.sh
```

We should see `HTTP/1.1 201 Created` as signs of success.
Press `Ctr-C` to stop the webservice and delete generated directories if needed when done.

#### Example requests
### Deployment

- vocabulary count: https://api.paion-data.dev/wilhelm/languages/german?perPage=100&page=1
- query vocabulary paged: https://api.paion-data.dev/wilhelm/languages/german/count
- expand: https://api.paion-data.dev/wilhelm/expand/nämlich
- search: https://api.paion-data.dev/wilhelm/search/das
wilhelm-ws has a dedicated release definition called
[wilhelm-ws-release-definition](https://github.com/QubitPi/wilhelm-ws-release-definition) for its automated deployment.
Please check that our for details.

License
-------

The use and distribution terms for [Aristotle]() are covered by the [Apache License, Version 2.0].
The use and distribution terms for [wilhelm-ws]() are covered by the [Apache License, Version 2.0].

[Apache License Badge]: https://img.shields.io/badge/Apache%202.0-F25910.svg?style=for-the-badge&logo=Apache&logoColor=white
[Apache License, Version 2.0]: https://www.apache.org/licenses/LICENSE-2.0
Expand Down

0 comments on commit 5dea5a9

Please sign in to comment.