@@ -5,16 +5,18 @@ been modified considerably to showcase Signadot & Sandboxes.
55
66![ image] ( /docs/graph.png )
77
8+
89## Running
910
1011First, [ install Signadot Operator] ( https://www.signadot.com/docs/installation/signadot-operator )
1112if you haven't already.
13+ Next, install and configure the [ Signadot CLI] ( https://www.signadot.com/docs/getting-started/installation/signadot-cli ) .
1214
13- ### Run everything in Kubernetes
15+ ### Install the HotROD Application
1416
1517Decide on a namespace in which to install HotROD and then run:
1618
17- ``` sh
19+ ``` bash
1820kubectl create ns " ${NAMESPACE} "
1921kubectl -n " ${NAMESPACE} " apply -k k8s/overlays/prod/< devmesh | istio>
2022```
@@ -28,28 +30,100 @@ kubectl delete ns "${NAMESPACE}"
2830
2931## Development
3032
33+ You can easily run any of the HotROD services on your workstation by leveraging
34+ Signadot sandboxes. Let’s walk through an example of how to do this for the
35+ frontend application.
36+
3137### Frontend
3238
33- To run frontend you could easily run with ` air ` that helps with hot-reload.
39+ Let's start by connecting the cluster and creating a sandbox with a local
40+ workload. Be sure to replace ` <cluster-name> ` and ` <namespace> ` with the
41+ appropriate values for your setup:
42+
43+ ``` bash
44+ # Connect to the cluster
45+ #
46+ signadot local connect
47+
48+
49+ # Create a local sandbox for the frontend app
50+ #
51+ signadot sandbox apply -f - << EOF
52+ name: local-hotrod-frontend
53+ spec:
54+ cluster: <cluster-name>
55+ local:
56+ - name: local-frontend
57+ from:
58+ kind: Deployment
59+ namespace: <namespace>
60+ name: frontend
61+ mappings:
62+ - port: 8080
63+ toLocal: localhost:8080
64+ EOF
65+ ```
3466
35- Before running ` air ` or manual steps you have to set up the following env
36- ``` shell
37- export KAFKA_BROKER=kafka-headless.${NAMESPACE} .svc:9092
38- export REDIS_ADDR=redis.${NAMESPACE} .svc:6379
39- export FRONTEND_LOCATION_ADDR=location.${NAMESPACE} .svc:8081
67+ The above sandbox ensures that any traffic within the cluster directed to
68+ ` http://frontend.<namespace>:8080 ` is routed to your local machine at
69+ ` localhost:8080 ` .
70+
71+ Now it's time to run the local version of the frontend application, which will
72+ bind to ` localhost:8080 ` .
73+
74+ Since the frontend depends on several other services, such as the location
75+ service, Redis, Kafka, and others, we'll continue using the existing in-cluster
76+ instances of these dependencies. To ensure the local frontend can seamlessly
77+ communicate with them, we'll reuse the environment configuration from the
78+ in-cluster baseline workload.
79+
80+ To load these environment variables into your local shell, run:
81+
82+ ``` bash
83+ eval " $( signadot sandbox get-env local-hotrod-frontend) "
4084```
4185
42- Now let's run the frontend
43- ``` shell
86+ This command fetches and sets the necessary environment variables so your local
87+ frontend can interact with the in-cluster services just as it would within the
88+ cluster.
89+
90+ To run the frontend application locally, you have a couple of options.
91+
92+ If you prefer automatic hot-reloading during development, you can use ` air ` :
93+
94+ ``` bash
4495air
4596```
4697
47- That will listen for the changes and restart the server every change.
98+ Alternatively, you can manually build and run the frontend using the ` make ` and
99+ ` go run ` commands:
48100
49- If no want to use this approach, you could
50- ``` shell
101+ ``` bash
51102make build-frontend-app
52- go run ./cmd/hotrod/main.go frontend
103+ go run ./cmd/hotrod frontend
104+ ```
105+
106+ Both approaches will launch the frontend bound to ` localhost:8080 ` , ready to
107+ receive traffic from the Signadot sandbox.
108+
109+ Now you can even run Signadot Smart Tests against your local frontend to
110+ validate its behavior in a realistic environment. For example:
111+
112+ ``` bash
113+ signadot st run --sandbox=local-hotrod-frontend --publish
114+ Created test run with ID " eu3o6mpz6mtc" in cluster " xrc-test" .
115+
116+ Test run status:
117+ ✅ ...rt-tests/frontend/post-frontend-dispatch.star [ID: eu3o6mpz6mtc-1, STATUS: completed]
118+ ✅ ...hotrod/smart-tests/location/get-location.star [ID: eu3o6mpz6mtc-2, STATUS: completed]
119+
120+ Test run summary:
121+ * Executions
122+ ✅ 2/2 tests completed
123+ * Diffs
124+ ✅ No high/medium relevance differences found
125+ * Checks
126+ ✅ 2 checks passed
53127```
54128
55129
0 commit comments