Skip to content

Commit

Permalink
Merge pull request #55 from SAP-samples/update-november-2023
Browse files Browse the repository at this point in the history
Update november 2023
  • Loading branch information
AlexRieder committed Nov 16, 2023
2 parents 068de18 + b1ea53f commit f08d787
Show file tree
Hide file tree
Showing 81 changed files with 147 additions and 117 deletions.
2 changes: 1 addition & 1 deletion code/easyfranchise/deployment/docker/Dockerfile-approuter
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14
FROM --platform=linux/amd64 node:20

WORKDIR /app

Expand Down
4 changes: 2 additions & 2 deletions code/easyfranchise/deployment/docker/Dockerfile-bp-service
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM maven:3-openjdk-17-slim as BUILDER
FROM --platform=linux/amd64 maven:3-openjdk-17-slim as BUILDER
WORKDIR /opt/app
COPY code/easyfranchise/source/backend/bp-service/pom.xml bp-service/pom.xml
COPY code/easyfranchise/source/backend/db-service/pom.xml db-service/pom.xml
Expand All @@ -12,7 +12,7 @@ COPY code/easyfranchise/source/backend/db-service/src /opt/app/db-service/src
RUN mvn clean install -DskipTests=true

# At this point, BUILDER stage should have your .jar or whatever in some path
FROM sapmachine:16 as production-stage
FROM --platform=linux/amd64 sapmachine:latest as production-stage
LABEL maintainer="alexander.rieder@sap.com"
WORKDIR /opt/app
COPY --from=BUILDER /opt/app/bp-service/target/bp-service.jar /opt/app/bp-service.jar
Expand Down
2 changes: 1 addition & 1 deletion code/easyfranchise/deployment/docker/Dockerfile-broker
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14
FROM --platform=linux/amd64 node:14

EXPOSE 3002

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:latest
FROM --platform=linux/amd64 node:latest

EXPOSE 8081

Expand Down
4 changes: 2 additions & 2 deletions code/easyfranchise/deployment/docker/Dockerfile-db-service
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM maven:3-openjdk-17-slim as BUILDER
FROM --platform=linux/amd64 maven:3-openjdk-17-slim as BUILDER
WORKDIR /opt/app
COPY code/easyfranchise/source/backend/bp-service/pom.xml bp-service/pom.xml
COPY code/easyfranchise/source/backend/db-service/pom.xml db-service/pom.xml
Expand All @@ -11,7 +11,7 @@ COPY code/easyfranchise/source/backend/ef-service/src /opt/app/ef-service/src
COPY code/easyfranchise/source/backend/db-service/src /opt/app/db-service/src
RUN mvn clean install -DskipTests=true

FROM sapmachine:16 as production-stage
FROM --platform=linux/amd64 sapmachine:latest as production-stage
LABEL maintainer="alexander.rieder@sap.com"
WORKDIR /opt/app
COPY --from=BUILDER /opt/app/db-service/target/db-service.jar /opt/app/db-service.jar
Expand Down
4 changes: 2 additions & 2 deletions code/easyfranchise/deployment/docker/Dockerfile-ef-service
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM maven:3-openjdk-17-slim as BUILDER
FROM --platform=linux/amd64 maven:3-openjdk-17-slim as BUILDER
WORKDIR /opt/app
COPY code/easyfranchise/source/backend/bp-service/pom.xml bp-service/pom.xml
COPY code/easyfranchise/source/backend/db-service/pom.xml db-service/pom.xml
Expand All @@ -11,7 +11,7 @@ COPY code/easyfranchise/source/backend/ef-service/src /opt/app/ef-service/src
COPY code/easyfranchise/source/backend/db-service/src /opt/app/db-service/src
RUN mvn clean install -DskipTests=true

FROM sapmachine:16 as production-stage
FROM --platform=linux/amd64 sapmachine:latest as production-stage
LABEL maintainer="alexander.rieder@sap.com"
WORKDIR /opt/app
COPY --from=BUILDER /opt/app/ef-service/target/ef-service.jar /opt/app/ef-service.jar
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:latest
FROM --platform=linux/amd64 node:latest

EXPOSE 3002

Expand Down
4 changes: 2 additions & 2 deletions code/easyfranchise/deployment/docker/Dockerfile-ui
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# build stage
FROM node:14-alpine as build-stage
FROM --platform=linux/amd64 node:14-alpine as build-stage
WORKDIR /app
COPY code/easyfranchise/source/ui/package*.json ./
RUN npm install
COPY code/easyfranchise/source/ui/. .
RUN npm run build

# production stage
FROM nginx:stable-alpine as production-stage
FROM --platform=linux/amd64 nginx:stable-alpine as production-stage
COPY --from=build-stage /app/resources /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion code/easyfranchise/deployment/k8s/bp-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
imagePullSecrets:
- name: registry-secret
containers:
- image: <image-name>
- image: <image-name> # use your own image
name: bp-service
imagePullPolicy: Always
resources: {}
Expand Down
2 changes: 1 addition & 1 deletion code/easyfranchise/deployment/k8s/broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
imagePullSecrets:
- name: registry-secret # replace with your own registry secret
containers:
- image: <image-name> #cp-enablement.docker.repositories.sap.ondemand.com/easyfranchise/broker # use your own image
- image: <image-name> # use your own image
name: broker
imagePullPolicy: Always
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
imagePullSecrets:
- name: registry-secret # replace with your own registry secret
containers:
- image: <image-name> # e.g. cp-enablement.docker.repositories.sap.ondemand.com/com.sap.easyfranchise/s4hanamock:<version>
- image: <image-name> # use your own image
name: business-partner-mock
imagePullPolicy: Always
ports:
Expand Down
6 changes: 3 additions & 3 deletions code/easyfranchise/source/approuter/approuter-start.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const jwt_decode = require('jwt-decode');
const approuter = require('@sap/approuter');
const xssec = require('@sap/xssec');
const xsenv = require('@sap/xsenv');
const { jwtDecode } = require('jwt-decode');

var ar = approuter();
ar.beforeRequestHandler.use('/backend', function (req, res, next) {
Expand All @@ -10,7 +10,7 @@ ar.beforeRequestHandler.use('/backend', function (req, res, next) {
res.statusCode = 403;
res.end("Missing JWT Token");
} else {
const decodedToken = jwt_decode(token);
const decodedToken = jwtDecode(token);
const tenant = decodedToken && decodedToken.zid;
req.headers['x-tenant-id'] = tenant;
next();
Expand All @@ -24,7 +24,7 @@ ar.beforeRequestHandler.use('/userInfo', function (req, res, next) {
res.end("Missing JWT Token");
} else {
res.statusCode = 200;
let decodedToken = jwt_decode(token);
let decodedToken = jwtDecode(token);
res.end(JSON.stringify({
userid: decodedToken.user_name,
email: decodedToken.email,
Expand Down
10 changes: 5 additions & 5 deletions code/easyfranchise/source/approuter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"start": "node approuter-start.js"
},
"dependencies": {
"@sap/approuter": "10.8.2",
"@sap/xsenv": "^3.1.1",
"@sap/xssec": "^3.2.8",
"jwt-decode": "^3.1.2"
"@sap/approuter": "14.3.4",
"@sap/xsenv": "^4.0.0",
"@sap/xssec": "^3.4.0",
"jwt-decode": "^4.0.0"
},
"devDependencies": {},
"engines": {
"node": "14.x.x"
"node": "20.x.x"
}
}
8 changes: 4 additions & 4 deletions code/easyfranchise/source/backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<jetty.version>11.0.3</jetty.version>
<jersey.version>3.0.1</jersey.version>
<slf4j.version>2.0.0-alpha1</slf4j.version>
<jetty.version>11.0.18</jetty.version>
<jersey.version>3.1.3</jersey.version>
<slf4j.version>2.0.9</slf4j.version>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
</properties>
<build>
Expand All @@ -20,7 +20,7 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>15</release>
<release>17</release>
</configuration>
</plugin>
<plugin>
Expand Down
2 changes: 1 addition & 1 deletion code/easyfranchise/source/ui/vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module.exports = {
devServer: {
host: '0.0.0.0',
hot: true,
allowedHosts: "all",
allowedHosts: ['all'],
},
};
10 changes: 2 additions & 8 deletions documentation/appendix/business-partner-mock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,9 @@ The mock server simply reads all entities in the [BusinessPartner-sample.json](.

## Deploy to the Kyma Cluster

For the next steps you need to have your SAP BTP, Kyma environment ready as described in the section [prepare](../../../documentation/prepare/setup-btp-environment/README.md). The deployment of the service itself is part of the deployment script which is described in chapter [Deployment via Script](../script-deployment/README.md).
For the next steps you need to have your SAP BTP, Kyma environment ready as described in the section [prepare](../../../documentation/prepare/setup-btp-environment/README.md).

1. Create a destination pointing to the mock server in the cluster. In your subscriber subaccount, create a destination for the Business Partner mock server as following:

![Destination](images/BPMock-Destination.png)

The properties of the destination are shown in the following screenshot. Note that the Business Partner mock server does not require user and password. For compatibility purpose, you can use any text for username and password.

![Destination Properties](images/BPMock-Destination_Properties.png)
The deployment of the service can be done manually as described in the section [Deploy the Artifacts Manually](../../deploy/manual-deployment/README.md) or via the deployment script which is described in chapter [Deployment via Script](../script-deployment/README.md).

## Using Multiple Instances

Expand Down
18 changes: 13 additions & 5 deletions documentation/appendix/s4hana-on-prem/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,26 @@ See section [Configure SAP BTP Connectivity in the Kyma Environment](https://hel

Configuration steps:

1. Add entitlement for plan **connectivity_proxy** in **Entitlements** section of your EasyFranchise subaccount. (In the screenshot it is grayed out because the entitlement was already set before.)
1. Go to your global account and add entitlement for plan **connectivity_proxy** in **Entitlements** section of your EasyFranchise subaccount.

![Add Plan](./images/proxy01.png)
![Add Plan](./images/2023-proxy01.png)

1. In the Kyma dashboard, select the **integration** namespace and go to **Service Management - Catalog**. You will find the Connectivity Service. Choose it and add an instance. Using default (generated) names will do.
1. Select **Connectivity Service** and select the plan **connectivity_proxy**. Then add the entitlement.
![Add Plan](./images/2023-proxy01b.png)

1. In the Kyma dashboard under **Service Management**, click **Create Service Instance** and provide the following details:
* Name - a unique name for your service instance.The name must not contain more than 253 characters. It must consist of lowercase alphanumeric characters. It can also contain - (single or consecutive, like in a--a).
* Offering Name - set it to connectivity.
* Plan Name - set it to connectivity_proxy.

![Service](./images/proxy02.png)

2. Switch to the **Instances** section and select your newly created service instance. Add a service binding by choosing **Add ServiceBinding +**. Again, using default names is ok. Now, bind the application **bp-service** by using the button **Create Service Binding Usage +**. You now should have a bound service instance similar to this one:
2. Go to the tab **Service Bindings** and **click Create Service Binding** and provide the following details:
* Name - a unique name for your service binding.
* Service Instance Name - the name of the service instance created previously.

![Instance](./images/proxy03.png)

![Instance](./images/2023-proxy03.png)
## Use Connectivity-Proxy in bp-service

Changing Easy Franchise setup from SAP S/4HANA Cloud to on-premise after the previous configuration steps requires only small changes. The same destination name was reused. You may want to compare with [Destination Configuration](../../test-customer-onboarding/configure-destination/README.md).
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions documentation/appendix/script-deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ There are certain parameters that you need to provide in the beginning of the sc

* Subdomain: The subdomain of the subaccount, where your application should be deployed, for example, `easyfranchise`.

![subdomain screenshot](images/subdomain.png "subdomain")
![subdomain screenshot](images/2023-subdomain.png "subdomain")

* Cluster Domain: The full Kyma cluster domain that you can find in the downloaded **kubeconfig** file or in the Kyma dashboard, for example, `c-1ddaa90.kyma.ondemand.com`.

![](images/kymaConsole.png)
![](images/2023-kymaConsole.png)

* Kubeconfig Url: Open SAP BTP Cockpit and navigate to the overview page of the subaccount where Kyma is enabled. There you will find the URL to download the `kubeconfig` file.

![](images/kyma-dashboard.png)
![](images/2023-kyma-dashboard.png)

* Docker E-Mail: E-Mail address associated with the docker repository

Expand All @@ -76,9 +76,9 @@ There are certain parameters that you need to provide in the beginning of the sc

* Docker Repository: The name of the docker repository where to store the created images. In case of Docker Hub this is a combination of account and repository name, which look like that: ```<docker account>/<repository name>``` e.g. ```user1234/efdeploy```

* SQL Endpoint: SQL endpoint of the database to be used. Use **Instances and Subscriptions** from the left side navigation, then select the application **SAP HANA Cloud**. Then copy the SQL endpoint like in the following screenshot:
* SQL Endpoint: SQL endpoint of the database to be used. Use **Instances and Subscriptions** from the left side navigation, then select the application **SAP HANA Cloud**. The **SAP HANA Cloud Central** will open. Then copy the SQL endpoint like in the following screenshot:

![hana-cloud screenshot](../../prepare/configure-hana/images/getSQLEndpoint.png "hana-cloud")
![](images/2023-hana-cloud.png)

* DB Admin: Username of the database admin (for example, `DBADMIN` if you followed the mission [Develop a Multitenant Extension Application in SAP BTP, Kyma runtime](https://discovery-center.cloud.sap/missiondetail/3683/3726/))

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion documentation/deploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ In this section you will learn how to deploy all components in your Kyma cluster

## Deployment Options

In the following sections, we will explain two options to deploy the components. There is a [complete manual way](../../documentation/deploy/manual-deployment/README.md) of deploying the components or you can use the [setup script](../../documentation/appendix/script-deployment/README.md) which is provided in the [setup](../../code/setup). Essentially the script does the same as explained in the manual deployment sections so we recommend to go through the manual deployment once to understand what is happening within the scripts. If you plan to use the script after the manual deployment we recommend to create a copy of the [k8s](../../code/easyfranchise/deployment/k8s) folder as you need todo some changes to the yaml files for the manual deployment which need to be reverted for the scripts.
In the following sections, we will explain two options to deploy the components. There is a [complete manual way](../../documentation/deploy/manual-deployment/README.md) of deploying the components or you can use the [setup script](../../documentation/appendix/script-deployment/README.md) which is provided in the [setup](../../code/setup). Essentially the script does the same as explained in the manual deployment sections so we recommend to go through the manual deployment once to understand what is happening within the script. If you plan to use the script after the manual deployment, we recommend to create a copy of the [k8s](../../code/easyfranchise/deployment/k8s) folder as you need todo some changes to the yaml files for the manual deployment, which need to be reverted for the script.

## Section Content
1. [Prepare the Deployment](../../documentation/deploy/prepare-deployment/README.md)
Expand Down
35 changes: 29 additions & 6 deletions documentation/deploy/manual-deployment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ The Approuter deployment is done through two steps. The first step creates the r

- `<cluster-domain>` the full Kyma cluster domain. You can find the cluster name in the downloaded **kubeconfig** file or in the Kyma dashboard, for example, `c-1ddaa90.kyma.ondemand.com`.

![](images/kymaConsole.png)
![](images/2023-kymaConsole.png)

- `<provider-subdomain>` must be replaced with the subdomain of the sub account where the application should be deployed to. This can be found in the SAP BTP cockpit.

![](images/subdomain.png)
![](images/2023-subdomain.png)

2. You can proceed with the deployment to the Kyma cluster. Navigate to root folder of the repository:
2. If you are using recently provisioned Kyma runtime, you need to enable the BTP operator module in Kyma under the **kyma-system** namespace. Follow the steps described in the [official documentation(https://help.sap.com/docs/btp/sap-business-technology-platform/enable-and-disable-kyma-module#loio1b548e9ad4744b978b8b595288b0cb5c)]. At the end, you should see the module **btp-operator** configured.

![](images/2023-btp-operator.png)

3. You can proceed with the deployment to the Kyma cluster. Navigate to root folder of the repository:

```shell
kubectl apply -f ./code/easyfranchise/deployment/k8s/btp-services.yaml
Expand Down Expand Up @@ -213,11 +217,11 @@ As the Email service is based on Node.js, there is no need to build the service
1. You start with building and pushing the Docker image. Navigate to the root folder of the repository and run the following commands:

```shell
docker build --no-cache=true --rm -t <docker-repository>:emailservice-0.1 -f ./code/easyfranchise/deployment/docker/Dockerfile-email-service .
docker push <docker-repository>:emailservice-0.1
docker build --no-cache=true --rm -t <docker-repository>:email-service-0.1 -f ./code/easyfranchise/deployment/docker/Dockerfile-email-service .
docker push <docker-repository>:email-service-0.1
```

1. Before you can deploy the image, you need to replace the <image-name> tag in the [email-service.yaml](../../../code/easyfranchise/deployment/k8s/email-service.yaml) file with `<docker-repository>:emailservice-0.1`.
1. Before you can deploy the image, you need to replace the <image-name> tag in the [email-service.yaml](../../../code/easyfranchise/deployment/k8s/email-service.yaml) file with `<docker-repository>:email-service-0.1`.

1. Deploy the service:

Expand Down Expand Up @@ -252,3 +256,22 @@ Before deploying the UI, you need to check the global variable **backendApi**, w
```bash
kubectl apply -f ./code/easyfranchise/deployment/k8s/ui.yaml
```

## [OPTIONAL] Deploy the Business Partner Mock

If the SAP S/4HANA Cloud system is not available, you can also deploy our Business Partner mock server.

1. Navigate to the root folder of the repository to build and push the Docker image:

```shell
docker build --no-cache=true --rm -t <docker-repository>:mock-0.1 -f ./code/easyfranchise/deployment/docker/Dockerfile-business-partner-mock .
docker push <docker-repository>:mock-0.1
```

1. Before you can deploy the image, you need to replace the `<image-name>` tag in the [business-partner-mock.yaml](../../../code/easyfranchise/deployment/k8s/business-partner-mock.yaml) file with `<docker-repository>:mock-0.1`:

```shell
kubectl apply -f ./code/easyfranchise/deployment/k8s/business-partner-mock.yaml
```

1. Verify that you can find a new pod with the name **business-partner-mock-xxxx** in the namespace **mock** of the Kyma cluster to validate the deployment.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f08d787

Please sign in to comment.