Skip to content

Commit

Permalink
Merge pull request #108 from SAP-samples/updates-november-2023
Browse files Browse the repository at this point in the history
screenshots, kyma cli, btp operator, versions, ...
  • Loading branch information
matthieupelatan authored Nov 22, 2023
2 parents d234d0a + e4ef22a commit 5129272
Show file tree
Hide file tree
Showing 28 changed files with 195 additions and 54 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="[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
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.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ app.get('/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner', function (r
});
})

var server = app.listen(8081, '127.0.0.1', function () {
var server = app.listen(8081, '0.0.0.0', function () {
var host = server.address().address;
if (host === '::') {
host = 'localhost';
Expand Down
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/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<link rel="icon" href="<%= BASE_URL %>ui/favicon.ico">
<link href="https://unpkg.com/fiori-fundamentals@latest/dist/fiori-fundamentals.min.css" rel="stylesheet">
<title><%= htmlWebpackPlugin.options.title %></title>
<link href="header.css" rel="stylesheet">
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'],
},
};
Loading

0 comments on commit 5129272

Please sign in to comment.