From d95fcfa7f70099beca399b194a958b79bc402d13 Mon Sep 17 00:00:00 2001 From: rschneider <97682836+rainer-exxcellent@users.noreply.github.com> Date: Wed, 13 Sep 2023 07:36:51 +0200 Subject: [PATCH] feat(orchestrator): #422 Orchestrator: Setup new Maven Module --- README.md | 1 + bpdm-cleaning-service-dummy/pom.xml | 4 + bpdm-orchestrator/DOCKER_NOTICE.md | 28 +++ bpdm-orchestrator/Dockerfile | 17 ++ bpdm-orchestrator/pom.xml | 170 ++++++++++++++++++ .../tractusx/bpdm/orchestrator/Application.kt | 33 ++++ .../src/main/resources/application.properties | 42 +++++ .../bpdm/orchestrator/ApplicationTests.kt | 35 ++++ pom.xml | 16 +- 9 files changed, 341 insertions(+), 5 deletions(-) create mode 100644 bpdm-orchestrator/DOCKER_NOTICE.md create mode 100644 bpdm-orchestrator/Dockerfile create mode 100644 bpdm-orchestrator/pom.xml create mode 100644 bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/Application.kt create mode 100644 bpdm-orchestrator/src/main/resources/application.properties create mode 100644 bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/ApplicationTests.kt diff --git a/README.md b/README.md index 172a363c7..5b43c7b60 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ Source: * [BPDM Pool](./bpdm-pool/DOCKER_NOTICE.md) * [BPDM Gate](./bpdm-gate/DOCKER_NOTICE.md) +* [BPDM Orchestrator](./bpdm-orchestrator/DOCKER_NOTICE.md) * [BPDM Cleaning Service Dummy](./bpdm-cleaning-service-dummy/DOCKER_NOTICE.md) * [BPDM Bridge Dummy](./bpdm-bridge-dummy/DOCKER_NOTICE.md) diff --git a/bpdm-cleaning-service-dummy/pom.xml b/bpdm-cleaning-service-dummy/pom.xml index d74e7b02b..b2ea5deb1 100644 --- a/bpdm-cleaning-service-dummy/pom.xml +++ b/bpdm-cleaning-service-dummy/pom.xml @@ -43,6 +43,10 @@ ${project.groupId} bpdm-pool-api + + ${project.groupId} + bpdm-orchestrator + org.jetbrains.kotlin diff --git a/bpdm-orchestrator/DOCKER_NOTICE.md b/bpdm-orchestrator/DOCKER_NOTICE.md new file mode 100644 index 000000000..f42d42695 --- /dev/null +++ b/bpdm-orchestrator/DOCKER_NOTICE.md @@ -0,0 +1,28 @@ +## Notice for Docker image + +DockerHub: [https://hub.docker.com/r/tractusx/bpdm](https://hub.docker.com/r/tractusx/bpdm) + +Eclipse Tractus-X product(s) installed within the image: + +**BPDM Orchestrator** + +Eclipse Tractus-X product(s) installed within the image: + +- GitHub: https://github.com/eclipse-tractusx/bpdm +- Project home: https://projects.eclipse.org/projects/automotive.tractusx +- Orchestrator Dockerfile: https://github.com/eclipse-tractusx/bpdm/blob/main/bpdm-orchestrator/Dockerfile +- Project license: [Apache License, Version 2.0](https://github.com/eclipse-tractusx/bpdm/blob/main/LICENSE) + + +**Used base image** + +- [eclipse-temurin:17-jre-alpine](https://github.com/adoptium/containers) +- Official Eclipse Temurin DockerHub page: https://hub.docker.com/_/eclipse-temurin +- Eclipse Temurin Project: https://projects.eclipse.org/projects/adoptium.temurin +- Additional information about the Eclipse Temurin images: https://github.com/docker-library/repo-info/tree/master/repos/eclipse-temurin + + +As with all Docker images, these likely also contain other software which may be under other licenses +(such as Bash, etc. from the base distribution, along with any direct or indirect dependencies of the primary software being contained). + +As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within. \ No newline at end of file diff --git a/bpdm-orchestrator/Dockerfile b/bpdm-orchestrator/Dockerfile new file mode 100644 index 000000000..569186472 --- /dev/null +++ b/bpdm-orchestrator/Dockerfile @@ -0,0 +1,17 @@ +FROM maven:3.8.7-eclipse-temurin-17 AS build +COPY . /home/app +WORKDIR /home/app +RUN mvn -B -U clean package -pl bpdm-orchestrator -am -DskipTests + +FROM eclipse-temurin:17-jre-alpine +COPY --from=build /home/app/bpdm-orchestrator/target/bpdm-orchestrator.jar /usr/local/lib/bpdm/app.jar +RUN apk update && apk upgrade libssl3 libcrypto3 +ARG USERNAME=bpdm +ARG USERID=10001 +ARG GID=3000 +RUN addgroup -g $GID -S $USERNAME +RUN adduser -u $USERID -S $USERNAME $USERNAME +USER $USERNAME +WORKDIR /usr/local/lib/bpdm +EXPOSE 8080 +ENTRYPOINT ["java","-jar","app.jar"] diff --git a/bpdm-orchestrator/pom.xml b/bpdm-orchestrator/pom.xml new file mode 100644 index 000000000..08ce20501 --- /dev/null +++ b/bpdm-orchestrator/pom.xml @@ -0,0 +1,170 @@ + + + + + 4.0.0 + + bpdm-orchestrator + Business Partner Data Management Orchestrator + Orchestrator component acts as a passive component and offers for each processing steps individual endpoints + jar + + + org.eclipse.tractusx + bpdm-parent + 4.0.2-SNAPSHOT + + + + + ${project.groupId} + bpdm-common + + + + org.jetbrains.kotlin + kotlin-stdlib + + + org.jetbrains.kotlin + kotlin-reflect + + + + org.springframework.boot + spring-boot-starter-web + + + org.springdoc + springdoc-openapi-starter-common + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-oauth2-resource-server + + + io.github.microutils + kotlin-logging-jvm + + + com.fasterxml.jackson.module + jackson-module-kotlin + + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-starter-webflux + + + + org.springframework.boot + spring-boot-starter-oauth2-client + + + org.springframework.boot + spring-boot-configuration-processor + true + + + org.springframework.boot + spring-boot-starter-validation + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.mockito + mockito-core + + + + + + org.assertj + assertj-core + test + + + + + + bpdm-orchestrator + + + + true + ${project.basedir}/src/main/resources + + *.properties + + + + false + ${project.basedir}/src/main/resources + + *.properties + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.jetbrains.kotlin + kotlin-maven-plugin + + + org.apache.maven.plugins + maven-failsafe-plugin + + + + + + github + GitHub CatenaX-NG Apache Maven Packages + https://maven.pkg.github.com/catenax-ng/tx-bpdm + + + + + \ No newline at end of file diff --git a/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/Application.kt b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/Application.kt new file mode 100644 index 000000000..2e767dbaf --- /dev/null +++ b/bpdm-orchestrator/src/main/kotlin/org/eclipse/tractusx/bpdm/orchestrator/Application.kt @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ******************************************************************************/ + +package com.catenax.bpdm.orchestrator + +import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration +import org.springframework.boot.context.properties.ConfigurationPropertiesScan +import org.springframework.boot.runApplication + +@SpringBootApplication(exclude=[DataSourceAutoConfiguration::class]) +@ConfigurationPropertiesScan +class Application + +fun main(args: Array) { + runApplication(*args) +} diff --git a/bpdm-orchestrator/src/main/resources/application.properties b/bpdm-orchestrator/src/main/resources/application.properties new file mode 100644 index 000000000..02ceaf64b --- /dev/null +++ b/bpdm-orchestrator/src/main/resources/application.properties @@ -0,0 +1,42 @@ +################################################################################ +# Copyright (c) 2021,2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +################################################################################ +bpdm.name=@project.name@ +bpdm.description=@project.description@ +bpdm.version=@project.version@ +## +# Change default port +server.port=8085 +## +# Logging Configuration +bpdm.logging.unknown-user=Anonymous + +## +#Springdoc swagger configuration +springdoc.api-docs.enabled=true +springdoc.api-docs.path=/docs/api-docs +springdoc.swagger-ui.disable-swagger-default-url=true +springdoc.swagger-ui.path=/ui/swagger-ui +springdoc.swagger-ui.show-common-extensions=true +springdoc.swagger-ui.csrf.enabled=true +## +#Enable actuator endpoints +management.endpoint.health.probes.enabled=true +management.health.livenessState.enabled=true +management.health.readinessState.enabled=true + diff --git a/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/ApplicationTests.kt b/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/ApplicationTests.kt new file mode 100644 index 000000000..5ce7ee2dc --- /dev/null +++ b/bpdm-orchestrator/src/test/kotlin/org/eclipse/tractusx/bpdm/orchestrator/ApplicationTests.kt @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2021,2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ******************************************************************************/ + +package com.catenax.bpdm.orchestrator + +import org.junit.jupiter.api.Test +import org.springframework.boot.test.context.SpringBootTest +import org.springframework.test.context.ActiveProfiles + +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +class ApplicationTests { + + @Test + fun contextLoads() { + + } + +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4d2f050e1..073ba2c72 100644 --- a/pom.xml +++ b/pom.xml @@ -42,8 +42,9 @@ bpdm-pool bpdm-gate-api bpdm-gate - bpdm-bridge-dummy bpdm-cleaning-service-dummy + bpdm-orchestrator + bpdm-bridge-dummy @@ -82,22 +83,27 @@ ${project.groupId} - bpdm-cleaning-service-dummy + bpdm-common ${project.version} ${project.groupId} - bpdm-common + bpdm-pool-api ${project.version} ${project.groupId} - bpdm-pool-api + bpdm-gate-api ${project.version} ${project.groupId} - bpdm-gate-api + bpdm-cleaning-service-dummy + ${project.version} + + + ${project.groupId} + bpdm-orchestrator ${project.version}