Skip to content

Commit

Permalink
Merge pull request #26 from SAP-samples/updates-november-2023
Browse files Browse the repository at this point in the history
updates based on basis mission changes
  • Loading branch information
matthieupelatan authored Nov 16, 2023
2 parents 28f1c32 + fb30bf8 commit f2dbca1
Show file tree
Hide file tree
Showing 32 changed files with 64 additions and 62 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file removed code/.DS_Store
Binary file not shown.
5 changes: 0 additions & 5 deletions code/README.md

This file was deleted.

Binary file removed code/easyfranchise/.DS_Store
Binary file not shown.
19 changes: 0 additions & 19 deletions code/easyfranchise/README.md

This file was deleted.

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="[email protected]"
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="[email protected]"
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="[email protected]"
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
Binary file removed code/easyfranchise/source/.DS_Store
Binary file not shown.
14 changes: 14 additions & 0 deletions code/easyfranchise/source/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Easy Franchise Components

This section contains all components that are needed to run the Easy Franchise application.

- [backend](backend): JAVA-based backend services that manage database, SAP S/4HANA Cloud system and the logic of the application
- [Database Service](backend/db-service)
- [Business Partner Service](backend/bp-service)
- [Easy Franchise Service](backend/ef-service)
- [email-service](email-service): node.js-based service that sends notifications
- [ui](ui): vue.js-based user interface
- [Approuter](approuter): node.js-based application router for authorization and authentication
- [broker](broker): service that onboards/offboards new customers of the multitenant application
- [business-partner-mock-server](business-partner-mock-server): service to simulate an SAP S/4HANA Cloud system if not available

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"
}
}
3 changes: 3 additions & 0 deletions code/easyfranchise/source/approuter/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Easy Franchise Approuter

Please refer to [documentation](/documentation/explore/approuter/README.md) for more details.
3 changes: 3 additions & 0 deletions code/easyfranchise/source/backend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Easy Franchise Backend

Please refer to [documentation](/documentation/explore/README.md) for more details.
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package dev.kyma.samples.easyfranchise.bpservice;

import java.net.InetSocketAddress;
import java.net.Proxy;

import org.apache.http.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -19,10 +16,10 @@
import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.UriInfo;
import jakarta.ws.rs.core.HttpHeaders;
/**
* Rest service for S/4HANA connectivity
*
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.SocketTimeoutException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
Expand Down
3 changes: 3 additions & 0 deletions code/easyfranchise/source/broker/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Broker

Please refer to [documentation](/documentation/explore/broker/README.md) for more details.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SAP Business Partner Mock Server

Please refer to [documentation](/documentation/appendix/business-partner-mock) for more details.
3 changes: 3 additions & 0 deletions code/easyfranchise/source/email-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Email Service

Please refer to [documentation](/documentation/explore/email-service/README.md) for more details.
3 changes: 3 additions & 0 deletions code/easyfranchise/source/ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Easy Franchise Backend

Please refer to [documentation](/documentation/explore/ui/README.md) for more details.
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'],
},
};
6 changes: 3 additions & 3 deletions code/setup/btp-setup-automator/btpsa-deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ function parse_yaml {

read_automator_config() {
result=$(jq '.' /home/user/log/metadata_log.json)
SUBDOMAIN=$(jq -r '."subdomain"' <<< "${result}")
SUBDOMAIN=$(jq -r '."subdomain"' <<< "${result}")
KUBECONFIG_URL=$(jq -r '."kymaKubeConfigUrl"' <<< "${result}")
DB_ADMIN="DBADMIN"
DB_ADMIN_PASSWORD="$( echo "$result" | jq -r '.createdServiceInstances[] | select(.name == "hana-cloud") | .parameters.data.systempassword' 2> /dev/null)"

DB_DASHBOARD="$( echo "$result" | jq -r '.createdServiceInstances[] | select(.name == "hana-cloud") | .statusResponse | ."dashboard_url" ' 2> /dev/null)"
DB_DASHBOARD="$( echo "$result" | jq -r '.createdServiceInstances[] | select(.name == "hana-cloud") | .statusResponse | ."dashboard_url" ' 2> /dev/null)"
DB_HOST="${DB_DASHBOARD#*?host=}"
DB_HOST=${DB_HOST/&component*}
DB_PORT=${DB_DASHBOARD/*port=/}
Expand Down Expand Up @@ -149,4 +149,4 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
log "####################################################################################################"
echo

fi
fi
Empty file modified code/setup/easyfranchise-deployment.sh
100755 → 100644
Empty file.

0 comments on commit f2dbca1

Please sign in to comment.