Skip to content

Commit

Permalink
WFLY-18512: todo-backend Quickstart Common Enhancements CY2023Q3
Browse files Browse the repository at this point in the history
* Updating charts to fix conflict with cli script
* Updating the pom to reflect the new properties
* Removing the bootable-jar bits
* Removing arquillian and upgrading to JUnit to 5
* Adding postgresql

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
  • Loading branch information
ehsavoie authored and emmartins committed Dec 20, 2023
1 parent b539659 commit 0421e22
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 371 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
postgresql:
primary:
podSecurityContext:
enabled: true
fsGroup: 1001
containerSecurityContext:
enabled: true
runAsUser: 1001
runAsGroup: 0
runAsNonRoot: true
allowPrivilegeEscalation: false
seccompProfile:
type: RuntimeDefault
capabilities:
drop:
- ALL
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ function installPrerequisites()
echo "Adding bitnami repository"
helm repo add bitnami https://charts.bitnami.com/bitnami

helm dependency update todo-backend-chart/
helm dependency update charts/
}

function helmInstall() {
application="${1}"
helm_set_arguments="$2"

# TODO https://issues.redhat.com/browse/WFLY-18574 remove this when persistence is working
helm_set_arguments="${helm_set_arguments} --set postgresql.primary.persistence.enabled=false"
helm_set_arguments="${helm_set_arguments} -f .ci/openshift-ci/build-root/scripts/qs-overrides/todo-backend/ci.yaml"

# Don't quote ${helm_set_arguments} as it breaks the command when empty, and seems to work without
helm install "${application}" todo-backend-chart/ --wait --timeout="${helm_install_timeout}" ${helm_set_arguments}
Expand All @@ -22,8 +22,7 @@ function helmInstall() {

function cleanPrerequisites()
{
oc delete all -l template=postgresql-ephemeral-template
oc delete secret todo-backend-db
helm uninstall "${application}"
helm repo remove bitnami
}

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/quickstart_todo-backend_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: WildFly Todo Backend Quickstart CI

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
paths:
- 'todo-backend/**'
- '.github/workflows/quickstart_ci.yml'
jobs:
call-quickstart_ci:
uses: ./.github/workflows/quickstart_ci.yml
with:
QUICKSTART_PATH: todo-backend
TEST_PROVISIONED_SERVER: true
TEST_OPENSHIFT: true
MATRIX_OS: "ubuntu-latest"
2 changes: 2 additions & 0 deletions .github/workflows/quickstart_todo-backend_ci_before.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
docker run --name todo-backend-db -e POSTGRES_USER=todos -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 postgres
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ version: 1.0.0
# 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"
appVersion: "0.0.3"
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 12.9.0
version: 13.1.5
#version: 12.9.0
- name: wildfly
repository: http://docs.wildfly.org/wildfly-charts/
version: 2.3.2
46 changes: 46 additions & 0 deletions todo-backend/charts/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# 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
architecture: "standalone"
primary:
podSecurityContext:
enabled: false
fsGroup: "auto"
containerSecurityContext:
enabled: false
runAsUser: "auto"
runAsGroup: ""


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 to avoid OOME
- name: GC_MAX_METASPACE_SIZE
value: "256"
- name: GC_METASPACE_SIZE
value: "96"
170 changes: 37 additions & 133 deletions todo-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@
</licenses>

<properties>
<!-- The versions for BOMs, Dependencies and Plugins -->
<version.server.bootable-jar>30.0.0.Final</version.server.bootable-jar>
<version.wildfly-jar.maven.plugin>10.0.0.Final</version.wildfly-jar.maven.plugin>
<version.wildfly-datasources-galleon-pack>6.0.0.Final</version.wildfly-datasources-galleon-pack>
<version.server.bom>30.0.0.Final</version.server.bom>
<!-- the version for the Server -->
<version.server>30.0.0.Final</version.server>
<version.wildfly.maven.plugin>4.2.0.Final</version.wildfly.maven.plugin>
<version.cloud.fp>5.0.0.Final</version.cloud.fp>
<!-- The versions for BOMs, Packs and Plugins -->
<version.bom.ee>${version.server}</version.bom.ee>
<version.pack.cloud>5.0.0.Final</version.pack.cloud>
<version.pack.datasources>6.0.0.Final</version.pack.datasources>
<version.plugin.wildfly>4.2.0.Final</version.plugin.wildfly>
</properties>

<repositories>
Expand Down Expand Up @@ -115,12 +114,23 @@
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-ee-with-tools</artifactId>
<version>${version.server.bom}</version>
<version>${version.bom.ee}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.plugin.wildfly}</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<dependencies>
<dependency>
Expand Down Expand Up @@ -149,18 +159,9 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet-jakarta</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -178,115 +179,35 @@
<profiles>
<profile>
<id>provisioned-server</id>
<dependencies>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.wildfly.maven.plugin}</version>
<configuration>
<feature-packs>
<feature-pack>
<location>org.wildfly:wildfly-galleon-pack:${version.server}</location>
</feature-pack>
<feature-pack>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-datasources-galleon-pack</artifactId>
<version>${version.wildfly-datasources-galleon-pack}</version>
</feature-pack>
</feature-packs>
<layers>
<layer>cloud-server</layer>
<layer>postgresql-datasource</layer>
</layers>
</configuration>
<executions>
<execution>
<goals>
<goal>package</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.failsafe.plugin}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<environmentVariables>
<JBOSS_HOME>${project.build.directory}/server</JBOSS_HOME>
<POSTGRESQL_DATABASE>todos</POSTGRESQL_DATABASE>
<POSTGRESQL_SERVICE_HOST>localhost</POSTGRESQL_SERVICE_HOST>
<POSTGRESQL_SERVICE_PORT>5432</POSTGRESQL_SERVICE_PORT>
<POSTGRESQL_USER>todos</POSTGRESQL_USER>
<POSTGRESQL_PASSWORD>mysecretpassword</POSTGRESQL_PASSWORD>
<POSTGRESQL_DATASOURCE>ToDos</POSTGRESQL_DATASOURCE>
</environmentVariables>
<includes>
<include>**/ProvisionedManagedToDoIT</include>
</includes>
<excludes>
<exclude>**/RemoteToDoIT</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>bootable-jar-openshift</id>
<build>
<!-- Set the name of the WAR, used as the context root when the app is deployed -->
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-jar-maven-plugin</artifactId>
<version>${version.wildfly-jar.maven.plugin}</version>
<configuration>
<feature-packs>
<feature-pack>
<location>wildfly@maven(org.jboss.universe:community-universe)#${version.server.bootable-jar}</location>
</feature-pack>
<feature-pack>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-datasources-galleon-pack</artifactId>
<version>${version.wildfly-datasources-galleon-pack}</version>
<location>org.wildfly:wildfly-datasources-galleon-pack:${version.pack.datasources}</location>
</feature-pack>
</feature-packs>
<cloud/>
<layers>
<layer>cloud-server</layer>
<layer>postgresql-datasource</layer>
</layers>
<cli-sessions>
<cli-session>
<!-- do not resolve expression as the CORS_ORIGIN env var -->
<!-- can be set at runtime -->
<resolve-expressions>false</resolve-expressions>
<script-files>
<!-- deploys the quickstart on root web context -->
<name>ROOT.war</name>
<packaging-scripts>
<packaging-script>
<scripts>
<script>${project.build.scriptSourceDirectory}/cors_filters.cli</script>
</script-files>
</cli-session>
</cli-sessions>
<plugin-options>
<jboss-fork-embedded>true</jboss-fork-embedded>
</plugin-options>
</scripts>
<!-- Expressions resolved during server execution -->
<resolve-expressions>false</resolve-expressions>
</packaging-script>
</packaging-scripts>
</configuration>
<executions>
<execution>
Expand All @@ -306,16 +227,16 @@
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>${version.wildfly.maven.plugin}</version>
<configuration>
<feature-packs>
<feature-pack>
<location>org.wildfly:wildfly-galleon-pack:${version.server}</location>
</feature-pack>
<feature-pack>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-datasources-galleon-pack</artifactId>
<version>${version.wildfly-datasources-galleon-pack}</version>
<location>org.wildfly:wildfly-datasources-galleon-pack:${version.pack.datasources}</location>
</feature-pack>
<feature-pack>
<location>org.wildfly.cloud:wildfly-cloud-galleon-pack:${version.pack.cloud}</location>
</feature-pack>
</feature-packs>
<layers>
Expand Down Expand Up @@ -345,16 +266,7 @@
</build>
</profile>
<profile>
<!-- An optional Arquillian testing profile that executes tests in a remote JBoss EAP instance.
Run with: mvn clean verify -Parq-remote -->
<id>arq-remote</id>
<dependencies>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<id>integration-testing</id>
<build>
<plugins>
<plugin>
Expand All @@ -369,14 +281,6 @@
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/RemoteToDoIT</include>
</includes>
<excludes>
<exclude>**/ProvisionedManagedToDoIT</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
Loading

0 comments on commit 0421e22

Please sign in to comment.