Skip to content

Commit 2fd7776

Browse files
feat: better documentation clarity across cadence-samples to reduce onboarding friction for new developers (#126)
* Configured dev env to run in 'cadence-samples Signed-off-by: Diana Zawadzki <[email protected]> * Fixed --workflow flag, param isn't passed with dashes Signed-off-by: Diana Zawadzki <[email protected]> * Add Docker troubleshooting section to README Signed-off-by: Diana Zawadzki <[email protected]> * Add visual walkthrough screenshots to hello_world README Signed-off-by: Diana Zawadzki <[email protected]> * Clean up hello_world README: remove redundant screenshots Signed-off-by: Diana Zawadzki <[email protected]> * Move workflow files to activities/ and operations/ folders Signed-off-by: Diana Zawadzki <[email protected]> --------- Signed-off-by: Diana Zawadzki <[email protected]>
1 parent c0eaa27 commit 2fd7776

17 files changed

+152
-121
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,46 @@ This downloads and starts all required dependencies including Cadence server, da
3838
make
3939
```
4040

41+
### Docker Troubleshooting
42+
43+
The `docker-compose` command requires Docker daemon to be running. On macOS/Windows, open Docker Desktop. On Linux, run `sudo systemctl start docker`.
44+
45+
<details>
46+
<summary>Port conflicts</summary>
47+
48+
If you see `Bind for 0.0.0.0:<port> failed: port is already allocated`, find the process using that port:
49+
50+
```bash
51+
lsof -i tcp:<port>
52+
```
53+
54+
To find which container is using it:
55+
```bash
56+
docker ps --format '{{.ID}}\t{{.Ports}}\t{{.Names}}' | grep <port>
57+
```
58+
59+
Stop and remove the conflicting container:
60+
```bash
61+
docker stop <container_id> && docker rm <container_id>
62+
```
63+
64+
Cadence uses these ports: `7833`, `7933`, `7939`, `8000-8003`, `8088` (Web UI), `9042` (Cassandra), `9090` (Prometheus), `3000` (Grafana).
65+
66+
</details>
67+
68+
<details>
69+
<summary>Reset everything</summary>
70+
71+
```bash
72+
docker-compose down
73+
docker ps -a # check for leftover containers
74+
docker rm <container_id> # remove if needed
75+
```
76+
77+
Verify with `docker ps` and visit [http://localhost:8088](http://localhost:8088).
78+
79+
</details>
80+
4181
## 📚 Sample Categories
4282

4383
### Table of Contents

config/development.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# config for sample
2-
domain: "default"
2+
domain: "cadence-samples"
33
service: "cadence-frontend"
44
host: "localhost:7833"
55
# config for emitting metrics

new_samples/README.md

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,41 @@ cadence --env development \
3333
Try to inspect the log message for the output.
3434

3535
### Signal Workflow
36-
This workflow demonstrate a basic signal workflow. It takes your name as input parameter
37-
and greet you based on languages you pick. To start the workflow, try the following CLI.
36+
This workflow demonstrates a basic signal workflow. It waits for a signal to complete.
37+
To start the workflow, try the following CLI.
3838

3939
```bash
4040
cadence --env development \
4141
--domain cadence-samples \
4242
workflow start \
43-
--workflow_type cadence_samples.SignalGreeterMultiLanguageWorkflow \
43+
--workflow_type cadence_samples.SimpleSignalWorkflow \
4444
--tl cadence-samples-worker \
45-
--et 6000 \
46-
--input '{"name":"Uber"}'
45+
--et 600
4746
```
4847

49-
A workflow ID and run ID will be return in your terminal. Copy the workflow ID and replace
50-
to the CLI below to trigger the signal. Try to change the input language value and inspect what
51-
happens in the log. Also, try to inspect what happened after you interact with the signal multiple times.
48+
A workflow ID and run ID will be returned in your terminal. Copy the workflow ID and use
49+
the CLI below to send a signal. The workflow will continue running until it receives a
50+
`complete` signal with the value `true`.
5251

5352
```bash
5453
cadence --env development \
5554
--domain cadence-samples \
5655
workflow signal \
57-
--workflow_id <Your workflow ID> \
58-
--name "language" \
59-
--input '"english"'
56+
--wid <Your workflow ID> \
57+
--name "complete" \
58+
--input 'false'
6059
```
6160

62-
To cancel the workflow, try the following CLI.
61+
To complete the workflow, send the signal with `true`:
6362

6463
```bash
6564
cadence --env development \
6665
--domain cadence-samples \
6766
workflow signal \
68-
--workflow_id <Your workflow ID> \
69-
--name "cancel" \
67+
--wid <Your workflow ID> \
68+
--name "complete" \
7069
--input 'true'
7170
```
72-
The workflow should have a status of fail.
7371

7472
### Dynamic workflow
7573
This dynamic workflow is very similar to the Hello World workflow above, but instead of passing the

new_samples/hello_world/README.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ cadence --env development \
4343
--input '{"message":"Cadence"}'
4444
```
4545

46+
You should see output like this:
47+
48+
![Trigger command output](images/02-trigger-command-started-workflow.png)
49+
50+
And the worker will log the completed workflow:
51+
52+
![Worker output showing workflow completed](images/01-worker-output-workflow-completed.png)
53+
4654
Here are the details to this command:
4755

4856
* `--domain` option describes under which domain to run this workflow
@@ -60,24 +68,33 @@ To see more options run `cadence --help`
6068

6169
Click on `cadence-samples` domain in cadence-web to view your workflow.
6270

71+
![Workflow list showing completed workflow](images/03-web-ui-workflow-list-completed.png)
72+
73+
Click on the workflow to see details:
74+
6375
* In Summary tab, you will see the input and output to your workflow
64-
* Click on History tab to see individual steps.
76+
77+
![Summary tab](images/04-web-ui-summary-tab.png)
78+
79+
* Click on History tab to see individual steps. Expand an activity to see its result:
80+
81+
![History tab with activity result](images/05-web-ui-history-activity-result.png)
6582

6683
#### CLI
6784

6885
List workflows using the following command:
6986

7087
```bash
71-
cadence --env development --domain cadence-samples --workflow list
88+
cadence --env development --domain cadence-samples workflow list
7289
```
7390

7491
You can view an individual workflow by using the following command:
7592

7693
```bash
7794
cadence --env development \
7895
--domain cadence-samples \
79-
--workflow describe \
80-
--wid <workflow_id>
96+
workflow describe \
97+
--wid <workflow_id>
8198
```
8299

83100
* `workflow` is the noun to run commands within workflow scope
@@ -90,10 +107,18 @@ To view the entire history of the workflow, use the following command:
90107
```bash
91108
cadence --env development \
92109
--domain cadence-samples \
93-
--workflow show \
94-
--wid <workflow_id>
110+
workflow show \
111+
--wid <workflow_id>
95112
```
96113

114+
## Troubleshooting
115+
116+
If you see port conflicts when starting Docker, use `lsof` to find what's using the port:
117+
118+
![Docker port conflict troubleshooting](images/06-docker-port-conflict-troubleshooting.png)
119+
120+
See the main [README](../../README.md#docker-troubleshooting) for detailed Docker troubleshooting steps.
121+
97122
## References
98123

99124
* The website: https://cadenceworkflow.io

new_samples/hello_world/generator/README_specific.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@ Click on `cadence-samples` domain in cadence-web to view your workflow.
3737
List workflows using the following command:
3838

3939
```bash
40-
cadence --env development --domain cadence-samples --workflow list
40+
cadence --env development --domain cadence-samples workflow list
4141
```
4242

4343
You can view an individual workflow by using the following command:
4444

4545
```bash
4646
cadence --env development \
4747
--domain cadence-samples \
48-
--workflow describe \
49-
--wid <workflow_id>
48+
workflow describe \
49+
--wid <workflow_id>
5050
```
5151

5252
* `workflow` is the noun to run commands within workflow scope
@@ -59,6 +59,6 @@ To view the entire history of the workflow, use the following command:
5959
```bash
6060
cadence --env development \
6161
--domain cadence-samples \
62-
--workflow show \
63-
--wid <workflow_id>
62+
workflow show \
63+
--wid <workflow_id>
6464
```
92.7 KB
Loading
53.7 KB
Loading
174 KB
Loading

0 commit comments

Comments
 (0)