From 30f70ffc9ade2580971eae556ddbc7d65c799616 Mon Sep 17 00:00:00 2001 From: Emmanuel Hugonnet Date: Mon, 15 May 2023 17:07:03 +0200 Subject: [PATCH] [WFLY-17947]: todo-backend Readme OpenShift instructions results in a non-functional QS app. * Fixing docs and pulling back composite helm charts. * Adding workaround for WildFly 28.0.0 issue with opentelemetry * Adding description of the openshift profile * Removing managed server integration tests Signed-off-by: Emmanuel Hugonnet --- .gitignore | 3 +- jaxrs-client/pom.xml | 4 + kitchensink/pom.xml | 4 + ...and-run-the-quickstart-with-openshift.adoc | 2 + .../build-the-quickstart-for-openshift.adoc | 103 +++++++++ todo-backend/README.adoc | 206 ++++++++++++------ todo-backend/charts/helm.yaml | 34 --- todo-backend/pom.xml | 12 +- .../quickstarts/todos/AbstractToDoIT.java | 6 +- .../quickstarts/todos/ManagedToDoIT.java | 63 ------ .../resources/META-INF/test-persistence.xml | 34 --- todo-backend/src/test/resources/test-ds.xml | 38 ---- todo-backend/todo-backend-chart/.helmignore | 23 ++ todo-backend/todo-backend-chart/Chart.yaml | 31 +++ todo-backend/todo-backend-chart/values.yaml | 93 ++++++++ 15 files changed, 413 insertions(+), 243 deletions(-) create mode 100644 shared-doc/build-the-quickstart-for-openshift.adoc delete mode 100644 todo-backend/charts/helm.yaml delete mode 100644 todo-backend/src/test/java/org/wildfly/quickstarts/todos/ManagedToDoIT.java delete mode 100644 todo-backend/src/test/resources/META-INF/test-persistence.xml delete mode 100644 todo-backend/src/test/resources/test-ds.xml create mode 100644 todo-backend/todo-backend-chart/.helmignore create mode 100644 todo-backend/todo-backend-chart/Chart.yaml create mode 100644 todo-backend/todo-backend-chart/values.yaml diff --git a/.gitignore b/.gitignore index d423ec626f..e06aae9d16 100644 --- a/.gitignore +++ b/.gitignore @@ -31,5 +31,6 @@ atlassian-ide-plugin.xml .nbattrs *.log build.metadata - +*.lock +*.tgz /**/nbproject/ diff --git a/jaxrs-client/pom.xml b/jaxrs-client/pom.xml index 5c3787bdec..61f14c78e5 100644 --- a/jaxrs-client/pom.xml +++ b/jaxrs-client/pom.xml @@ -287,6 +287,10 @@ cloud-server + + + microprofile-telemetry + ROOT.war diff --git a/kitchensink/pom.xml b/kitchensink/pom.xml index e79e1bead5..542fdbc8f9 100644 --- a/kitchensink/pom.xml +++ b/kitchensink/pom.xml @@ -376,6 +376,10 @@ ejb jsf + + + microprofile-telemetry + ROOT.war diff --git a/shared-doc/build-and-run-the-quickstart-with-openshift.adoc b/shared-doc/build-and-run-the-quickstart-with-openshift.adoc index 15b3cf6405..544d2b8666 100644 --- a/shared-doc/build-and-run-the-quickstart-with-openshift.adoc +++ b/shared-doc/build-and-run-the-quickstart-with-openshift.adoc @@ -1,5 +1,7 @@ [[build_and_run_the_quickstart_on_openshift]] = Building and running the quickstart application with OpenShift +// The openshift profile +include::../shared-doc/build-the-quickstart-for-openshift.adoc[leveloffset=+1] // Getting Started with Helm include::../shared-doc/helm-getting-started-overview.adoc[leveloffset=+1] //Prepare Helm for Quickstart Deployment diff --git a/shared-doc/build-the-quickstart-for-openshift.adoc b/shared-doc/build-the-quickstart-for-openshift.adoc new file mode 100644 index 0000000000..d8f7bf5c5e --- /dev/null +++ b/shared-doc/build-the-quickstart-for-openshift.adoc @@ -0,0 +1,103 @@ +[[build-the-quickstart-for-openshift]] +== Build the {productName} Source-to-Image (S2I) Quickstart to OpenShift with Helm Charts + +On OpenShift, the S2I build with Apache Maven will use an `openshift` profile used to provision a {productName} server to deploy and run the quickstart in OpenShift environment. +You can activate the Maven profile named `openshift` when building the quickstart: + +[source,subs="attributes+",options="nowrap"] +---- +$ mvn clean package -Popenshift +---- + +The provisioned {productName} server for OpenShift, with the quickstart deployed, can then be found in the `target/server` directory, and its usage is similar to a standard server distribution. You may note that unlike the `provisioned-server` profile it uses the cloud feature pack which enables a configuration tuned for OpenShift environment. + +ifndef::ProductRelease,EAPXPRelease[] +The server provisioning functionality is provided by the WildFly Maven Plugin, and you may find its configuration in the quickstart `pom.xml`: +endif::[] + +ifdef::ProductRelease,EAPXPRelease[] +The server provisioning functionality is provided by the EAP Maven Plugin, and you may find its configuration in the quickstart `pom.xml`: +endif::[] + +ifndef::ProductRelease,EAPXPRelease[] +[source,xml,subs="attributes+"] +---- + + openshift + + + + org.wildfly.plugins + wildfly-maven-plugin + ${version.wildfly.maven.plugin} + + + + org.wildfly:wildfly-galleon-pack:${version.server} + + + org.wildfly.cloud:wildfly-cloud-galleon-pack:${version.cloud.fp} + + + + cloud-server + + ROOT.war + + + + + package + + + + + + + +---- +endif::[] + +ifdef::ProductRelease,EAPXPRelease[] +[source,xml,subs="attributes+"] +---- + + openshift + + + + org.jboss.eap.plugins + eap-maven-plugin + ${version.eap.maven.plugin} + + + + org.jboss.eap:wildfly-ee-galleon-pack + + + org.jboss.eap.cloud:eap-cloud-galleon-pack + + + + cloud-server + + ROOT.war + + + + + package + + + + + + + +---- +endif::[] + +[NOTE] +==== +Since the plugin configuration above deploys quickstart on root web context of the provisioned server, the URL to access the application should not have the `/{artifactId}` path segment after `HOST:PORT`. +==== \ No newline at end of file diff --git a/todo-backend/README.adoc b/todo-backend/README.adoc index 8c7a58ecce..9937dca298 100644 --- a/todo-backend/README.adoc +++ b/todo-backend/README.adoc @@ -230,26 +230,14 @@ these HTTP requests to succeed. ifndef::ProductRelease[] ==== Configuration with Bootable Jar -As we use Bootable Jar to build the application, we provide a CLI script that contains all the commands to -create and configure the CORS filters in Undertow. This script is located in the `src/scripts/cors_filters.cli`. - -This script is executed at build time and will provide the following HTTP headers to enabled CORS: - -* `Access-Control-Allow-Origin: *` -* `Access-Control-Allow-Methods: GET, POST, OPTION, PUT, DELETE, PATCH` -* `Access-Control-Allow-Headers: accept, authorization, content-type, x-requested-with` -* `Access-Control-Allow-Credentials: true` -* `Access-Control-Max-Age: 1` - -By default, the backend accepts requests from any origin (`*`). This is only simplicity. It is possible to restrict -the allowed origin using the environment variable `CORS_ORIGIN` at runtime. +As we use Bootable Jar to build the application, we provide a CLI script that contains all the commands to create and configure the CORS filters in Undertow. This script is located in the `src/scripts/cors_filters.cli`. endif::[] ifdef::ProductRelease[] ==== Configuration with {productName} S2I -As we use S2I to provision the server and build the application, we provide a CLI script that contains all the commands to -create and configure the CORS filters in Undertow. This script is located in the `src/scripts/cors_filters.cli`. +As we use S2I to provision the server and build the application, we provide a CLI script that contains all the commands to create and configure the CORS filters in Undertow. This script is located in the `src/scripts/cors_filters.cli`. +endif::[] This script is executed at build time and will provide the following HTTP headers to enabled CORS: @@ -262,8 +250,6 @@ This script is executed at build time and will provide the following HTTP header By default, the backend accepts requests from any origin (`*`). This is only simplicity. It is possible to restrict the allowed origin using the environment variable `CORS_ORIGIN` at runtime. -endif::[] - ifndef::ProductRelease[] == Run the Backend Locally as a Bootable Jar @@ -338,6 +324,17 @@ The backend is packaged and deployed on a provisioned server: $ mvn clean package -Pprovisioned-server ---- +[NOTE] +==== +To execute the integration tests require *a running PostgreSQL server*. + +If you have already started the PostgreSQL server and want to run the tests you need to execute the following command: + +[source,options="nowrap"] +---- +$ mvn clean verify -Pprovisioned-server +---- +==== + === Run a Local PostgreSQL Database Before running the backend locally, we need to have a local PostgreSQL database that we can connect to. @@ -389,10 +386,10 @@ $ curl -X POST -H "Content-Type: application/json" -d '{"title": "This is my fi $ curl http://localhost:8080/todo-backend [{"completed":false,"id":1,"order":0,"title":"This is my first todo item!","url":"https://localhost:8080/todo-backend/1"} ---- -endif::[] -ifndef::ProductRelease[] + // Run the Arquillian Tests include::../shared-doc/run-arquillian-functional-tests-remote.adoc[leveloffset=+1] + [NOTE] ==== You may also execute those tests against a running bootable jar application, but you will need to add `-Dserver.host=http://localhost:8080` to the command. @@ -401,12 +398,14 @@ endif::[] == Run the Backend on OpenShift +include::../shared-doc/build-the-quickstart-for-openshift.adoc[leveloffset=+1] + === Prerequisites * You must be logged in OpenShift and have an `oc` client to connect to OpenShift * https://helm.sh[Helm] must be installed to deploy the backend on OpenShift. -Once you have installed Helm, you need to add the repository that provides Helm Charts for {productName} and for postgresql: +Once you have installed Helm, you need to add the repository that provides Helm Charts for {productName}: ifndef::ProductRelease,EAPXPRelease[] [source,options="nowrap"] @@ -419,68 +418,42 @@ wildfly/wildfly ... ... Build and Deploy WildFly wildfly/wildfly-common ... ... A library chart for WildFly-based applications ---- endif::[] -ifdef::ProductRelease[] +ifdef::ProductRelease,EAPXPRelease[] [source,options="nowrap",subs="+attributes"]] ---- $ helm repo add jboss-eap https://jbossas.github.io/eap-charts/ "jboss-eap" has been added to your repositories $ helm search repo jboss-eap NAME CHART VERSION APP VERSION DESCRIPTION -{helmChartName} ... ... A Helm chart to build and deploy EAP {productVersion} applications ----- -endif::[] -ifdef::EAPXPRelease[] -[source,options="nowrap"] ----- -$ helm repo add jboss-eap https://jbossas.github.io/eap-charts/ -"jboss-eap" has been added to your repositories -$ helm search repo jboss-eap -NAME CHART VERSION APP VERSION DESCRIPTION -jboss-eap/eap-xp3 ... ... A Helm chart to build and deploy EAP XP 3 applications +{helmChartName} ... ... A Helm chart to build and deploy {productVersion} applications ---- endif::[] - -ifdef::ProductRelease,EAPXPRelease[] -=== Deploy a PostgreSQL Database on OpenShift - -[source,options="nowrap"] ----- -$ oc new-app postgresql-ephemeral \ - -p DATABASE_SERVICE_NAME=todo-backend-db \ - -p POSTGRESQL_DATABASE=todos ----- - -This will create a PostgreSQL database named `todos` on OpenShift that can be accessed on the port `5432` on the service `todo-backend-db`. -We don't need to copy the credentials to connect to the database as we will retrieve them later using the `todo-backend-db` secret that was created -when the database is deployed. -endif::[] - ifndef::ProductRelease[] === Build and Deploy the Backend on OpenShift with Bootable Jar +endif::[] ==== Deploy a PostgreSQL Database on OpenShift [source,options="nowrap"] ---- $ oc new-app postgresql-ephemeral \ - -p DATABASE_SERVICE_NAME=todo-backend-db \ + -p DATABASE_SERVICE_NAME=todos-db \ -p POSTGRESQL_DATABASE=todos ---- -This will create a PostgreSQL database named `todos` on OpenShift that can be accessed on the port `5432` on the service `todo-backend-db`. -We don't need to copy the credentials to connect to the database as we will retrieve them later using the `todo-backend-db` secret that was created +This will create a PostgreSQL database named `todos` on OpenShift that can be accessed on the port `5432` on the service `todos-db`. +We don't need to copy the credentials to connect to the database as we will retrieve them later using the `todos-db` secret that was created when the database is deployed. +ifndef::ProductRelease,EAPXPRelease[] ==== Build and Deploy the Backend on OpenShift with Bootable Jar using the Helm Chart The backend will be built and deployed on OpenShift with a Helm Chart for {productName}. -ifndef::ProductRelease,EAPXPRelease[] - [source,options="nowrap",subs="+attributes"] ---- -$ helm install todo-backend --set build.ref={WildFlyQuickStartRepoTag} -f https://raw.githubusercontent.com/wildfly/wildfly-charts/main/examples/todo-backend/todo-backend-bootable-jar.yaml wildfly/wildfly +$ helm install todo-backend --set build.ref={WildFlyQuickStartRepoTag} -f https://raw.githubusercontent.com/wildfly/wildfly-charts/main/examples/todo-backend/todo-backend-bootable-jar.yaml {helmChartName} NAME: todo-backend ... STATUS: deployed @@ -502,7 +475,7 @@ The backend will be built and deployed on OpenShift with a Helm Chart for {produ [source,options="nowrap",subs="+attributes"] ---- -$ helm install todo-backend --set build.ref={EAPQuickstartRepoTag} -f https://raw.githubusercontent.com/jbossas/eap-charts/main/examples/eap-xp3/todo-backend/todo-backend-bootable-jar.yaml jboss-eap/eap-xp3 +$ helm install todo-backend --set build.ref={EAPQuickstartRepoTag} -f https://raw.githubusercontent.com/jbossas/eap-charts/main/examples/eap-xp3/todo-backend/todo-backend-bootable-jar.yaml {helmChartName} NAME: todo-backend ... STATUS: deployed @@ -518,14 +491,124 @@ build: mode: bootable-jar ---- endif::[] + +ifndef::ProductRelease[] + +This will create a new deployment on OpenShift and deploy the application. + +If you want to see all the configuration elements to customize your deployment you can use the following command: +[source,options="nowrap",subs="+attributes"] +---- +$ helm show readme {helmChartName} +---- + +Let’s wait for the application to be built and deployed: +[source,options="nowrap",subs="+attributes"] +---- +$ oc get deployment {artifactId} -w +NAME READY UP-TO-DATE AVAILABLE AGE +{artifactId} 0/1 1 0 31s +... +{artifactId} 1/1 1 1 4m31s +---- + endif::[] +ifndef::ProductRelease[] +=== Build and Deploy the Backend on OpenShift with {productName} S2I +endif::[] + +The backend will be built and deployed on OpenShift with a Helm Chart for {productName}. + +ifdef::EAPXPRelease[] +==== Deploy a PostgreSQL Database on OpenShift + +[source,options="nowrap"] +---- +$ oc new-app postgresql-ephemeral \ + -p DATABASE_SERVICE_NAME=todo-backend-db \ + -p POSTGRESQL_DATABASE=todos +---- + +This will create a PostgreSQL database named `todos` on OpenShift that can be accessed on the port `5432` on the service `todo-backend-db`. +We don't need to copy the credentials to connect to the database as we will retrieve them later using the `todo-backend-db` secret that was created +when the database is deployed. +endif::[] + +ifndef::ProductRelease,EAPXPRelease[] +Add the bitnami repository which provides an helm chart for PostgreSQL: +[source,options="nowrap"] +---- +$ helm repo add bitnami https://charts.bitnami.com/bitnami +"bitnami" has been added to your repositories +---- + +Install the full application (database + backend). + +[source,options="nowrap",subs="+attributes"] +---- +$ helm dependency update todo-backend-chart/ +$ helm install todo-backend todo-backend-chart/ +NAME: todo-backend +... +STATUS: deployed +REVISION: 1 +---- +endif::[] + +ifndef::ProductRelease,EAPXPRelease[] +The Helm Chart for this quickstart contains all the information to build an image from the source code using S2I and install it with the database: + +[source,options="nowrap"] +---- +dependencies: + - name: postgresql + repository: https://charts.bitnami.com/bitnami + version: ... + - name: wildfly + repository: http://docs.wildfly.org/wildfly-charts/ + version: ... +---- + +endif::[] + +ifndef::ProductRelease,EAPXPRelease[] +Any configuration specified by this chart is described in its README that is displayed in OpenShift Dev console +or using the command: + +[source,options="nowrap",subs="+attributes"] +---- +$ helm show readme {helmChartName} +---- + +Let's wait for the application to be built and deployed: + +[source,options="nowrap",subs="+attributes"] +---- +$ oc get deployment todo-backend -w +NAME READY UP-TO-DATE AVAILABLE AGE +{artifactId} 0/1 1 0 31s +... +{artifactId} 1/1 1 1 4m31s +---- + +endif::[] + +ifdef::ProductRelease,EAPXPRelease[] + //Prepare Helm for Quickstart Deployment include::../shared-doc/helm-deploy-project.adoc[leveloffset=+1] +endif::[] + === Environment variables for PostgreSQL The Helm Chart also contains the environment variables required to connect to the PostgreSQL database. + +ifndef::ProductRelease[] +In local deployment the credentials were passed directly as the values of the environment variables. +endif::[] + For OpenShift, we rely on secrets so that the credentials are never copied outside OpenShift: [source,options="nowrap"] @@ -542,17 +625,6 @@ deploy: When the application is deployed, the value for the `POSTGRESQL_PASSWORD` will be taken from the key `database-password` in the secret `todo-backend-db`. -Let's wait for the application to be built and deployed: - -[source,options="nowrap"] ----- -$ oc get deployment todo-backend -w -NAME READY UP-TO-DATE AVAILABLE AGE -todo-backend 0/1 1 0 31s -... -todo-backend 1/1 1 1 4m31s ----- - // Testing on Openshift include::../shared-doc/run-arquillian-integration-tests-with-openshift.adoc[leveloffset=+2] @@ -594,7 +666,7 @@ The backend can be deleted from OpenShift by running the command: [source,options="nowrap"] ---- -$ helm delete todo-backend +$ helm uninstall todo-backend release "todo-backend" uninstalled ---- diff --git a/todo-backend/charts/helm.yaml b/todo-backend/charts/helm.yaml deleted file mode 100644 index 12f96d2d44..0000000000 --- a/todo-backend/charts/helm.yaml +++ /dev/null @@ -1,34 +0,0 @@ -# This configuration file can be used to build and deploy the todo-backend -# quickstart on OpenShift with the Helm Chart. -build: - uri: https://github.com/wildfly/quickstart.git - ref: main - contextDir: todo-backend - env: - - name: POSTGRESQL_DRIVER_VERSION - value: '42.5.1' -deploy: - replicas: 1 - env: - # Env vars to connect to PostgreSQL DB - - name: POSTGRESQL_DATABASE - valueFrom: - secretKeyRef: - key: database-name - name: todo-backend-db - - name: POSTGRESQL_USER - valueFrom: - secretKeyRef: - key: database-user - name: todo-backend-db - - name: POSTGRESQL_PASSWORD - valueFrom: - secretKeyRef: - key: database-password - name: todo-backend-db - - name: POSTGRESQL_DATASOURCE - value: ToDos - - name: POSTGRESQL_SERVICE_HOST - value: todo-backend-db - - name: POSTGRESQL_SERVICE_PORT - value: "5432" diff --git a/todo-backend/pom.xml b/todo-backend/pom.xml index 20ab7fed83..f3465470f9 100644 --- a/todo-backend/pom.xml +++ b/todo-backend/pom.xml @@ -175,8 +175,6 @@ - - provisioned-server @@ -241,7 +239,6 @@ **/ProvisionedManagedToDoIT - **/ManagedToDoIT **/RemoteToDoIT @@ -277,6 +274,10 @@ cloud-server postgresql-datasource + + + microprofile-telemetry + @@ -325,6 +326,10 @@ cloud-server postgresql-datasource + + + microprofile-telemetry + ROOT.war @@ -378,7 +383,6 @@ **/ProvisionedManagedToDoIT - **/ManagedToDoIT diff --git a/todo-backend/src/test/java/org/wildfly/quickstarts/todos/AbstractToDoIT.java b/todo-backend/src/test/java/org/wildfly/quickstarts/todos/AbstractToDoIT.java index c3c6c860f0..76ed3dd64a 100644 --- a/todo-backend/src/test/java/org/wildfly/quickstarts/todos/AbstractToDoIT.java +++ b/todo-backend/src/test/java/org/wildfly/quickstarts/todos/AbstractToDoIT.java @@ -27,9 +27,12 @@ import jakarta.ws.rs.core.MediaType; import java.net.URL; import java.util.List; + import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; + /** * * @author Emmanuel Hugonnet (c) 2022 Red Hat, Inc. @@ -39,8 +42,7 @@ public abstract class AbstractToDoIT { abstract URL getRequestUrl(); public void internalCRUDTest() throws Exception { - - WebTarget client = ClientBuilder.newClient().target(getRequestUrl().toURI()); + WebTarget client = ((ResteasyClientBuilder) ClientBuilder.newBuilder()).setFollowRedirects(true).build().target(getRequestUrl().toURI()); GenericType> todosListType = new GenericType>() { }; diff --git a/todo-backend/src/test/java/org/wildfly/quickstarts/todos/ManagedToDoIT.java b/todo-backend/src/test/java/org/wildfly/quickstarts/todos/ManagedToDoIT.java deleted file mode 100644 index 5a0bdfbcae..0000000000 --- a/todo-backend/src/test/java/org/wildfly/quickstarts/todos/ManagedToDoIT.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * JBoss, Home of Professional Open Source - * Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual - * contributors by the @authors tag. See the copyright.txt in the - * distribution for a full listing of individual contributors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://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. - */ -package org.wildfly.quickstarts.todos; - - -import java.net.URL; - -import org.jboss.arquillian.container.test.api.Deployment; -import org.jboss.arquillian.container.test.api.RunAsClient; -import org.jboss.arquillian.junit.Arquillian; -import org.jboss.arquillian.test.api.ArquillianResource; -import org.jboss.shrinkwrap.api.Archive; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.asset.StringAsset; -import org.jboss.shrinkwrap.api.spec.WebArchive; -import org.junit.Test; -import org.junit.runner.RunWith; - -@RunWith(Arquillian.class) -@RunAsClient -public class ManagedToDoIT extends AbstractToDoIT { - - @Deployment - public static Archive createTestArchive() { - return ShrinkWrap.create(WebArchive.class, "test.war") - .addPackage(ToDo.class.getPackage()) - .addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml") - .addAsWebInfResource(new StringAsset("\n" - + ""), "beans.xml") - // Deploy our test datasource - .addAsWebInfResource("test-ds.xml"); - } - - @ArquillianResource - private URL deploymentUrl; - - @Test - public void testCRUD() throws Exception { - super.internalCRUDTest(); - } - - @Override - URL getRequestUrl() { - return deploymentUrl; - } - -} diff --git a/todo-backend/src/test/resources/META-INF/test-persistence.xml b/todo-backend/src/test/resources/META-INF/test-persistence.xml deleted file mode 100644 index 65fdbc95ca..0000000000 --- a/todo-backend/src/test/resources/META-INF/test-persistence.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - java:jboss/datasources/ToDos - - - - - - - diff --git a/todo-backend/src/test/resources/test-ds.xml b/todo-backend/src/test/resources/test-ds.xml deleted file mode 100644 index ff71e25bcb..0000000000 --- a/todo-backend/src/test/resources/test-ds.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - jdbc:h2:mem:todo-backend;DB_CLOSE_DELAY=-1 - h2 - - sa - sa - - - - diff --git a/todo-backend/todo-backend-chart/.helmignore b/todo-backend/todo-backend-chart/.helmignore new file mode 100644 index 0000000000..0e8a0eb36f --- /dev/null +++ b/todo-backend/todo-backend-chart/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/todo-backend/todo-backend-chart/Chart.yaml b/todo-backend/todo-backend-chart/Chart.yaml new file mode 100644 index 0000000000..89df4bd566 --- /dev/null +++ b/todo-backend/todo-backend-chart/Chart.yaml @@ -0,0 +1,31 @@ +apiVersion: v2 +name: todo-backend-chart +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 1.0.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "0.0.2" +dependencies: + - name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 12.3.1 + - name: wildfly + repository: http://docs.wildfly.org/wildfly-charts/ + version: 2.3.1 \ No newline at end of file diff --git a/todo-backend/todo-backend-chart/values.yaml b/todo-backend/todo-backend-chart/values.yaml new file mode 100644 index 0000000000..0ccdf6778e --- /dev/null +++ b/todo-backend/todo-backend-chart/values.yaml @@ -0,0 +1,93 @@ +# Default values for todo-backend-chart. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +postgresql: + auth: + username: todos-db + password: todos-db + database: todos-db + primary: + podSecurityContext: + enabled: false + fsGroup: "" + containerSecurityContext: + enabled: false + runAsUser: "auto" + persistence: + size: 2Gi + + readReplicas: + podSecurityContext: + enabled: false + fsGroup: "" + containerSecurityContext: + enabled: false + runAsUser: "auto" + persistence: + size: 2Gi + + volumePermissions: + enabled: false + securityContext: + runAsUser: "auto" + +wildfly: + build: + uri: https://github.com/wildfly/quickstart.git + ref: main + contextDir: todo-backend + deploy: + replicas: 1 + env: + # Env vars to connect to PostgreSQL DB + - name: POSTGRESQL_DATABASE + value: todos-db + - name: POSTGRESQL_USER + value: todos-db + - name: POSTGRESQL_PASSWORD + value: todos-db + - name: POSTGRESQL_DATASOURCE + value: ToDos + - name: POSTGRESQL_SERVICE_HOST + value: todo-backend-postgresql + - 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"