iching-broker-level3/README.md

46 lines
1.9 KiB
Markdown
Raw Normal View History

2025-03-31 09:06:14 +00:00
# I-Ching
The I-Ching (a.k.a. the *Book of Changes*) is an ancient method of divination based on
cleromancy (assigning meaning to the generation of apparently random numbers.) Six numbers
between 6 and 9 are generated in order to create a hexagram, the meaning of which is
contained in the I Ching book.
You can find lots of great information on the 2000+ year history of the I-Ching on
[Wikipedia](https://en.wikipedia.org/wiki/I_Ching)
This app will send an I-Ching horoscope to the pre-configured mailhog instance in configurable intervalls.
This app uses the I-Ching library app https://github.com/Velfi/i-ching.git.
2025-04-14 09:24:56 +00:00
<!--## Configuration
2025-03-31 14:21:15 +00:00
Properties of the app can be configured in the file config.json. It is possible to configure the mail host and port.
2025-04-14 09:24:56 +00:00
It is also possible to configure the intervall of days between the sending of horoscopes and the time of sending. The default is to send one email every seven days at 8 am.-->
2025-03-31 09:06:14 +00:00
2025-03-31 11:59:41 +00:00
## First Start
The app can be deployed by running:
2025-03-31 14:21:15 +00:00
```bash
2025-04-14 09:24:56 +00:00
$ kubectl apply -f ingress.yaml
$ kubectl apply -f service.yaml
2025-03-31 14:21:15 +00:00
$ kubectl apply -f deployment.yaml
```
2025-03-31 11:59:41 +00:00
When a pod with the app is initally started, one email will be sent to the configured receiver.
2025-04-14 09:24:56 +00:00
## Backend Server
The backend server is running inside the pod on the address http://localhost:8090/command. If a POST is sent to this address, the server will run the main logic of this app:
An E-Mail with an I-Ching horoscope (provided by the library app) will be sent to the configured email address.
2025-04-14 10:44:59 +00:00
The backend server can be tested from inside the pod by calling 'curl -X POST http://localhost:8090/iching/api/command' from the console.
2025-04-14 09:24:56 +00:00
## HTTP Server
The frontend server is running inside the pod on the address http://localhost:8080/iching. It provides an HTML homepage with a button. Upon pressing the button, the backend server will be called (to send an E-Mail).
<!--## Testing
2025-03-31 11:59:41 +00:00
The Jest unit tests can be run with
2025-03-31 14:21:15 +00:00
```bash
$ npm test
2025-04-14 09:24:56 +00:00
```
-->