Skip to content

Commit c6afdb4

Browse files
committed
Applied review feedback
1 parent af91237 commit c6afdb4

2 files changed

Lines changed: 93 additions & 99 deletions

File tree

from-zero-to-cap-on-kyma/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ Using this sample, you start from scratch to deploy a [CAP](https://cap.cloud.sa
112112
```
113113

114114
3. Enable Istio injection for the namespace. Set the kubeconfig context to point to the namespace and create the Docker image pull Secret.
115+
116+
> Note: You will need a Docker API Key so that Kubernetes can pull the Docker images from your Docker account.
115117

116118
```shell
117119
make prepare-kyma-for-deployment

from-zero-to-cap-on-kyma/the-detailed-path.md

Lines changed: 91 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Overview
1+
# Detailed Path
22

33
Using this sample, you start from scratch to deploy a [CAP](https://cap.cloud.sap/docs/) NodeJS application on SAP BTP, Kyma runtime.
44

@@ -23,33 +23,33 @@ Using this sample, you start from scratch to deploy a [CAP](https://cap.cloud.sa
2323
- SAP Hana Cloud Instance
2424
- [SAP Hana Cloud Instance mapped to Kyma](https://blogs.sap.com/2022/12/15/consuming-sap-hana-cloud-from-the-kyma-environment/)
2525

26-
## CAP Application
26+
## Initializing CAP Application
2727

28-
1. Initialize the Cap Bookshop sample
28+
1. Initialize the CAP Bookshop sample
2929

30-
```shell
31-
make init
32-
```
30+
```shell
31+
make init
32+
```
3333

3434
The initialized application is a simple Bookshop sample where you can access Book entries using API calls.
3535
- Data model defined in [./bookshop/db/schema.cds](./bookshop/db/schema.cds). <!-- markdown-link-check-disable-line -->
3636
- CDS defined in [./bookshop/srv/cat-service.cds](./bookshop/srv/cat-service.cds). <!-- markdown-link-check-disable-line -->
3737

38-
> [!NOTE]
39-
> CAP promotes getting started with minimal upfront setup, based on convention over configuration, and a grow-as-you-go approach, adding settings and tools later on, only when you need them. For more information, see [Introduction to CAP](https://cap.cloud.sap/docs/about/).
38+
> [!NOTE]
39+
> CAP promotes getting started with minimal upfront setup, based on convention over configuration, and a grow-as-you-go approach, adding settings and tools later on, only when you need them. For more information, see [Introduction to CAP](https://cap.cloud.sap/docs/about/).
4040
4141
2. Run the application locally
4242

43-
```shell
44-
make run-local
45-
```
43+
```shell
44+
make run-local
45+
```
4646

4747
3. Access the CAP Srv at <http://localhost:4004>
4848
4. Terminate the local running app with `^C`
4949

5050
## Deploying to Kyma
5151

52-
### Add default route for App router
52+
### Adding the Default Route for Application Router
5353

5454
1. Update the [bookshop/app/router/xs-app.json](bookshop/app/router/xs-app.json) to add a default route for the app router. This is required to access the CAP application via the URL. The end json should look as below: <!-- markdown-link-check-disable-line -->
5555

@@ -67,14 +67,14 @@ Using this sample, you start from scratch to deploy a [CAP](https://cap.cloud.sa
6767
}
6868
```
6969

70-
> [!Note]
71-
> The standalone Application Router is used to simplify the setup and **is not a must**. It should be also possible to use the managed approuter because your CAP APIs are exposed via Fiori or UI5 applications and accessed using workzone.
70+
> [!Note]
71+
> The standalone Application Router is used to simplify the setup and **is not a must**. It should also be possible to use the managed approuter because your CAP APIs are exposed via Fiori or UI5 applications and accessed using workzone.
7272
73-
### Configure environment variables
73+
### Configuring Environment Variables
7474

75-
1. Set up the required environment variables:
75+
1. Set up the required environment variables.
7676

77-
- In shell
77+
- In shell
7878

7979
```shell
8080
export DOCKER_ACCOUNT=<your-docker-account>
@@ -83,7 +83,7 @@ Using this sample, you start from scratch to deploy a [CAP](https://cap.cloud.sa
8383
export CLUSTER_DOMAIN=$(kubectl get cm -n kube-system shoot-info -ojsonpath='{.data.domain}')
8484
```
8585

86-
- In Windows powershell
86+
- In Windows powershell
8787

8888
```powershell
8989
$ENV:DOCKER_ACCOUNT="<your-docker-account>"
@@ -98,74 +98,69 @@ Using this sample, you start from scratch to deploy a [CAP](https://cap.cloud.sa
9898
export DOCKER_HOST=unix://${HOME}/.docker/run/docker.sock
9999
```
100100

101-
### Prepare for deployment
101+
### Preparing for the Deployment
102102

103103
1. Do a basic check to see if the cluster is reachable. Running any of the basic commands such as `kubectl cluster-info` or `kubectl get pods` or `kubectl get namespaces` successfully should confirm that. If an error occurs, check your kubeconfig file and ensure that it is correctly set up to point to your Kyma cluster. Also, check if the cluster was provisioned successfully in the SAP BTP cockpit under your subaccount.
104104

105105
2. Create a namespace. You can skip this step if you already have a namespace. You can use any non-system namespace of your choice to deploy the sample application.
106106

107-
> [!Note]
108-
> The following are system namespaces:
109-
> - `kube-system`
110-
> - `istio-system`
111-
> - `kyma-system`
112-
> It is not recommended to deploy your applications in the system namespaces.
107+
> [!Note]
108+
> The following are system namespaces:
109+
> - `kube-system`
110+
> - `istio-system`
111+
> - `kyma-system`
112+
> It is not recommended to deploy your applications in the system namespaces.
113113

114114
```shell
115115
make create-namespace
116116
```
117117

118118
3. Enable Istio injection for the namespace. Set the kubeconfig context to point to the namespace and create the Docker image pull Secret.
119+
120+
> Note: You will need a Docker API Key so that Kubernetes can pull the Docker images from your Docker account.
119121

120122
```shell
121123
make prepare-kyma-for-deployment
122124
```
123125

124-
## Deploy to Kyma runtime
126+
### Building Docker Images
125127

126-
## Build Docker images
128+
On Kyma runtime, application run as Docker containers. They require a Docker image to be created out of the application code/binaries.
127129

128-
On Kyma runtime, application run as docker containers. They require a docker image to be created out of the application code / binaries.
130+
The Docker image can be stored in the Docker registry. It can be a private Docker registry where access is restricted with credentials.
129131

130-
The docker image can be stored on the docker registry. It can be a private docker registry where access is restricted with credentials.
132+
This sample uses a pack to build the Docker images.
131133

132-
We will use pack to build the docker images.
134+
1. Buid a Docker image and follow the logs.
133135

134-
- Checkout what is happening when building the docker image
135-
136-
```shell
137-
make build-hana-deployer --just-print
138-
```
136+
```shell
137+
make build-hana-deployer --just-print
138+
```
139139

140-
You will notice that `pack` intelligently identifies how to pack the source code and create the necessary artifacts. The same is also true for Java applications.
140+
The `pack` intelligently identifies how to pack the source code and create the necessary artifacts. The same is also true for Java applications.
141141

142-
- Build and push the Hana deployer image
142+
2. Build and push the Hana deployer image.
143143

144-
```shell
145-
make build-hana-deployer
146-
make push-hana-deployer
147-
```
144+
```shell
145+
make build-hana-deployer push-hana-deployer
146+
```
148147

149-
- Build and push the CAP Srv image
148+
3. Build and push the CAP Srv image.
150149

151-
```shell
152-
make build-cap-srv
153-
make push-cap-srv
154-
```
150+
```shell
151+
make build-cap-srv push-cap-srv
152+
```
155153

156-
- Build and push the Approuter image
154+
4. Build and push the Approuter image.
157155

158-
```shell
159-
make build-approuter
160-
make push-approuter
161-
```
156+
```shell
157+
make build-approuter push-approuter
158+
```
162159

163160
### Creating Helm Charts
164161

165162
Having the artifacts in place, focus to deploying the application.
166163

167-
First we need the configurations to tell Kyma what and how we want to deploy.
168-
169164
The sample uses [Helm charts](https://helm.sh/) to define the required configurations and then deploy them on the Kyma runtime.
170165

171166
`cds` can intelligently inspect what is defined in your CAP application and generate the necessary configurations (Helm charts) to deploy the application on Kyma runtime.
@@ -191,80 +186,77 @@ The sample uses [Helm charts](https://helm.sh/) to define the required configura
191186
make add-istio-destination-rule
192187
```
193188

194-
### Deploy helm chart
189+
### Deploying Helm Chart
195190

196-
1. Check the make command by running
191+
1. Check the `make` command by running:
197192

198-
```shell
199-
make deploy-dry-run --just-print
200-
```
193+
```shell
194+
make deploy-dry-run --just-print
195+
```
201196

202-
You will notice that we are overriding a various properties defined in `chart/values.yaml`. This is standard helm feature where you can override your values by specifying them in the command line. This obviates the need to modify the `values.yaml` file. Of course, you can also update the `values.yaml` directly.
197+
The command overrides various properties defined in `chart/values.yaml`. This is a standard Helm feature that you can override your values by specifying them in the command line. This obviates the need to modify the `values.yaml` file. Of course, you can also update the `values.yaml` directly.
203198

204199
2. Run the command to do a dry run
205200

206-
```shell
207-
make deploy-dry-run
208-
```
201+
```shell
202+
make deploy-dry-run
203+
```
209204

210-
Take some time to understand what all will be deployed and how does the configuration looks like.
211-
It is interesting to notice that all these deployment configurations are auto-generated via cds.
205+
Take some time to understand the deployment and what the configuration looks like. It is interesting to notice that all these deployment configurations are auto-generated using CDS.
212206

213-
**This ensures that you as a developer does not need work with the complexities of helm charts and configurations. At the same time, these pre-shipped charts follow the best practices when it comes to deploying on Kyma.**
207+
**This ensures that you as a developer don't have to work with the complexities of Helm charts and configurations. At the same time, these pre-shipped charts follow the best practices when it comes to deploying on Kyma.**
214208
215-
3. Build and deploy to Kyma runtime.
216-
217-
```shell
218-
make deploy
219-
```
209+
3. Build and deploy to the Kyma runtime.
220210
221-
### Verify your deployment
211+
```shell
212+
make deploy
213+
```
222214
223-
- Check the state of the application pods. **Wait until pods are in running state.**
215+
### Verifying the Deployment
224216
225-
```shell
226-
make check-status
227-
```
217+
1. Check the state of the application pods. **Wait until the pods are in running state.**
228218
229-
- Check the hana deployer logs
219+
```shell
220+
make check-status
221+
```
230222
231-
```shell
232-
make check-hana-deployer-logs
233-
```
223+
2. Check the hana deployer logs.
234224
235-
- Check the logs for the CAP application
225+
```shell
226+
make check-hana-deployer-logs
227+
```
236228
237-
```shell
238-
make check-cap-srv-logs
239-
```
229+
3. Check the CAP application logs.
240230
241-
- Check the logs for the Approuter
231+
```shell
232+
make check-cap-srv-logs
233+
```
242234
243-
```shell
244-
make check-approuter-logs
245-
```
235+
4. Check the Application Router logs.
246236
247-
- Access the application via the app router URL. It will be of the form <https://bookshop-approuter-${NAMESPACE}.${KYMA_CLUSTER_DOMAIN}>
237+
```shell
238+
make check-approuter-logs
239+
```
248240
249-
### Cleanup
241+
5. Access the application using the Application Router URL. It should be similar to this one: <https://bookshop-approuter-${NAMESPACE}.${KYMA_CLUSTER_DOMAIN}>.
250242
251-
- Delete the helm chart
243+
### Cleaning Up
252244
253-
```shell
254-
make undeploy
255-
```
245+
1. Delete the Helm chart. This command removes all the deployed applications, service instances, and their bindings.
256246
257-
This will delete the helm chart. Thereby all deployed applications, service instances and their bindings will be cleaned.
247+
```shell
248+
make undeploy
249+
```
258250
259-
- Remove the namespace and bookshop cap application folder
251+
2. Remove the namespace and the Bookshop CAP application folder.
260252
261-
```shell
262-
make cleanup
263-
```
253+
```shell
254+
make cleanup
255+
```
264256
265257
## CAP Version
266258
267-
Latest verified on following CAP version.
259+
The sample uses the following CAP versions.
268260
269261
| bookshop | "Add your repository here" |
270262
|------------------------|----------------------------|

0 commit comments

Comments
 (0)