### Project Setup and Execution Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/http-client-examples/README.md Commands to install project dependencies and run the example tests, which demonstrate the HTTP Client functionality. These commands are executed via npm. ```bash npm ci ``` ```bash npm run test ``` -------------------------------- ### Install Dependencies Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/k8s-sample-application/README.md Installs all project dependencies, including triggering the postinstall script which generates oData clients. ```shell npm i ``` -------------------------------- ### Install Node.js Dependencies Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cds-sample-application/README.md Installs all project dependencies using npm. This step is crucial before running build or start commands, and it also triggers the oData client generation. ```bash npm i ``` -------------------------------- ### Install Dependencies Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/application/README.md Installs all project dependencies defined in the package.json file. This command also triggers the 'postinstall' script, which includes generating oData clients. ```shell npm i ``` -------------------------------- ### Install Helm Chart Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/helm-chart/README.md Command to install the Helm chart for the sample application. It requires specifying the chart archive and a values file. ```shell helm install e2e-app k8s-e2e-app-helm-.tgz --values `/path/to/values.yaml` ``` -------------------------------- ### Generate oData Client Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/resilience-examples/README.md Generates the oData client from EDMX service definitions. This command is executed automatically in the `postinstall` script after running `npm i`. ```shell npm run generate-client ``` -------------------------------- ### Install Helm Chart Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/application/README.md Installs the application using a Helm chart after configuring the values.yaml file. This command deploys the application to the Kubernetes cluster. ```helm helm install e2e-app k8s-e2e-app-helm-0.1.5.tgz --values values.yaml ``` -------------------------------- ### Cypress Environment Configuration Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cf-sample-application/README.md Example configuration file for Cypress end-to-end tests. This file, named `cypress.env.json`, should be placed in the `/e2e-tests` directory and contains credentials for the Identity Provider (IdP). ```json { "username": "username", "password": "password" "url": "url" } ``` -------------------------------- ### Generate oData Client Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cf-sample-application/README.md Command to generate oData clients for SAP services. This command is typically executed automatically as part of the `postinstall` script after running `npm install`. ```bash npm run generate-client ``` -------------------------------- ### Install Helm Chart with Overrides Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/helm-chart/README.md Command to install the Helm chart, overriding default values using the `--set` flag for specific configurations like environment and approuter patterns. ```shell helm install e2e-app k8s-e2e-app-helm-.tgz --values `/path/to/values.yaml` --set expose.environment=kyma --set approuter-chart.config.pattern="." ``` -------------------------------- ### Generate oData Client Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/k8s-sample-application/README.md Executes the script to generate oData clients for Business Partner services (on-premise and cloud) using the EDMX definitions. This is typically run automatically during the npm install process. ```shell npm run generate-client ``` -------------------------------- ### Run Application Locally Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cds-sample-application/README.md Starts the CAP application locally after deploying the CDS models. This command is used for local development and testing. ```bash npm run cds-deploy && npm run start:dev ``` -------------------------------- ### Generate oData Client Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/application/README.md Command to generate oData clients for SAP services. This process is typically executed automatically during the 'npm install' phase via the 'postinstall' script in package.json. ```shell npm run generate-client ``` -------------------------------- ### Kubernetes Port Forwarding Setup Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/helm-chart/k8s-e2e-app-helm/charts/approuter-chart/templates/NOTES.txt This script automates the process of connecting to a Kubernetes pod for local development or debugging. It identifies a specific pod based on application labels, retrieves its container port, and then forwards a local port (8080) to that container port, enabling direct access to the application. ```shell export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include \"approuter-chart.name\" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT ``` -------------------------------- ### Deploy Application to SAP BTP Cloud Foundry Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cf-sample-application/README.md Command to deploy both the application and the approuter to SAP BTP Cloud Foundry. This command should be executed from the root directory and the `approuter` directory respectively, after configuring placeholders and the `xs-app.json` file. ```bash npm run deploy ``` -------------------------------- ### Deploy Application to SAP BTP Cloud Foundry Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cf-multi-tenant-application/README.md Deploys the multi-tenant application to SAP BTP Cloud Foundry. This command assumes that the necessary service instances (destination, xsuaa) have been created and configured. ```shell cf push ``` -------------------------------- ### Deploy Application via Pipeline Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/k8s-sample-application/README.md Executes the CI/CD pipeline to build, package, and deploy the application. Requires configuration updates in package.json for the pipeline script. ```shell npm run deploy:pipeline ``` -------------------------------- ### Clone SAP Cloud SDK JS Multi-Tenant Sample Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cf-multi-tenant-application/README.md Clones the SAP Cloud SDK for JavaScript multi-tenant sample application from GitHub using git sparse-checkout. This command fetches only the necessary files for the multi-tenant application sample. ```shell git clone \ --depth 1 \ --filter=blob:none \ --sparse \ https://github.com/SAP-samples/cloud-sdk-js.git \ ; cd cloud-sdk-js git sparse-checkout set samples/cf-multi-tenant-application ``` -------------------------------- ### Deploy Application to Docker Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/k8s-sample-application/README.md Builds and pushes Docker images for the application and approuter to a specified Docker repository. Requires configuration updates in package.json. ```shell npm run deploy:docker ``` -------------------------------- ### Clone SAP Cloud SDK JS Kubernetes Sample Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/k8s-sample-application/README.md Command to clone the specific Kubernetes sample application from the SAP samples repository using sparse checkout for efficiency. ```shell git clone \ --depth 1 \ --filter=blob:none \ --sparse \ https://github.com/SAP-samples/cloud-sdk-js.git \ ; cd cloud-sdk-js git sparse-checkout set samples/k8s-sample-application ``` -------------------------------- ### Deploy to Kubernetes Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/k8s-sample-application/README.md Applies Kubernetes configuration files to deploy the application, approuter, and related services to a Kubernetes cluster. Requires prior configuration of deployment.yml and ingress.yml. ```shell kubectl apply -f ``` -------------------------------- ### Generate oData Client with npm Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cds-sample-application/README.md Generates the oData client for the Business Partner service. This command is typically executed automatically in the postinstall step after running 'npm i'. ```bash npm run generate-client ``` -------------------------------- ### SAP BTP Cloud Foundry Service Instances Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cf-sample-application/README.md Required service instance names for deploying the application to SAP BTP Cloud Foundry. These names must match the entries specified in the `manifest.yml` file for the application to connect correctly. ```yaml - sample-destination-service - sample-xsuaa-service - sample-connectivity-service ``` -------------------------------- ### Clone SAP Cloud SDK JS Kubernetes App Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/README.md Clones the SAP Cloud SDK for JavaScript Kubernetes End-to-End Application repository using Git. It utilizes sparse checkout to fetch only the necessary sample application directory, optimizing download size and time. This command is essential for obtaining the project's code. ```bash git clone \ --depth 1 \ --filter=blob:none \ --sparse \ https://github.com/SAP-samples/cloud-sdk-js.git \ ; cd cloud-sdk-js git sparse-checkout set samples/helm-sample-application ``` -------------------------------- ### Clone SAP Cloud SDK JS Sample Application Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cf-sample-application/README.md Command to clone the SAP Cloud SDK for JavaScript Cloud Foundry sample application repository using sparse checkout for efficiency. It filters to only download the specified sample application. ```bash git clone \ --depth 1 \ --filter=blob:none \ --sparse \ https://github.com/SAP-samples/cloud-sdk-js.git \ ; cd cloud-sdk-js git sparse-checkout set samples/cf-sample-application ``` -------------------------------- ### Clone SAP Cloud SDK JS Repository Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cds-sample-application/README.md Downloads the SAP Cloud SDK for JavaScript repository using git clone with specific options for a clean checkout. This command ensures only the necessary files are fetched. ```bash git clone \ --depth 1 \ --filter=blob:none \ --sparse \ https://github.com/SAP-samples/cloud-sdk-js.git \ ; cd cloud-sdk-js git sparse-checkout set samples/cds-sample-application ``` -------------------------------- ### Deploy Docker Images Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/application/README.md Scripts to build and deploy Docker images for the application. Requires prior configuration of Docker repository details in package.json scripts. ```shell npm run deploy:docker npm run deploy:pipeline ``` -------------------------------- ### Cypress Environment Configuration Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/k8s-sample-application/README.md Defines the structure for the cypress.env.json file, used to store credentials for local end-to-end test execution. ```json { "username": "username", "password": "password", "url": "url" } ``` -------------------------------- ### Deploy Services to Kubernetes Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/application/README.md Applies Kubernetes YAML files to deploy necessary services like connectivity, xsuaa, and destination. This is a prerequisite for deploying the main application. ```shell kubectl apply -f sap-btp-operator/services ``` -------------------------------- ### Ingress Routing Configuration Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/helm-chart/README.md Configures how the application is exposed via ingress, including short routes for Letsencrypt compatibility and the main exposed route. ```APIDOC Configuration Parameters for Ingress Exposure: - expose.ingress.shortRoute: string Description: Specifies a shorter route if the primary exposed route exceeds 64 characters. This is necessary for Letsencrypt to function correctly. The shortest available route is typically the DNS, provided it's exposable. Example: If your DNS is 'my-app.example.com', this might be set to 'my-app'. Notes: Required if `expose.ingress.exposedRoute` is longer than 64 characters and Letsencrypt is used. - expose.ingress.exposedRoute: string Description: The primary route that will point to your application's Approuter. Example: 'my-app.example.com' - expose.ingress.connectivityProxyRoute: string Description: Configures the route for the connectivity proxy, particularly if it requires valid TLS. Example: 'proxy.my-app.example.com' Notes: Only needed if the connectivity proxy doesn't have valid TLS yet. - expose.ingress.secretName: string Description: The name of the Kubernetes secret that will store all TLS certificates for ingress. Default: `tls-secret` Example: `my-tls-certs` ``` -------------------------------- ### Clone SAP Cloud SDK JS Repository Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/application/README.md Command to clone the SAP Cloud SDK for JavaScript repository with specific optimizations for sparse checkout, ensuring only necessary files are downloaded. ```shell git clone \ --depth 1 \ --filter=blob:none \ --sparse \ https://github.com/SAP-samples/cloud-sdk-js.git \ ; cd cloud-sdk-js git sparse-checkout set samples/helm-sample-application ``` -------------------------------- ### Deploy and Access SAP Cloud SDK App via Kubernetes Port-Forward Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/helm-chart/k8s-e2e-app-helm/charts/app-chart/templates/NOTES.txt This script retrieves the name of a Kubernetes pod associated with an SAP Cloud SDK application and its container port. It then sets up a port-forwarding connection from your local machine to the application running inside the pod, allowing you to access it via http://127.0.0.1:8080. This process requires kubectl and a running Kubernetes cluster. ```shell export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include \"app-chart.name\" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT ``` -------------------------------- ### Service Endpoint for Multi-tenant App Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cf-multi-tenant-application/multi-tenant-app/src/index.html This entry documents the primary service endpoint used to trigger the sample logic within the multi-tenant application. It outlines the basic structure of the service call. ```APIDOC Service Endpoint: /service Description: Triggers the sample logic for the multi-tenant application. Method: GET or POST (depending on implementation) Parameters: None explicitly defined in this description. Returns: Varies based on the sample logic execution. Usage Example: GET /service POST /service Related Endpoints: No related endpoints are specified in the provided text. ``` -------------------------------- ### Deploy Application to SAP BTP Cloud Foundry Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/cds-sample-application/README.md Deploys the CAP application to SAP BTP Cloud Foundry. This command orchestrates transpilation, packaging, and the final 'cf push' operation. ```bash npm run deploy ``` -------------------------------- ### Letsencrypt Issuer Configuration Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/helm-chart/README.md Defines settings for the Letsencrypt issuer, including its name, contact email, and the secret for its private key. ```APIDOC Configuration Parameters for Letsencrypt Issuer: - expose.ingress.issuer.name: string Description: The name of the Letsencrypt issuer to use. If not specified, a default Letsencrypt issuer will be created. Default: A Letsencrypt issuer will be created automatically. Example: `letsencrypt-prod` - expose.ingress.issuer.email: string Description: The email address to register with Letsencrypt. This is only required if `expose.ingress.issuer.name` is not provided. Example: `admin@example.com` - expose.ingress.issuer.privateKeySecretRef: string Description: The name of the Kubernetes secret that will contain the private key for the Letsencrypt issuer. Default: `tls-private-key` Example: `my-letsencrypt-key` ``` -------------------------------- ### Helm Chart Configuration Parameters Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/helm-chart/README.md A comprehensive list of configurable parameters for the Helm chart, detailing their purpose, requirement status, and default values. These parameters control aspects of both the approuter and the main application deployment. ```APIDOC Helm Chart Configuration Parameters: This section details the configurable values for the SAP Cloud SDK JS sample application's Helm chart. Parameters can be set in `values.yaml` or via `--set` flags during `helm install`. **Approuter Chart Parameters:** - `approuter-chart.name` (optional): Name of the chart and all its CRDs. Default: `approuter-chart`. - `approuter-chart.imagePullSecrets.name` (required): Name of the secret to pull the approuter image. - `approuter-chart.image.repository` (optional): Name of the Docker image to use for the approuter. Default: `docker-cloudsdk.common.repositories.cloud.sap/k8s-approuter`. - `approuter-chart.image.tag` (optional): Tag of the approuter image. Default: `latest`. - `approuter-chart.config.json` (optional): Entire approuter configuration in JSON format. Cannot be used with `config.idp`. Served under `/backend-app/`. - `approuter-chart.config.idp` (required if `config.json` not provided): Name of the Identity Provider to use. - `approuter-chart.config.pattern` (required): The `TENANT_HOST_PATTERN` for multi-tenancy. - `approuter-chart.resources.requests.memory` (optional, but required if any resource param is given): Memory request for approuter. Default: `256Mi`. - `approuter-chart.resources.requests.cpu` (optional, but required if any resource param is given): CPU request for approuter. Default: `500m`. - `approuter-chart.resources.limits.memory` (optional, but required if any resource param is given): Memory limit for approuter. Default: `512Mi`. - `approuter-chart.resources.limits.cpu` (optional, but required if any resource param is given): CPU limit for approuter. Default: `1000m`. - `approuter-chart.serviceAccount.name` (optional): Service account for the approuter deployment. Default: `default`. - `approuter-chart.xsuaaBinding` (required): Name of the secret containing the XSUAA service binding. **App Chart Parameters:** - `app-chart.name` (optional): Name of the chart and all its CRDs. Default: `app-chart`. - `app-chart.imagePullSecrets.name` (required): Name of the secret to pull the application image. - `app-chart.image.repository` (optional): Name of the Docker image to use for the application. Default: `docker-cloudsdk.common.repositories.cloud.sap/k8s-e2e-app`. - `app-chart.image.tag` (optional): Tag of the application image. Default: `latest`. - `app-chart.resources.requests.memory` (optional, but required if any resource param is given): Memory request for the application. Default: `256Mi`. - `app-chart.resources.requests.cpu` (optional, but required if any resource param is given): CPU request for the application. Default: `500m`. - `app-chart.resources.limits.memory` (optional, but required if any resource param is given): Memory limit for the application. Default: `512Mi`. - `app-chart.resources.limits.cpu` (optional, but required if any resource param is given): CPU limit for the application. Default: `1000m`. - `app-chart.serviceAccount.name` (optional): Service account for the application deployment. Default: `default`. - `app-chart.xsuaaBinding` (required): Name of the secret containing the XSUAA service binding. - `app-chart.connectivityBinding` (required): Name of the secret containing the connectivity service binding. - `app-chart.destinationBinding` (required): Name of the secret containing the destination service binding. - `app-chart.cloudDestination` (required): Name of a cloud destination. - `app-chart.onPremiseDestination` (required): Name of an on-premise destination. - `app-chart.principalPropagationDestination` (required): Name of a principal propagation destination. **Global Parameters:** - `global.serviceAccountName` (optional): ServiceAccount used for all CRDs of the chart. Default: `default`. **Expose Parameters:** - `expose.enabled` (required): Whether to enable an ingress/api-rule (true/false). - `expose.name` (optional): Name of the charts CRDs. Default: `k8s-e2e-app-helm`. - `expose.environment` (required): Kind of environment (`gardener`, `kyma`, or `generic`). If `generic`, `expose.ingress.issuer` must be specified. - `expose.ingress.issuer` (required if `expose.environment` is `generic`): The issuer for the ingress. **Resource Parameter Grouping:** For both `approuter-chart.resources` and `app-chart.resources`, if any resource parameter (memory or cpu, request or limit) is provided, all four parameters must be specified. ``` -------------------------------- ### Local Cypress Test Configuration Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/application/README.md Defines the structure for the cypress.env.json file used to store credentials for local end-to-end tests. This file is essential for connecting to the Identity Provider (IdP). ```json { "username": "username", "password": "password", "url": "url" } ``` -------------------------------- ### Kubernetes Port Forwarding Commands Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/helm-chart/k8s-e2e-app-helm/templates/NOTES.txt Commands to establish a port-forwarding connection to a Kubernetes pod. This involves identifying the pod name, its container port, and then using `kubectl port-forward` to map a local port to the container port. ```APIDOC APIDOC: Kubernetes Port Forwarding: Description: Commands to connect to your application from within the cluster using port-forwarding. Steps: 1. Get the POD_NAME for the application router pod. 2. Get the CONTAINER_PORT for the application's container. 3. Use kubectl port-forward to map a local port (e.g., 8080) to the container port. Commands: export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name=approuter-chart,app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT Parameters: {{ .Release.Namespace }}: The Kubernetes namespace where the application is deployed. {{ .Release.Name }}: The release name of the application. Output: Establishes a connection to http://127.0.0.1:8080 on the local machine, forwarding traffic to the application's container port. ``` -------------------------------- ### API Gateway Rule Configuration Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/helm-chart/README.md Specifies the hostname for the API Gateway, which is crucial for routing external API requests to the correct service. ```APIDOC Configuration Parameters for API Rule: - expose.api-rule.host: string Description: The hostname that the API Gateway will use to route external API requests to your application. This is a mandatory setting when the environment is set to 'kyma'. Example: `e2e-app-myapp.kyma.example.com` Notes: Required if `expose.environment` is set to `kyma`. ``` -------------------------------- ### Helm Chart Ingress Routes Source: https://github.com/sap-samples/cloud-sdk-js/blob/main/samples/helm-sample-application/helm-chart/k8s-e2e-app-helm/templates/NOTES.txt Defines conditional ingress routes within a Helm chart based on exposed ingress configurations. It checks for enabled expose settings and specific route values like shortRoute, exposedRoute, and connectivityProxyRoute. ```helm {{- if .Values.expose.enabled }} {{- if .Values.expose.ingress.shortRoute }} - https://{{ .Values.expose.ingress.shortRoute }} {{- end }} {{- if .Values.expose.ingress.exposedRoute }} - https://{{ .Values.expose.ingress.exposedRoute }} {{- end }} {{- if .Values.expose.ingress.connectivityProxyRoute }} - https://{{ .Values.expose.ingress.connectivityProxyRoute }} {{- end }} {{- end }} ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.