You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/deploy-to-kyma/deploy-to-kyma.md
+316Lines changed: 316 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -252,6 +252,7 @@ Kyma runs on containers. Hence, for this tutorial, you'll need an application th
252
252
253
253
### Build images
254
254
255
+
[OPTION BEGIN [Node.js]]
255
256
>- Make sure you're logged in to your container registry.
256
257
>
257
258
>- If you're using any device with a non-x86 processor (e.g. MacBook M1/M2) you need to instruct Docker to use x86 images by setting the **DOCKER_DEFAULT_PLATFORM** environment variable using the command`export DOCKER_DEFAULT_PLATFORM=linux/amd64`. Check [Environment variables](https://docs.docker.com/engine/reference/commandline/cli/#environment-variables) for more info.
@@ -501,6 +502,264 @@ Kyma runs on containers. Hence, for this tutorial, you'll need an application th
501
502
502
503
> In case you're using Docker Hub as your container registry, replace the placeholder `<your-container-registry>` with your Docker Hub user ID.
503
504
505
+
[OPTION END]
506
+
[OPTION BEGIN [Java]]
507
+
508
+
>- Make sure you're logged in to your container registry.
509
+
>
510
+
>- If you're using any device with a non-x86 processor (e.g. MacBook M1/M2) you need to instruct Docker to use x86 images by setting the **DOCKER_DEFAULT_PLATFORM** environment variable using the command`export DOCKER_DEFAULT_PLATFORM=linux/amd64`. Check [Environment variables](https://docs.docker.com/engine/reference/commandline/cli/#environment-variables) for more info.
511
+
512
+
#### Build the CAP Java and the database image
513
+
514
+
1. In VS Code, choose **Terminal**→**New Terminal** and run the following command:
515
+
516
+
```bash
517
+
npm install
518
+
```
519
+
520
+
This will install required dependencies and update the **package-lock.json** file of your project.
521
+
522
+
2. Create the productive CAP build for your application:
523
+
524
+
```bash
525
+
cds build --profile production,java
526
+
```
527
+
528
+
3. Add configuration for the managed App Router:
529
+
530
+
```bash
531
+
cds add workzone
532
+
```
533
+
534
+
4. Add additional configuration for the XSUAA and HANA:
> Make sure to replace `<your-container-registry>` with your docker server URL and keep in mind that `<image version>` should be a string.
550
+
551
+
> Looking for your docker server URL?
552
+
553
+
> The docker server URL is the same as the path used fordocker login, so you can quickly check it by running the following commandin your terminal:
554
+
555
+
>```json
556
+
> cat ~/.docker/config.json
557
+
>```
558
+
559
+
> In case you're using Docker Hub as your container registry, replace the placeholder `<your-container-registry>` with your Docker Hub user ID.
560
+
561
+
> The pack CLI builds the image that contains the build result in the **gen/srv** folder and the required npm packages by using the [Cloud Native Buildpack for Node.JS](https://github.com/paketo-buildpacks/nodejs) provided by Paketo.
> Make sure to replace `<your-container-registry>` with the link to your container registry and keep in mind that `<image version>` should be a string.
574
+
575
+
> Looking for your docker server URL?
576
+
577
+
> The docker server URL is the same as the path used for docker login, so you can quickly check it by running the following command in your terminal:
578
+
579
+
> ```json
580
+
> cat ~/.docker/config.json
581
+
> ```
582
+
583
+
> In case you're using Docker Hub as your container registry, replace the placeholder `<your-container-registry>` with your Docker Hub user ID.
584
+
585
+
#### Prepare the UI deployer image configuration and build the image
586
+
587
+
1. In the VS Code terminal, navigate to the **app/incidents** folder and run the following command:
588
+
589
+
```bash
590
+
npm install && npm run build
591
+
```
592
+
593
+
3. Create a new file **xs-app.json**in**app/incidents/** and add the following code to it:
594
+
595
+
```json
596
+
{
597
+
"welcomeFile": "/index.html",
598
+
"authenticationMethod": "route",
599
+
"routes": [
600
+
{
601
+
"source": "^/odata/v4/processor/(.*)$",
602
+
"destination": "srv-api",
603
+
"authenticationType": "xsuaa"
604
+
},
605
+
{
606
+
"source": "^/resources/(.*)$",
607
+
"target": "/resources/$1",
608
+
"authenticationType": "none",
609
+
"destination": "ui5"
610
+
},
611
+
{
612
+
"source": "^/test-resources/(.*)$",
613
+
"target": "/test-resources/$1",
614
+
"authenticationType": "none",
615
+
"destination": "ui5"
616
+
},
617
+
{
618
+
"source": "^(.*)$",
619
+
"target": "$1",
620
+
"service": "html5-apps-repo-rt",
621
+
"authenticationType": "xsuaa"
622
+
}
623
+
]
624
+
}
625
+
```
626
+
627
+
> In case the **xs-app.json** already exists, replace its content with the snippet above.
628
+
629
+
4. Open **app/incidents/webapp/manifest.json** and remove the leading `/` from the `uri` parameter.
630
+
631
+
```json[10]
632
+
{
633
+
"_version": "1.49.0",
634
+
"sap.app": {
635
+
"id": "ns.incidents",
636
+
"type": "application",
637
+
"i18n": "i18n/i18n.properties",
638
+
...
639
+
"dataSources": {
640
+
"mainService": {
641
+
"uri": "odata/v4/ProcessorService/",
642
+
"type": "OData",
643
+
"settings": {
644
+
"annotations": [],
645
+
"localUri": "localService/metadata.xml",
646
+
"odataVersion": "4.0"
647
+
}
648
+
}
649
+
},
650
+
...
651
+
},
652
+
...
653
+
}
654
+
```
655
+
656
+
This is needed as the dataSource URIs must be relative to the base URL, which means there is no need for a slash as the first character.
657
+
658
+
Check [Accessing Business Service UI](https://help.sap.com/docs/btp/sap-business-technology-platform/accessing-business-service-ui?locale=39723061bc4b4b679726b120cbefdf5a.html&q=base%20URL) for more information.
659
+
660
+
5. Add navigation configuration and deploy configuration to the **app/incidents/webapp/manifest.json** file:
661
+
662
+
```json[9-22,25-28]
663
+
{
664
+
"_version": "1.49.0",
665
+
"sap.app": {
666
+
"id": "ns.incidents",
667
+
...
668
+
"dataSources": {
669
+
...
670
+
},
671
+
"crossNavigation": {
672
+
"inbounds": {
673
+
"incidents-display": {
674
+
"semanticObject": "incidents",
675
+
"action": "display",
676
+
"title": "{{flpTitle}}",
677
+
"subTitle": "{{flpSubtitle}}",
678
+
"signature": {
679
+
"parameters": {},
680
+
"additionalParameters": "allowed"
681
+
}
682
+
}
683
+
}
684
+
}
685
+
},
686
+
...
687
+
"sap.cloud": {
688
+
"public": true,
689
+
"service": "incidents"
690
+
}
691
+
}
692
+
```
693
+
694
+
6. Create a new folder **ui-resources**in your project's root folder.
695
+
696
+
The HTML5 applications deployer looks for the **ui-resources** folder which has the static files of the HTML5 application.
697
+
698
+
7. Create a new file **package.json** inside the **ui-resources** folder and add the following code to the file:
> Make sure to replace `<your-container-registry>` with the link to your container registry and keep in mind that `<image version>` should be a string.
751
+
752
+
> Looking for your docker server URL?
753
+
754
+
> The docker server URL is the same as the path used for docker login, so you can quickly check it by running the following command in your terminal:
755
+
756
+
> ```json
757
+
> cat ~/.docker/config.json
758
+
> ```
759
+
760
+
> In case you're using Docker Hub as your container registry, replace the placeholder `<your-container-registry>` with your Docker Hub user ID.
761
+
[OPTION END]
762
+
504
763
### Add Helm chart
505
764
506
765
CAP provides a configurable Helm chart for Node.js applications.
@@ -609,6 +868,7 @@ CAP provides a configurable Helm chart for Node.js applications.
609
868
610
869
### Deploy CAP Helm chart
611
870
871
+
[OPTION BEGIN [Node.js]]
612
872
1. Update the productive CAP build for your application:
613
873
614
874
```bash
@@ -660,3 +920,59 @@ CAP provides a configurable Helm chart for Node.js applications.
In the next tutorial, you will access your UIs from SAP Build Work Zone, standard edition. The SAP Build Work Zone, standard edition will trigger the authentication flow to provide the required token to access the service.
923
+
924
+
[OPTION END]
925
+
[OPTION BEGIN [Java]]
926
+
927
+
1. Update the productive CAP build for your application:
928
+
929
+
```bash
930
+
cds build --profile production,java
931
+
```
932
+
933
+
2. Run the following command to create a namespace:
3. Make sure your SAP HANA Cloud instance is running. Free tier HANA instances are stopped overnight.
941
+
942
+
> Your SAP HANA Cloud service instance will be automatically stopped overnight, according to the server region time zone. That means you need to restart your instance every day before you start working with it.
943
+
>
944
+
> You can either use SAP BTP cockpit or the terminal in the SAP Business Application Studio to restart the stopped instance:
In the next tutorial, you will access your UIs from SAP Build Work Zone, standard edition. The SAP Build Work Zone, standard edition will trigger the authentication flow to provide the required token to access the service.
0 commit comments