Bookstore project consists of 8 primary microservices, one web application, and a load generator.
Purposes: demonstrating of Dynatrace capabilities in high-load and unhealthy environments
Note: to setup a Kubernetes-based environment from public docker images from GCR, please follow the instructions in the k8s/README file
- Docker service (docker desktop) should be running
Install Ingress controller to enable WebApp access all microservices in your deployment
helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace
Note: Restart Docker Desktop after setting up ingress-nginx
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.2/deploy/static/provider/cloud/deploy.yaml
Note: Restart Docker Desktop after setting up ingress-nginx
helm install ingress-nginx ingress-nginx/ingress-nginx --create-namespace --namespace ingess-nginx `
--set controller.service.annotations."service\.beta\.kubernetes\.io/azure-load-balancer-health-probe-request-path"=/healthz
minikube addons enable ingress
-
Go to
k8s
directory -
execute, optionally providing otel token with the scopes of
trace_otel_ingest
,log_otel_ingest
,metric_otel_ingest
./build_docker_all.sh [<tenantID>] [dev|sprint] [<otel_ingest_token>]
the token can be base64-ed or open
-
Go to
k8s
directory -
execute, optionally providing otel token with the scopes of
trace_otel_ingest
,log_otel_ingest
,metric_otel_ingest
.\build_docker_all.bat [<tenantID>] [dev|sprint] [<otel_ingest_token>]
-
Set the public host name in
ingress.yaml
- host: kubernetes.docker.internal
-
Set your tenant's id and URL in
configmap.yaml
TENANT_ID: <tenant-id> ## for instance, fdg3423 TENANT_LAYER: <layer> ## e.g. sprint or dev ... BOOKSTORE_BASE_SRV_URL: "http://<host_from_ingress>/api" ## e.g. BOOKSTORE_BASE_SRV_URL: "http://kubernetes.docker.internal/api" ## if you use Labmda function to randomize payment failure/success, please also set the following: DT_BANK_CHECK: "lambda" # lambda | rand AWS_LAMBDA_URL: <URL to the Lambda function> ## e.g. AWS_LAMBDA_URL: "https://my-lambla.execute-api.us-east-1.amazonaws.com/default/bookstore-bankinfo"
-
Define instrumentation (OneAgent or Otel) for the microservices in
config_agents.yaml
<microservice>_agent: [oneAgent|otelAgent|none] # set for all *_agent records
-
Generate Tokens
-
OpenIngest token
-
Open
Dynatrace UI > Manage > Access tokens
-
click on
Generate new token
-
select
Ingest OpenTelemetry traces
in the scope -
click
Generate
-
convert the token to base64:
echo -n <token> | base64 -w 0
Note: on MacOS
-w 0
is not needed
-
-
OneAgent token
-
Open
Dynatrace UI > Manage > Access tokens
-
click on
Generate new token
-
select
PaaS integration - Installer download
in the scope -
click
Generate
-
convert the token to base64:
echo -n <token> | base64 -w 0
Note: on MacOS
-w 0
is not needed
-
-
Entities Read token (needed to send deployment events)
-
Open
Dynatrace UI > Manage > Access tokens
-
click on
Generate new token
-
select
Read entities
in the scope -
click
Generate
-
convert the token to base64:
echo -n <token> | base64 -w 0
Note: on MacOS
-w 0
is not needed
-
-
Events Ingest token (needed for sending deployment events)
-
Open
Dynatrace UI > Manage > Access tokens
-
click on
Generate new token
-
select
Ingest events
in the scope -
click
Generate
-
convert the token to base64:
echo -n <token> | base64 -w 0
Note: on MacOS
-w 0
is not needed
-
-
-
Put tokens in the secrets,
secret.yaml
fileoneagent-token: <base64-ed OneAgent token (make sure you concatenated if it's multiline)> otel-token: <base64-ed Otel token (make sure you concatenated if it's multiline)>
the yaml configurations for deployments need to be preconfigured.
Use preset_deployment.sh
for that:
- on-deploy agent installation images for Intel/AMD architecture, books namespace (default ns is bookstore):
./preset_deployment.sh -gyes -ax64 -n books
- on-deploy agent installation images for ARMv8 architecture, books namespace (default ns is bookstore):
./preset_deployment.sh -gyes -aarm -n books
- on-build agent installation images for Intel/AMD architecture, books namespace (default ns is bookstore):
./preset_deployment.sh -gpre -ax64 -n books
- on-build agent installation images for ARMv8 architecture, books namespace (default ns is bookstore):
./preset_deployment.sh -gpre -aarm -n books
- use non-instrumented images for Intel/AMD architecture, bookstore namespace (-n to override):
./preset_deployment.sh -gno -ax64
- use non-instrumented images for ARMv8 architecture, bookstore namespace (-n to override):
./preset_deployment.sh -gno -aarm
- reset the yaml-files:
./preset_deployment.sh -reset
- "on deploy" vs "on build":
-gyes
parameter makes OneAgent and Otel to be downloaded and configured on every pod start.- pros: you get the latest agent on every pod restart
- cons: more traffic (download agents); more time for pod to start
-gpre
parameter makes OneAgent and Otel to be a part of docker image.- pros: quicker to start, less traffic (agent is already in the image)
- cons: to update the Agents you need to rebuild the docker images
-
Create
namespace
:kubectl apply -f namespace.yaml
-
Create
configmaps
:kubectl apply -f configmap.yaml kubectl apply -f config_agents.yaml
-
Create
secrets
:kubectl apply -f secret.yaml
-
Create
databases
(unless you're using thek8s-databases
project):kubectl apply -f databases.yaml
-
Create all
deployments
andservices
:kubectl apply -f clients.yaml kubectl apply -f books.yaml kubectl apply -f carts.yaml kubectl apply -f storage.yaml kubectl apply -f orders.yaml kubectl apply -f ratings.yaml kubectl apply -f payments.yaml kubectl apply -f dynapay.yaml kubectl apply -f ingest.yaml
-
Create the
web app
:kubectl apply -f web.yaml
-
Setup
Ingress
:kubectl apply -f ingress.yaml
-
Delete the app:
kubectl delete -f web.yaml kubectl delete -f clients.yaml kubectl delete -f books.yaml kubectl delete -f carts.yaml kubectl delete -f storage.yaml kubectl delete -f orders.yaml kubectl delete -f ratings.yaml kubectl delete -f payments.yaml kubectl delete -f dynapay.yaml kubectl delete -f ingest.yaml kubectl delete -f ingress.yaml kubectl delete -f databases.yaml kubectl delete -f secret.yaml kubectl delete -f config_agents.yaml kubectl delete -f configmap.yaml kubectl delete -f namespace.yaml
./restart.sh # deploys databases and backend microservices
./restart.sh -web # deploys everything including the web app
./restart.sh -nodb # won't touch the DB (restart of the DB causes data reset)
./delete.sh # undeploys microservices and the web app (DBs stay)
./delete.sh -all # undeploys everything, including the DBs, configmaps
.\restart.bat &REM deploys databases and backend microservices
.\restart.bat -web &REM deploys everything including the web app
.\restart.bat -nodb &REM won't touch the DB (restart of the DB causes data reset)
.\delete.bat &REM undeploys microservices and the web app (DBs stay)
.\delete.bat -all &REM undeploys everything, including the DBs, configs
kubectl exec -it <Pod_Name> -c <Container_Name> -- /bin/bash