Skip to content

wikingwei/cap-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

This sample provides a CAP Service application that you can configure with any of the sample Order APIs.

This sample demonstrates how to:

  • Create a development Namespace in the Kyma runtime.
  • Configure and build an SAPUI5 Docker image.
  • Deploy the frontend in the Kyma runtime which includes:
    • A ConfigMap that contains the URL to the backend API.
    • A Deployment of the frontend image with the ConfigMap mounted to a volume.
    • A Service to expose the UI to other Kubernetes resources.
    • An API to expose the frontend externally.

Prerequisites

CAP Resources

CAP hints for SQLite on windows Troubleshooting guide for CAP.

Steps

Run the frontend locally

  1. Clone the project.

  2. Inside the directory, run:

npm install
  1. Install the CAP tools
npm i -g @sap/cds-dk
  1. Verify the CAP tools install by running
cds
  1. Deploy the DB schemas to you local sqlite database
cds deploy --to sqlite
  1. Run the app using the command
cds watch

The application loads at http://localhost:4004.

Build the Docker image

  1. 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

```

2. 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

Deploy the application

  1. Create a new dev Namespace:
kubectl create namespace dev
  1. Apply the Resources:
kubectl -n dev apply -f ./k8s/deployment.yaml
kubectl -n dev apply -f ./k8s/apirule.yaml
  1. Use the APIRule to open the application:
https://cap-service.{cluster-domain}

Examples with HANA DB

https://www.youtube.com/watch?v=kwKr4JbscvY

https://sap-samples.github.io/cloud-cap-risk-management/Kyma/#add-sap-hana-cloud