This sample provides a CAP Service application service.
This sample demonstrates how to:
- Create a development Namespace in the Kyma runtime.
- Configure and build an CAP Service Docker image.
- Deploy the CAP Service in the Kyma runtime which includes:
- A Deployment of the CAP Service.
- An API to expose the service externally.
- SAP BTP, Kyma runtime instance
- Docker
- Docker Hub Account
- Node.js
- kubectl configured to use the
KUBECONFIG
file downloaded from the Kyma runtime.
-
Clone the project.
-
Inside the directory, run:
npm install
-
Install the CAP tools
npm i -g @sap/cds-dk
-
Verify the CAP tools install by running
cds
-
Deploy the DB schemas to you local
sqlite
databasecds deploy --to sqlite
-
Run the app using the command
cds watch
The application loads at http://localhost:4004
.
-
Build and push the image to your Docker repository:
docker build -t <your-docker-id>/cap-service -f docker/Dockerfile . docker push {your-docker-account}/cap-service
-
To run the image locally, adjust the value of the API_URL parameter in the
webapp/config.js
file and mount it into the image:docker run -p 4004:4004 <dockerid>/cap-service:latest --name cap-service
-
Create a new
dev
Namespace:kubectl create namespace dev
-
Apply the Resources:
kubectl -n dev apply -f ./k8s/deployment.yaml kubectl -n dev apply -f ./k8s/apirule.yaml
-
Use the APIRule to open the application:
https://cap-service.{cluster-domain}