Skip to content

Commit

Permalink
docs: add k8s deployment files for t2 in CLARA
Browse files Browse the repository at this point in the history
  • Loading branch information
eliasmueller committed Dec 18, 2024
1 parent 8bb128d commit b4ec7f4
Show file tree
Hide file tree
Showing 17 changed files with 1,044 additions and 28 deletions.
2 changes: 1 addition & 1 deletion clara-app/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.1
1.2.2
35 changes: 8 additions & 27 deletions docs/content/validation/t2-reference-architecture/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,33 +93,14 @@ The setup consists of the Gropius setup, the minikube setup, the T2-Project setu
kubectl create ns clara
```

## 3. T2-Project Configuration
- Clone the [T2-Project's devops subproject](https://github.com/t2-project/devops).
```sh
git clone https://github.com/t2-project/devops.git
```
or
```sh
git clone [email protected]:t2-project/devops.git
```
- Navigate to the directory `devops/k8s/t2-microservices/base`, where you find the deployment manifests for the T2-Project microservices.
- Insert the following into each of the `Deployment` part of the respective yaml file (except for the postgres services):
```yaml
spec:
template:
metadata:
annotations:
instrumentation.opentelemetry.io/inject-java: "true"
```
- You will deploy the microservices below in [5. Deploy T2-Project](#5-deploy-t2-project) **after** the CLARA setup.
## 4. CLARA Setup
## 3. CLARA Setup
- Setup CLARA on your local machine as described in steps 1 and 2 on the [setup page](../../setup/index.md#1-prerequisites).
* Use `clara` as the target namespace.
* In step 2.1 you can skip the injection of the annotations into the deployments, as you have already done this.
* In step 2.1 you can skip the injection of the annotations into the deployments, as we prepared this for the recreation of the T2-Project recovery.
- **DO NOT RUN CLARA YET**, as the T2-Project is not yet deployed.

## 5. Deploy T2-Project
- In the T2-Project's `devops`-repository navigate back to `devops/k8s` and execute the following to install the T2-Project into the cluster:
## 4. Deploy T2-Project
- In the CLARA-repository change directory to `t2-deployment` and execute the following to install the T2-Project into the cluster:
```sh
chmod +x ./start-microservices.sh
./start-microservices.sh clara
Expand All @@ -129,21 +110,21 @@ The setup consists of the Gropius setup, the minikube setup, the T2-Project setu
- For further questions regarding the T2-Project, check the official [deployment instructions](https://t2-documentation.readthedocs.io/en/latest/microservices/deploy.html).


## 6. Execution
### 6.1 Create Traffic
## 5. Execution
### 5.1 Create Traffic
- Create traffic during the execution by manually clicking around the web shop.
- To do that, create a port forward to the T2-Project UI from your shell:
```sh
kubectl -n clara port-forward svc/ui 7000:80
```
- Open the shop under http://localhost:7000/ui/products and click around the shop and order some tea to create traffic.

### 6.2 Execute CLARA
### 5.2 Execute CLARA
- Execute CLARA as described in step 3 on the [setup page](../../setup/index.md#3-run-clara).
- You can use the default config as provided. No need to change anything.
- Check the CLARA logs during execution and ensure spans are coming in, when clicking around the web shop.

### 6.3 Visit the results
### 5.3 Visit the results
- CLARA should now execute without any issues.
- If so, in the end open the Gropius UI under http://localhost:4200 and open your project.
- You should see the recovered architecture of the T2-Project in the UI now.
29 changes: 29 additions & 0 deletions t2-deployment/mongodb/mongo-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

auth:
enabled: false

resources:
requests:
cpu: 150m
memory: 150Mi
# limits:
# cpu: 500m
# memory: 500Mi

# Liveness and readiness probes cause high CPU usage (2x 10%)
# Therefore we disable it for now
# See following issue for more information: https://github.com/bitnami/charts/issues/10264
livenessProbe:
enabled: false
# initialDelaySeconds: 30
# periodSeconds: 20
# timeoutSeconds: 10
# failureThreshold: 6
# successThreshold: 1
readinessProbe:
enabled: false
# initialDelaySeconds: 5
# periodSeconds: 20
# timeoutSeconds: 10
# failureThreshold: 6
# successThreshold: 1
24 changes: 24 additions & 0 deletions t2-deployment/start-microservices.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# Documentation: https://t2-documentation.readthedocs.io/en/latest/microservices/deploy.html

MY_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

# If an argument is given, use it as the namespace
if [ $# -gt 0 ]; then
NAMESPACE=$1
else
NAMESPACE="default"
fi

if [ $NAMESPACE != "default" ]; then
kubectl create namespace $NAMESPACE --dry-run=client -o yaml | kubectl apply -f -
fi

helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
helm install mongo-cart -f $MY_DIR/mongodb/mongo-values.yaml bitnami/mongodb -n $NAMESPACE
helm install mongo-order -f $MY_DIR/mongodb/mongo-values.yaml bitnami/mongodb -n $NAMESPACE
helm install kafka bitnami/kafka --version 18.5.0 --set replicaCount=1 -n $NAMESPACE

kubectl apply -k $MY_DIR/t2-microservices/ -n $NAMESPACE
19 changes: 19 additions & 0 deletions t2-deployment/stop-microservices.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

MY_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

if [ $# -gt 0 ]; then
NAMESPACE=$1
else
NAMESPACE="default"
fi

kubectl delete -k $MY_DIR/t2-microservices/base/ -n $NAMESPACE

helm uninstall mongo-cart -n $NAMESPACE
helm uninstall mongo-order -n $NAMESPACE
helm uninstall kafka -n $NAMESPACE

if [ $NAMESPACE != "default" ]; then
kubectl delete namespace $NAMESPACE
fi
77 changes: 77 additions & 0 deletions t2-deployment/t2-microservices/cart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
apiVersion: v1
kind: Service
metadata:
name: cart
labels:
app.kubernetes.io/name: cart
app.kubernetes.io/instance: cart
app.kubernetes.io/component: backend
app.kubernetes.io/version: "1.3"
app.kubernetes.io/part-of: t2-microservices
annotations:
prometheus.io/scrape: "true"
spec:
selector:
app.kubernetes.io/instance: cart
app.kubernetes.io/part-of: t2-microservices
ports:
- port: 80
targetPort: 8080
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cart
labels:
app.kubernetes.io/name: cart
app.kubernetes.io/instance: cart
app.kubernetes.io/component: backend
app.kubernetes.io/version: "1.3"
app.kubernetes.io/part-of: t2-microservices
spec:
selector:
matchLabels:
app.kubernetes.io/instance: cart
app.kubernetes.io/part-of: t2-microservices
template:
metadata:
annotations:
instrumentation.opentelemetry.io/inject-java: "true"
labels:
app.kubernetes.io/name: cart
app.kubernetes.io/instance: cart
app.kubernetes.io/component: backend
app.kubernetes.io/version: "1.3"
app.kubernetes.io/part-of: t2-microservices
spec:
containers:
- name: cart
imagePullPolicy: Always
env:
- name: MONGO_HOST
value: mongo-cart-mongodb
- name: T2_CART_TTL
value: "0"
- name: T2_CART_TASKRATE
value: "0"
- name: T2_JAEGER_ENABLED
value: "FALSE"
- name: T2_JAEGER_HOST
value: simplest-agent #todo
image: t2project/cart:main
ports:
- containerPort: 8080
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 250m
memory: 250Mi
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
restartPolicy: Always
108 changes: 108 additions & 0 deletions t2-deployment/t2-microservices/cdcservice.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
apiVersion: v1
kind: Service
metadata:
name: cdcservice
labels:
app.kubernetes.io/name: cdcservice
app.kubernetes.io/instance: cdcservice
app.kubernetes.io/component: middleware
app.kubernetes.io/version: 0.16.0.RELEASE
app.kubernetes.io/part-of: t2-microservices
spec:
ports:
- name: "8099"
port: 8099
targetPort: 8080
selector:
app.kubernetes.io/instance: cdcservice
app.kubernetes.io/part-of: t2-microservices
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cdcservice
labels:
app.kubernetes.io/name: cdcservice
app.kubernetes.io/instance: cdcservice
app.kubernetes.io/component: middleware
app.kubernetes.io/version: 0.16.0.RELEASE
app.kubernetes.io/part-of: t2-microservices
spec:
selector:
matchLabels:
app.kubernetes.io/instance: cdcservice
app.kubernetes.io/part-of: t2-microservices
template:
metadata:
annotations:
instrumentation.opentelemetry.io/inject-java: "true"
labels:
app.kubernetes.io/name: cdcservice
app.kubernetes.io/instance: cdcservice
app.kubernetes.io/component: middleware
app.kubernetes.io/version: 0.16.0.RELEASE
app.kubernetes.io/part-of: t2-microservices
spec:
containers:
- name: cdcservice
image: eventuateio/eventuate-cdc-service:0.16.0.RELEASE
imagePullPolicy: Always
ports:
- containerPort: 8080
env:
- name: JAVA_OPTS
value: -Xmx64m
- name: EVENTUATELOCAL_KAFKA_BOOTSTRAP_SERVERS
value: kafka:9092
- name: EVENTUATELOCAL_ZOOKEEPER_CONNECTION_STRING
value: kafka-zookeeper:2181
- name: EVENTUATE_CDC_PIPELINE_PIPELINE1_TYPE
value: eventuate-tram
- name: EVENTUATE_CDC_PIPELINE_PIPELINE1_READER
value: reader1
- name: EVENTUATE_CDC_PIPELINE_PIPELINE2_TYPE
value: eventuate-tram
- name: EVENTUATE_CDC_PIPELINE_PIPELINE2_READER
value: reader2
- name: EVENTUATE_CDC_READER_READER1_TYPE
value: postgres-wal
- name: EVENTUATE_CDC_READER_READER1_DATASOURCEURL
value: jdbc:postgresql://postgres-orchestrator/eventuate
- name: EVENTUATE_CDC_READER_READER1_DATASOURCEUSERNAME
value: eventuate
- name: EVENTUATE_CDC_READER_READER1_DATASOURCEPASSWORD
value: eventuate
- name: EVENTUATE_CDC_READER_READER1_DATASOURCEDRIVERCLASSNAME
value: org.postgresql.Driver
- name: EVENTUATE_CDC_READER_READER1_LEADERSHIPLOCKPATH
value: /eventuate/cdc/leader/orchestrator
- name: EVENTUATE_CDC_READER_READER1_OUTBOXID
value: "1"
- name: EVENTUATE_CDC_READER_READER2_TYPE
value: postgres-wal
- name: EVENTUATE_CDC_READER_READER2_DATASOURCEURL
value: jdbc:postgresql://postgres-inventory/inventory
- name: EVENTUATE_CDC_READER_READER2_DATASOURCEUSERNAME
value: inventory
- name: EVENTUATE_CDC_READER_READER2_DATASOURCEPASSWORD
value: inventory
- name: EVENTUATE_CDC_READER_READER2_DATASOURCEDRIVERCLASSNAME
value: org.postgresql.Driver
- name: EVENTUATE_CDC_READER_READER2_LEADERSHIPLOCKPATH
value: /eventuate/cdc/leader/inventory_service
- name: EVENTUATE_CDC_READER_READER2_OUTBOXID
value: "2"
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 250m
memory: 250Mi
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8080
initialDelaySeconds: 10
periodSeconds: 5
restartPolicy: Always
Loading

0 comments on commit b4ec7f4

Please sign in to comment.