Skip to content

Commit 54207be

Browse files
Leo6LeopierDipicreydr
authored
Sample App Tutorial Page Compilation (#6007)
* feat: add the first three pages of the sample app tutorial * Apply suggestions from code review Co-authored-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> * fix: fix the review comments in pg0 and pg1 * feat: add blog post 2 * feat: adding the images for page 2 * add: add more pages * add: adding the rest of the pages * add: modify the nav * add: finishing polishing * fix: update the iframe embedded video link * fix: fix the video embedding dimension and the access * fix: link minor error fix * fix: hide the setup script section * Apply suggestions from code review Co-authored-by: Christoph Stäbler <cstabler@redhat.com> * Update docs/bookstore/page-0/page-0-intro.md Co-authored-by: Christoph Stäbler <cstabler@redhat.com> * Update docs/bookstore/page-0.5/pg0.5-env-setup.md Co-authored-by: Christoph Stäbler <cstabler@redhat.com> * fix: fix christoph's comment * fix: Remove all the extra new lines * fix: update kubernetes to Kubernetes * Apply suggestions from code review Co-authored-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> Co-authored-by: Christoph Stäbler <cstabler@redhat.com> * fix: fix the wrong indentation in the yaml files * Update docs/bookstore/page-2/pg2-sentiment-svc.md Co-authored-by: Christoph Stäbler <cstabler@redhat.com> * fix: fix review comments * fix: change the console output to text - pg0.5 * fix: replace the console output pic with plaintextg for pg1 * fix: replace the console output pic with plaintext for pg 2&3 * fix: replace the console output pic with plaintext for pg 4 * fix: replace the console output pic with plaintext for pg 5 * fix: replace the console output pic with plaintext for pg 6 * fix: replace the console output pic with plaintext for pg 7 * fix: fix christoph's comments * Apply suggestions from code review Co-authored-by: Christoph Stäbler <cstabler@redhat.com> * fix: applying christoph's comments fix * fix: fix christoph's nit comments + open the link in new tab * fix: make sure all the command have the same root which is /start * fix: make all the links open in the new tab * fix: fix small errors * fix: remove default namespace * Update docs/bookstore/page-1/pg1-review-svc-1.md Co-authored-by: Christoph Stäbler <cstabler@redhat.com> * Apply suggestions from code review Co-authored-by: Christoph Stäbler <cstabler@redhat.com> * fix: update the wording to follow the Knative's branding guideline * fix: update the wording to follow the Knative's branding guideline * fix: update the naming of the pages * fix: fixing the wrong link in the tutorial.md page * Apply the patch from Christoph Co-authored-by: Christoph Stäbler <cstabler@redhat.com> * Apply suggestions from code review Co-authored-by: Christoph Stäbler <cstabler@redhat.com> * Update docs/bookstore/page-1/send-review-comment-to-broker.md Co-authored-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> --------- Co-authored-by: Pierangelo Di Pilato <pierangelodipilato@gmail.com> Co-authored-by: Christoph Stäbler <cstabler@redhat.com>
1 parent ac4af72 commit 54207be

File tree

150 files changed

+2799
-81
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+2799
-81
lines changed

code-samples/eventing/bookstore-sample-app/solution/ML-sentiment-analysis/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ The function's output will be only from
2020
---
2121

2222
### Prerequisite 1: Install Knative `func` CLI
23-
Knative Function enables you to easily create, build, and deploy stateless, event-driven functions as [Knative Services](https://knative.dev/docs/serving/services/#:~:text=Knative%20Services%20are%20used%20to,the%20Service%20to%20be%20configured) by using the func CLI.
23+
Knative Function enables you to easily create, build, and deploy stateless, event-driven functions as [Knative Services](https://knative.dev/docs/serving/services/#:~:text=Knative%20Services%20are%20used%20to,the%20Service%20to%20be%20configured){:target="_blank"} by using the func CLI.
2424

2525
In order to do so, you need to install the `func` CLI.
26-
You can follow the [official documentation](https://knative.dev/docs/getting-started/install-func/) to install the `func` CLI.
26+
You can follow the [official documentation](https://knative.dev/docs/getting-started/install-func/){:target="_blank"} to install the `func` CLI.
2727

2828
Running `func version` in your terminal to verify the installation, and you should see the version of the `func` CLI you installed.
2929

@@ -55,7 +55,7 @@ func create -l python sentiment-analysis
5555

5656
This command will create a new directory with the name `sentiment-analysis` and a bunch of files in it. The `func` CLI will generate a basic function template for you to start with.
5757

58-
You can find all the supported languages templates [here](https://knative.dev/docs/functions/).
58+
You can find all the supported languages templates [here](https://knative.dev/docs/functions/){:target="_blank"}.
5959

6060
The file tree will look like this:
6161
```bash
@@ -175,7 +175,7 @@ setup(
175175

176176
### Step 5: Try to build and run your Knative Function on your local machine
177177

178-
In knative function, there are two ways to build: using the [pack build](https://github.com/knative/func/blob/8f3f718a5a036aa6b6eaa9f70c03aeea740015b9/docs/reference/func_build.md?plain=1#L46) or using the [source-to-image (s2i) build](https://github.com/knative/func/blob/4f48549c8ad4dad34bf750db243d81d503f0090f/docs/reference/func_build.md?plain=1#L43).
178+
In knative function, there are two ways to build: using the [pack build](https://github.com/knative/func/blob/8f3f718a5a036aa6b6eaa9f70c03aeea740015b9/docs/reference/func_build.md?plain=1#L46){:target="_blank"} or using the [source-to-image (s2i) build](https://github.com/knative/func/blob/4f48549c8ad4dad34bf750db243d81d503f0090f/docs/reference/func_build.md?plain=1#L43){:target="_blank"}.
179179

180180
Currently. only the **s2i** build is supported if you need to run setup.py. When building with s2i, the `setup.py` file will be executed automatically after the dependencies have been installed.
181181

@@ -255,7 +255,7 @@ Knative function also have an easy way to simulate the CloudEvent, you can use t
255255
func invoke -f=cloudevent --data='{"input": "I love Knative so much"}' --content-type=application/json --type="new-comment" -v
256256
```
257257
where the `-f` flag indicates the type of the data, is either `HTTP` or `cloudevent`, and the `--data` flag is the input text.
258-
You can read more about `func invoke` [here](https://github.com/knative/func/blob/main/docs/reference/func_invoke.md).
258+
You can read more about `func invoke` [here](https://github.com/knative/func/blob/main/docs/reference/func_invoke.md){:target="_blank"}.
259259

260260
In this case, you will get the full CloudEvent response:
261261

@@ -302,7 +302,7 @@ NAMESPACE NAME URL
302302
default sentiment-analysis-app http://sentiment-analysis-app.default.10.99.46.8.sslip.io sentiment-analysis-app-00002 sentiment-analysis-app-00002 True
303303
```
304304

305-
Please note: if your URL ends with .svc.cluster.local, that means you can only access the function from within the cluster. You probably forget to configure the network or [start the tunnel](https://knative.dev/docs/getting-started/quickstart-install/#__tabbed_3_2) if you are using minikube.
305+
Please note: if your URL ends with .svc.cluster.local, that means you can only access the function from within the cluster. You probably forget to configure the network or [start the tunnel](https://knative.dev/docs/getting-started/quickstart-install/#__tabbed_3_2){:target="_blank"} if you are using minikube.
306306

307307
### Step 7: Verify the Deployment
308308
After deployment, the `func` CLI provides a URL to access your function. You can verify the function's operation by sending a request with a sample review comment.
@@ -340,8 +340,8 @@ Recall note box: you can get the URL to the function by running the following co
340340
kubectl get kservice -A
341341
```
342342
---
343-
Another option is to use curl to send a CloudEvent to the function.
344-
Using curl command to send a CloudEvent to the broker:
343+
Another option is to use curl to send a CloudEvents to the function.
344+
Using curl command to send a CloudEvents to the Broker:
345345
```bash
346346
[root@curler:/]$ curl -v "http://sentiment-analysis-app.default.10.99.46.8.sslip.io" \
347347
-X POST \

code-samples/eventing/bookstore-sample-app/solution/create-workspace.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@
44

55
To create a Slack workspace, follow these steps:
66

7-
- Visit [https://slack.com/get-started#/createnew](https://slack.com/get-started#/createnew).
7+
- Visit [https://slack.com/get-started#/createnew](https://slack.com/get-started#/createnew){:target="_blank"}.
88
- Enter your email address and click Continue, or continue with Apple or Google.
99
- Check your email for a confirmation code.
1010
- Enter the code on the Slack website.
1111
- Click "Create a Workspace" and follow the prompts.
12-
- For detailed instructions for androids and , refer to [Create a workspace](https://slack.com/help/articles/206845317-Create-a-Slack-workspace).
12+
- For detailed instructions how to create a workspace via the Desktop App, on Android or iOS, refer to [Create a Slack workspace](https://slack.com/help/articles/206845317-Create-a-Slack-workspace){:target="_blank"}.
1313

1414
## Adding Channels to Your Workspace
1515

1616
After creating your Slack workspace, you can add channels by following these steps:
1717

1818
- Click the '+' icon next to 'Channels' on the sidebar of your Slack workspace.
1919
- Choose "Create a channel" and specify the channel name and purpose.
20-
- For enterprise grid organizations, refer to [Slack's help article](https://slack.com/help/articles/115001399587-Add-a-channel-to-multiple-workspaces-in-your-Enterprise-Grid-organization) for instructions.
20+
- For enterprise grid organizations, refer to [Slack's help article](https://slack.com/help/articles/115001399587-Add-a-channel-to-multiple-workspaces-in-your-Enterprise-Grid-organization){:target="_blank"} for instructions.
2121

2222
## Setting Up a Webhook for Notifications
2323

2424
To set up a webhook for sending notifications to your Slack workspace:
2525

26-
- Create a [Slack app](https://api.slack.com/apps/new), following the instructions by signing in, adding name and workspace to put the app in.
26+
- Create a [Slack app](https://api.slack.com/apps/new){:target="_blank"}, following the instructions by signing in, adding name and workspace to put the app in.
2727
- After this, you'll be redirected to the setting pages of your new app. Choose **Incoming Webhook** and toggle **Activate Webhook**.
2828
- Scroll down to click the option **Add New Webhook to Workspace**.
2929
![Alt text](./screenshots/select-channel.png)
@@ -33,4 +33,4 @@ To set up a webhook for sending notifications to your Slack workspace:
3333
![Alt text](./screenshots/Postman.png)
3434
- Afterwards, the text channel should have a new message
3535
![Alt text](./screenshots/result.png)
36-
- Go to [Slack's webhook documentation](https://api.slack.com/messaging/webhooks) to learn more about setting up webhooks.
36+
- Go to [Slack's webhook documentation](https://api.slack.com/messaging/webhooks){:target="_blank"} to learn more about setting up webhooks.

code-samples/eventing/bookstore-sample-app/solution/db-service/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,20 @@ If the output lists the `BookReviews` table as follows, your database has been c
8989
## Question & Discussion
9090
1. Why did we choose to deploy our PostgreSQL database using a StatefulSet instead of a Knative Service?
9191

92-
We use [StatefulSet](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/) for databases instead of Knative Service mainly because databases need to remember data (like a notebook that keeps your notes). StatefulSets are good at remembering things because they can save data and have a special name and place where they live. This is very important for databases.
92+
We use [StatefulSet](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/){:target="_blank"} for databases instead of Knative Service mainly because databases need to remember data (like a notebook that keeps your notes). StatefulSets are good at remembering things because they can save data and have a special name and place where they live. This is very important for databases.
9393

9494
Knative Services are more like notebooks that you use and then throw away when you're done. They're great for tasks that don't need to keep data for a long time. You can make them go away when you don't need them and come back when you do. But databases need to always remember information, so they can't just disappear and come back.
9595

9696
Also, databases often talk in their own special language, not the usual web language (HTTP) that Knative Services are really good at understanding. Because of this, Knative Services aren't the best choice for databases. That's why we choose StatefulSet for databases in Kubernetes.
9797

9898
---
99-
Note box: However, Knative Service supports Volumes and Persistent Volumes, which can be used to store data. You can read more [here](https://knative.dev/docs/serving/services/storage/) about how to use Volumes and Persistent Volumes with Knative Services specially for your use case.
99+
Note box: However, Knative Service supports Volumes and Persistent Volumes, which can be used to store data. You can read more [here](https://knative.dev/docs/serving/services/storage/){:target="_blank"} about how to use Volumes and Persistent Volumes with Knative Services specially for your use case.
100100

101101
---
102102

103103
2. When should I use Knative Service, and what would be the best use case for it?
104104

105-
You can read more about the best use cases for Knative Service [here](https://knative.dev/docs/serving/samples/)!
105+
You can read more about the best use cases for Knative Service [here](https://knative.dev/docs/serving/samples/){:target="_blank"}!
106106

107107
## Conclusion
108108
By following this guide, you have successfully deployed a PostgreSQL server on a Kubernetes cluster, set up persistent storage, and initialized your database using a Kubernetes job. Congratulations! Your bookstore now has the database service.

code-samples/eventing/bookstore-sample-app/solution/frontend/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pnpm dev
1818
bun dev
1919
```
2020

21-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
21+
Open [http://localhost:3000](http://localhost:3000){:target="_blank"} with your browser to see the result.
2222

2323
# Project Structures
2424

@@ -33,7 +33,7 @@ This repository contains a Next.js application that utilizes next-themes and Tai
3333

3434
## Prerequisites
3535

36-
- Docker installed on your machine. You can download and install Docker from [here](https://www.docker.com/get-started).
36+
- Docker installed on your machine. You can download and install Docker from [here](https://www.docker.com/get-started){:target="_blank"}.
3737

3838
## Dockerization Steps
3939

code-samples/eventing/bookstore-sample-app/solution/node-server/config/100-event-display.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
apiVersion: apps/v1
32
kind: Deployment
43
metadata:

code-samples/eventing/bookstore-sample-app/solution/node-server/config/300-sinkbinding.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
selector:
1111
matchLabels:
1212
app: node-server
13-
sink: # In this case, the sink is our broker, which is the eventing service that will receive the events
13+
sink: # In this case, the sink is our Broker, which is the eventing service that will receive the events
1414
ref:
1515
apiVersion: eventing.knative.dev/v1
1616
kind: Broker

code-samples/eventing/bookstore-sample-app/solution/node-server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ app.post('/add', async (req, res) => {
9898
const brokerURI = process.env.K_SINK;
9999

100100
if (receivedEvent.type === 'new-review-comment') {
101-
// Forward the event to the broker with the necessary CloudEvent headers
101+
// Forward the event to the Broker with the necessary CloudEvent headers
102102
const response = await fetch(brokerURI, {
103103
method: 'POST',
104104
headers: {

code-samples/eventing/bookstore-sample-app/solution/sequence/config/100-create-sequence.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ spec:
1515
apiVersion: serving.knative.dev/v1
1616
kind: Service
1717
name: sentiment-analysis-app
18-
reply: # This is the last step of the sequence, it will send the event back to the broker as reply
18+
reply: # This is the last step of the sequence, it will send the event back to the Broker as reply
1919
ref:
2020
kind: Broker
2121
apiVersion: eventing.knative.dev/v1

code-samples/eventing/bookstore-sample-app/solution/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v
2121
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.14.0/eventing-core.yaml
2222
echo "Knative Eventing installed successfully."
2323

24-
# Install Knative imc broker
24+
# Install Knative imc Broker
2525
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.14.0/in-memory-channel.yaml
2626
kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.14.0/mt-channel-broker.yaml
27-
echo "Knative in-memory channel and broker installed successfully."
27+
echo "Knative in-memory Channel and Broker installed successfully."
2828

2929
# Detect whether the user has knative function "func" installed
3030
if ! command -v func &> /dev/null

code-samples/eventing/bookstore-sample-app/solution/slack-sink/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ When a CloudEvent with the type `new-review-comment` is sent to the Knative Even
1111
## Install prerequisites
1212

1313
### Prerequisite 1: Install Camel CLI
14-
Install the Camel K CLI (`kamel`) on your local machine. You can find the installation instructions [here](https://camel.apache.org/camel-k/2.2.x/cli/cli.html).
14+
Install the Camel K CLI (`kamel`) on your local machine. You can find the installation instructions [here](https://camel.apache.org/camel-k/2.2.x/cli/cli.html){:target="_blank"}.
1515

1616
**Troubleshot**: If after installation you run `kamel version` and you get an error message, you may need to add the `kamel` binary to your system's PATH. You can do this by moving the `kamel` binary to a directory that is already in your PATH, or by adding the directory where `kamel` is located to your PATH.
1717

@@ -29,7 +29,7 @@ $ kamel install --registry docker.io --organization <your-organization> --regist
2929

3030
Replace the placeholders with your actual Docker registry information.
3131

32-
If you are using other container registries, you may need to read more [here](https://camel.apache.org/camel-k/2.2.x/installation/registry/registry.html) for the installation.
32+
If you are using other container registries, you may need to read more [here](https://camel.apache.org/camel-k/2.2.x/installation/registry/registry.html){:target="_blank"} for the installation.
3333

3434
You will see this message if the installation is successful:
3535

@@ -43,19 +43,19 @@ Follow the instruction here on how to create the slack workspace and generate an
4343
## Implementation
4444
### Step 1: Create the Broker
4545

46-
This broker is created solely for testing purposes and is intended for temporary use during this part of the tutorial only.
46+
This Broker is created solely for testing purposes and is intended for temporary use during this part of the tutorial only.
4747

48-
**Method 1**: Initialize a broker within your Kubernetes cluster using the Knative CLI:
48+
**Method 1**: Initialize a Broker within your Kubernetes cluster using the Knative CLI:
4949

5050
```bash
5151
$ kn broker create book-review-broker
5252
```
53-
You will see this message if the broker is created successfully:
53+
You will see this message if the Broker is created successfully:
5454

5555
```
56-
Broker book-review-broker successfully created in namespace default.
56+
Broker 'book-review-broker' successfully created in namespace 'default'.
5757
```
58-
**Method 2**: You can create a new YAML file to create the broker:
58+
**Method 2**: You can create a new YAML file to create the Broker:
5959

6060
*new-knative-broker.yaml*
6161
```yaml
@@ -70,7 +70,7 @@ After you saved the file, you can apply the configuration to your Kubernetes clu
7070
```bash
7171
$ kubectl apply -f new-knative-broker.yaml
7272
```
73-
You will see this message if the broker is created successfully:
73+
You will see this message if the Broker is created successfully:
7474

7575
```
7676
broker.eventing.knative.dev/book-review-broker created
@@ -139,9 +139,9 @@ slack-sink-pipe Ready 1
139139

140140
To trigger notifications, you'll need to simulate an event that matches the criteria set in your Slack sink configuration. For example, submitting a book review could be an event of type `new-review-comment`.
141141

142-
Directly sending CloudEvents to a broker using curl from an external machine (like your local computer) is typically **constrained** due to the networking and security configurations of Kubernetes clusters.
142+
Directly sending CloudEvents to a Broker using curl from an external machine (like your local computer) is typically **constrained** due to the networking and security configurations of Kubernetes clusters.
143143

144-
Therefore, you need to create a new pod in your Kubernetes cluster to send a CloudEvent to the broker. You can use the following command to create a new pod:
144+
Therefore, you need to create a new pod in your Kubernetes cluster to send a CloudEvent to the Broker. You can use the following command to create a new pod:
145145

146146
```bash
147147
$ kubectl run curler --image=radial/busyboxplus:curl -it --restart=Never
@@ -154,9 +154,9 @@ If you don't see a command prompt, try pressing enter.
154154
```
155155

156156

157-
Using curl command to send a CloudEvent to the broker:
157+
Using curl command to send a CloudEvent to the Broker:
158158
```bash
159-
[root@curler:/]$ curl -v "<The URI to your broker>" \
159+
[root@curler:/]$ curl -v "<The URI to your Broker>" \
160160
-X POST \
161161
-H "Ce-Id: review1" \
162162
-H "Ce-Specversion: 1.0" \
@@ -166,7 +166,7 @@ Using curl command to send a CloudEvent to the broker:
166166
-d 'Hello from Knative!'
167167
```
168168

169-
You can find the URI to your broker by running the following command:
169+
You can find the URI to your Broker by running the following command:
170170

171171
```bash
172172
$ kubectl get broker book-review-broker

0 commit comments

Comments
 (0)