Skip to content

Commit

Permalink
Merge pull request #21 from jmesnil/EAP7-1726_todo-backend-xp3
Browse files Browse the repository at this point in the history
[EAP7-1726] EAP XP 3 examples for todo-backend
  • Loading branch information
jmesnil authored Aug 26, 2021
2 parents d601e09 + 0ffe5e4 commit 7f08c3b
Show file tree
Hide file tree
Showing 3 changed files with 142 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/eap-xp3/todo-backend/README.adoc
Original file line number Diff line number Diff line change
@@ -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.
43 changes: 43 additions & 0 deletions examples/eap-xp3/todo-backend/todo-backend-bootable-jar.yaml
Original file line number Diff line number Diff line change
@@ -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"
83 changes: 83 additions & 0 deletions examples/eap-xp3/todo-backend/todo-backend-s2i.yaml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 7f08c3b

Please sign in to comment.