No description
Find a file
Christopher Hase bbad13f570
All checks were successful
ci / build (push) Successful in 1m6s
add config.json again, part 2
2025-04-17 16:11:34 +02:00
.github/workflows Update .github/workflows/ci.yaml 2025-04-02 12:27:15 +00:00
backend add config.json again 2025-04-17 14:46:32 +02:00
frontend run locally part 1.0 2025-04-16 15:37:16 +02:00
node_modules add http-server part 7.8 2025-04-11 11:21:06 +02:00
deployment.yaml run in docker part 1.0 2025-04-16 13:53:25 +02:00
Dockerfile add http-server part 8.5.1 2025-04-14 15:02:31 +02:00
mime.types add http-server part 4.3 2025-04-08 11:15:53 +02:00
old.jest.config.ts make unit tests runnable again 2025-04-17 13:50:24 +02:00
package-lock.json add http-server part 7.8 2025-04-11 11:21:06 +02:00
package.json make unit tests runnable again 2025-04-17 13:50:24 +02:00
README.md add config.json again, part 2 2025-04-17 16:11:34 +02:00
start-local.sh add config.json again 2025-04-17 14:46:32 +02:00
start.sh run in docker part 1.0 2025-04-16 13:53:25 +02:00
tsconfig.backend.json make unit tests runnable again 2025-04-17 13:50:24 +02:00
tsconfig.frontend.json add http-server part 6.1 2025-04-10 10:21:29 +02:00
tsconfig.json add http-server part 6.1 2025-04-10 10:21:29 +02: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

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.

Configuration

Properties of the app can be configured in the file config.json. It is possible to configure the mail host and port. 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.

This will start the deployment of the app in the pod, the service and an ingress for the HTTP frontend server and an ingress for the backend server. When a pod with the app is initally started, one email will be sent to the configured receiver.

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.

The backend server can be tested from inside the pod by calling 'curl -X POST http://localhost:8090/iching/api/command' from the console. The backend server has a separate ingress, so API requests can get forwarded to the backend. Also the backend does not need 'rewrite target'.

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). The frontend server has a separate ingress from the backend server, since the frontend server needs the 'rewrite target' annotation: So the Frontend is not running in the root folder but using the sub-path 'iching'.

Testing

The Jest unit tests can be run with

$     npm test

Running the App

Locally

The app can be deployed locally by running: The app can be deployed by running:

$     ./start-local.sh 

Der HTTP-Server can be access in a browser with the address http://localhost:8080/.

Locally with Docker

The app can be deployed by running:

$     docker run -e DEPLOY_MODE=docker -p 8080:8080 -p 8090:8090 --rm my-typescript-app 

Der HTTP-Server can be access in a browser with the address http://localhost:8080/.

In Kubernetes

The app can be deployed by running:

$     kubectl apply -f deployment.yaml 

Der HTTP-Server can be access in a browser with the address https://192-168-197-2.c-one-infra.de/iching/