{"id":20484581,"url":"https://github.com/sap-samples/cap-sflight","last_synced_at":"2025-08-24T05:06:16.967Z","repository":{"id":36978968,"uuid":"359964170","full_name":"SAP-samples/cap-sflight","owner":"SAP-samples","description":"Using SAP Cloud Application Programming Model and SAP Fiori elements to build a simple travel management app, both with Node.js and Java.","archived":false,"fork":false,"pushed_at":"2025-07-31T12:21:03.000Z","size":15914,"stargazers_count":218,"open_issues_count":58,"forks_count":172,"subscribers_count":13,"default_branch":"main","last_synced_at":"2025-07-31T16:13:13.350Z","etag":null,"topics":["sample","sample-code","sap-cap","sap-fiori","sap-fiori-elements"],"latest_commit_sha":null,"homepage":"https://cap.cloud.sap","language":"CAP CDS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SAP-samples.png","metadata":{"files":{"readme":"README-Kyma.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-20T22:14:27.000Z","updated_at":"2025-07-31T12:21:06.000Z","dependencies_parsed_at":"2023-09-28T17:21:39.295Z","dependency_job_id":"a767c087-9cd9-4f10-b9b1-bcd6b4a2387e","html_url":"https://github.com/SAP-samples/cap-sflight","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/SAP-samples/cap-sflight","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fcap-sflight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fcap-sflight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fcap-sflight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fcap-sflight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SAP-samples","download_url":"https://codeload.github.com/SAP-samples/cap-sflight/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SAP-samples%2Fcap-sflight/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271795281,"owners_count":24822687,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-24T02:00:11.135Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sample","sample-code","sap-cap","sap-fiori","sap-fiori-elements"],"created_at":"2024-11-15T16:24:07.930Z","updated_at":"2025-08-24T05:06:16.954Z","avatar_url":"https://github.com/SAP-samples.png","language":"CAP CDS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deployment to SAP Business Technology Platform - Kyma Runtime\n\n- [Deployment to SAP Business Technology Platform - Kyma Runtime](#deployment-to-sap-business-technology-platform---kyma-runtime)\n  - [Preconditions](#preconditions)\n  - [Add Deployment Files](#add-deployment-files)\n  - [Configuration](#configuration)\n  - [Prepare Kubernetes Namespace](#prepare-kubernetes-namespace)\n    - [Create container registry secret](#create-container-registry-secret)\n    - [Create a secret for your HDI container](#create-a-secret-for-your-hdi-container)\n  - [Build - Node.js](#build---nodejs)\n  - [Build - Java](#build---java)\n  - [Build HTML5 application deployer image](#build-html5-application-deployer-image)\n  - [Push docker images](#push-docker-images)\n  - [Deployment](#deployment)\n  - [Access the UI](#access-the-ui)\n\n**TIP:** You can find more information in the [Deploy Your CAP Application on SAP BTP Kyma Runtime](https://developers.sap.com/mission.btp-deploy-cap-kyma.html) tutorial and in the [Deploy to Kyma/K8s](https://cap.cloud.sap/docs/guides/deployment/deploy-to-kyma) guide of the CAP documentation.\n\n## Preconditions\n\n- BTP Subaccount with Kyma Runtime\n- BTP Subaccount with Cloud Foundry Space\n- HANA Cloud instance available for your Cloud Foundry space\n- BTP Entitlements for: *HANA HDI Services \u0026 Container* plan *hdi-shared*, *Build Work Zone* plan *standard*\n- Container Registry\n- Command Line Tools: `kubectl`, `kubectl-oidc_login`, `pack`, `docker`, `helm`, `cf`\n- Logged into Kyma Runtime (with `kubectl` CLI), Cloud Foundry space (with `cf` CLI) and Container Registry (with `docker login`)\n- `@sap/cds-dk` \u003e= 6.6.0\n\n## Add Deployment Files\n\nCAP tooling provides your a Helm chart for deployment to Kyma.\n\nAdd the CAP Helm chart with the required features to this project:\n\n```bash\ncds add helm\ncds add html5-repo\n```\n\n## Prepare Kubernetes Namespace\n\n1. Export the kubeconfig.yaml\n\n    ```\n    set KUBECONFIG=~/.kube/cap-kyma-app-config\n    ```\n\n2. Setting the namespace\n\n    ```\n    kubectl config set-context --current --namespace=\u003c\u003cNAMESPACE\u003e\u003e\n    ```\n\n### Create container registry secret\n\nCreate a secret `container-registry` with credentials to access the container registry:\n\n```\nbash .github/deployment/kyma/scripts/create-container-registry-secret.sh\n```\n\nThe *Docker Server* is the full-qualified hostname of your container registry.\n\n### Create a secret for your HDI container\n\nThis step is only required if you're using a BTP Trial account. If you're using a production or a free tier account then you can create HDI Container from Kyma directly by adding a [mapping to your Kyma namespace in your HANA Cloud Instance](https://blogs.sap.com/2022/12/15/consuming-sap-hana-cloud-from-the-kyma-environment/) and skip this step.\n\n```\nbash .github/deployment/kyma/scripts/create-db-secret.sh sflight-db\n```\n\nIt will create a HDI container `sflight-db` instance on your currently targeted Cloud Foundry space and creates a secret `sflight-db` with the credentials in your current Kubernetes namespace.\n\nMake the following changes to your _`chart/values.yaml`_.\n\n```diff\nsrv:\n  bindings:\n    db:\n-     serviceInstanceName: hana\n+     fromSecret: sflight-db\n...\n\nhana-deployer:\n  bindings:\n    hana:\n-     serviceInstanceName: hana\n+     fromSecret: sflight-db\n\n...\n- hana:\n-   serviceOfferingName: hana\n-   servicePlanName: hdi-shared\n```\n\n## Configuration\n\nMake the following changes to your _`chart/values.yaml`_ file:\n\n1. Change value of `global.domain` key to your cluster domain.\n\n2. Replace `\u003cyour-container-registry\u003e` with your container registry.\n\n3. Set the value of `SAP_CLOUD_SERVICE` key.\n\n```diff\nhtml5-apps-deployer:\n  env:\n-    SAP_CLOUD_SERVICE: null\n+    SAP_CLOUD_SERVICE: sap.fe.cap.sflight\n```\n\n4. Add backend destinations required by HTML5 Apps Deployer.\n\n```diff\n-  backendDestinations: {}\n+  backendDestinations:\n+     sflight-srv:\n+       service: srv\n```\n\n5. Add your image registry secret created in [Create container registry secret](#create-container-registry-secret) step.\n\n```diff\nglobal:\n  domain: null\n-  imagePullSecret: {}\n+  imagePullSecret:\n+    name: container-registry\n```\n\n## Build - Node.js\n\nDo the following steps if you want to deploy the **Node.js** application.\n\nThe `CDS_ENV=node` env variable needs to be provided to build for Node.js. The application will be built for Java by default.\n\n```\nCDS_ENV=node cds build --production\n```\n**Build data base deployer image:**\n\n```bash\npack build $YOUR_CONTAINER_REGISTRY/sflight-hana-deployer \\\n     --path gen/db \\\n     --buildpack gcr.io/paketo-buildpacks/nodejs \\\n     --builder paketobuildpacks/builder-jammy-base \\\n     --env BP_NODE_RUN_SCRIPTS=\"\"\n```\n(Replace `$YOUR_CONTAINER_REGISTRY` with the full-qualified hostname of your container registry)\n\n**Build image for CAP service:**\n\n```bash\npack build $YOUR_CONTAINER_REGISTRY/sflight-srv \\\n     --path \"gen/srv\" \\\n     --buildpack gcr.io/paketo-buildpacks/nodejs \\\n     --builder paketobuildpacks/builder-jammy-base \\\n     --env BP_NODE_RUN_SCRIPTS=\"\"\n```\n\n## Build - Java\n\nDo the following steps if you want to deploy the **Java** application.\n\n**Build data base deployer image:**\n\n```bash\ncds build --production\n```\n\n```bash\npack build $YOUR_CONTAINER_REGISTRY/sflight-hana-deployer \\\n     --path gen/db \\\n     --buildpack gcr.io/paketo-buildpacks/nodejs \\\n     --builder paketobuildpacks/builder-jammy-base \\\n     --env BP_NODE_RUN_SCRIPTS=\"\"\n```\n\n(Replace `$YOUR_CONTAINER_REGISTRY` with the full-qualified hostname of your container registry)\n\n**Build image for CAP service:**\n\n```bash\nmvn package\n```\n\n```bash\npack build $YOUR_CONTAINER_REGISTRY/sflight-srv \\\n     --path srv/target/*-exec.jar \\\n     --buildpack gcr.io/paketo-buildpacks/sap-machine \\\n     --buildpack gcr.io/paketo-buildpacks/java \\\n     --builder paketobuildpacks/builder-jammy-base \\\n     --env SPRING_PROFILES_ACTIVE=cloud \\\n     --env BP_JVM_VERSION=17\n```\n\n## Build HTML5 application deployer image\n\n```\nbash .github/deployment/kyma/scripts/build-ui-image.sh\n```\n\n## Push docker images\n\nYou can push all the docker images to your docker registry, using:\n\n```bash\ndocker push $YOUR_CONTAINER_REGISTRY/sflight-hana-deployer\ndocker push $YOUR_CONTAINER_REGISTRY/sflight-srv\ndocker push $YOUR_CONTAINER_REGISTRY/sflight-html5-deployer\n```\n\n## Deployment\n\n```bash\nhelm install sflight ./chart --set-file xsuaa.jsonParameters=xs-security.json\n```\n\n## Access the UI\n\n1. Create Build Work Zone subscription in the BTP Cockpit\n2. Create a role collection `sflight`\n3. Add role `admin` of `sflight.tXYZ` application to role collection\n4. Add your user to the role collection\n5. Goto **HTML5 Applications**\n6. Start HTML5 application `sapfecaptravel`\n\nAdditionally, you can add the UI to a Build Work Zone site like it is described in in the last two steps of [this tutorial](https://developers.sap.com/tutorials/btp-app-kyma-launchpad-service.html#9aab2dd0-18ea-4ccd-bc44-24e87c845740).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsap-samples%2Fcap-sflight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsap-samples%2Fcap-sflight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsap-samples%2Fcap-sflight/lists"}