From 0ffe5e494a1715662981eeb1a5c647318d6cbb78 Mon Sep 17 00:00:00 2001 From: Jeff Mesnil Date: Thu, 26 Aug 2021 11:02:13 +0200 Subject: [PATCH] =?UTF-8?q?[EAP7-1726]=C2=A0EAP=20XP=203=20examples=20for?= =?UTF-8?q?=20todo-backend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add example eap-xp3/todo-backend to showcase how to build an deploy an application with EAP XP3 with either S2I or its bootable jar mode. JIRA: https://issues.redhat.com/browse/EAP7-1726 Signed-off-by: Jeff Mesnil --- examples/eap-xp3/todo-backend/README.adoc | 16 ++++ .../todo-backend-bootable-jar.yaml | 43 ++++++++++ .../todo-backend/todo-backend-s2i.yaml | 83 +++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 examples/eap-xp3/todo-backend/README.adoc create mode 100644 examples/eap-xp3/todo-backend/todo-backend-bootable-jar.yaml create mode 100644 examples/eap-xp3/todo-backend/todo-backend-s2i.yaml diff --git a/examples/eap-xp3/todo-backend/README.adoc b/examples/eap-xp3/todo-backend/README.adoc new file mode 100644 index 0000000..5bb60a5 --- /dev/null +++ b/examples/eap-xp3/todo-backend/README.adoc @@ -0,0 +1,16 @@ +# todo-backend: quickstart for backend deployment on OpenShift +:toc: left +:icons: font +:idprefix: +:idseparator: - +:keywords: openshift,eap-xp,microprofile,helm + +[abstract] +The `todo-backend` quickstart demonstrates how to implement a backend that exposes a HTTP API with JAX-RS +to manage a list of ToDo which are persisted in a database with JPA. + +This quickstart shows how to setup a local deployment of this backend as well as a deployment on OpenShift to connect to a PostgreSQL database also hosted on OpenShift. + +The `todo-backend-bootable-jar.yaml` chart builds and deploys the backend using EAP XP3 with Bootable Jar. + +The `todo-backend-s2i.yaml` chart builds and deploys the backend using EAP XP3 with its S2I builder and runtime images. \ No newline at end of file diff --git a/examples/eap-xp3/todo-backend/todo-backend-bootable-jar.yaml b/examples/eap-xp3/todo-backend/todo-backend-bootable-jar.yaml new file mode 100644 index 0000000..9a923f8 --- /dev/null +++ b/examples/eap-xp3/todo-backend/todo-backend-bootable-jar.yaml @@ -0,0 +1,43 @@ +# This configuration file can be used to build and deploy the todo-backend +# quickstart on OpenShift with the Helm Chart for EAP. +build: + uri: https://github.com/jboss-developer/jboss-eap-quickstarts.git + ref: XP_3.0.0.GA + mode: bootable-jar + env: + - name: ARTIFACT_DIR + value: todo-backend/target + - name: MAVEN_ARGS_APPEND + value: -am -pl todo-backend -P bootable-jar-openshift + - name: POSTGRESQL_DRIVER_VERSION + value: '42.2.19' +deploy: + replicas: 3 + env: + # Env vars to connect to PostgreSQL DB + - name: POSTGRESQL_DATABASE + valueFrom: + secretKeyRef: + key: database-name + name: todos-db + - name: POSTGRESQL_USER + valueFrom: + secretKeyRef: + key: database-user + name: todos-db + - name: POSTGRESQL_PASSWORD + valueFrom: + secretKeyRef: + key: database-password + name: todos-db + - name: POSTGRESQL_DATASOURCE + value: ToDos + - name: POSTGRESQL_SERVICE_HOST + value: todos-db + - name: POSTGRESQL_SERVICE_PORT + value: "5432" + # Env to avoid OOME + - name: GC_MAX_METASPACE_SIZE + value: "256" + - name: GC_METASPACE_SIZE + value: "96" diff --git a/examples/eap-xp3/todo-backend/todo-backend-s2i.yaml b/examples/eap-xp3/todo-backend/todo-backend-s2i.yaml new file mode 100644 index 0000000..71a90b7 --- /dev/null +++ b/examples/eap-xp3/todo-backend/todo-backend-s2i.yaml @@ -0,0 +1,83 @@ +# This configuration file can be used to build and deploy the todo-backend +# quickstart on OpenShift with the Helm Chart for EAP. +build: + uri: https://github.com/jboss-developer/jboss-eap-quickstarts.git + ref: XP_3.0.0.GA + mode: s2i + s2i: + featurePacks: + - org.jboss.eap:eap-datasources-galleon-pack:7.4.0.GA-redhat-00003 + galleonLayers: + - cloud-server + - postgresql-datasource + - ejb + env: + - name: ARTIFACT_DIR + value: todo-backend/target + - name: MAVEN_ARGS_APPEND + value: -am -pl todo-backend + - name: POSTGRESQL_DRIVER_VERSION + value: '42.2.19' +deploy: + replicas: 3 + env: + # Env vars to connect to PostgreSQL DB + - name: POSTGRESQL_DATABASE + valueFrom: + secretKeyRef: + key: database-name + name: todos-db + - name: POSTGRESQL_USER + valueFrom: + secretKeyRef: + key: database-user + name: todos-db + - name: POSTGRESQL_PASSWORD + valueFrom: + secretKeyRef: + key: database-password + name: todos-db + - name: POSTGRESQL_DATASOURCE + value: ToDos + - name: POSTGRESQL_SERVICE_HOST + value: todos-db + - name: POSTGRESQL_SERVICE_PORT + value: "5432" + # Env vars to configure CORS filter + - name: FILTERS + value: acao, acam, acah, acac, acma + - name: acao_FILTER_RESPONSE_HEADER_NAME + value: Access-Control-Allow-Origin + - name: acao_FILTER_RESPONSE_HEADER_VALUE + value: "*" + - name: acao_FILTER_REF_NAME + value: Access-Control-Allow-Origin + - name: acam_FILTER_RESPONSE_HEADER_NAME + value: Access-Control-Allow-Methods + - name: acam_FILTER_RESPONSE_HEADER_VALUE + value: GET, POST, OPTION, PUT, DELETE, PATCH + - name: acam_FILTER_REF_NAME + value: Access-Control-Allow-Methods + - name: acah_FILTER_RESPONSE_HEADER_NAME + value: Access-Control-Allow-Headers + - name: acah_FILTER_RESPONSE_HEADER_VALUE + value: accept, authorization, content-type, x-requested-with + - name: acah_FILTER_REF_NAME + value: Access-Control-Allow-Headers + - name: acac_FILTER_RESPONSE_HEADER_NAME + value: Access-Control-Allow-Credentials + - name: acac_FILTER_RESPONSE_HEADER_VALUE + value: "true" + - name: acac_FILTER_REF_NAME + value: Access-Control-Allow-Credentials + - name: acma_FILTER_RESPONSE_HEADER_NAME + value: Access-Control-Max-Age + - name: acma_FILTER_RESPONSE_HEADER_VALUE + value: "1" + - name: acma_FILTER_REF_NAME + value: Access-Control-Max-Age + # Env to avoid OOME + - name: GC_MAX_METASPACE_SIZE + value: "256" + - name: GC_METASPACE_SIZE + value: "96"