ci: use Traefik proxy server to manage CI compose setup
ci: tag latest docker image build with git commit ID to remove any ambiguity
MODIFY
distro/wildfly/pom.xml
distro/wildfly/pom.xml
<docker.wildfly.version>wildfly</docker.wildfly.version>
<docker.base-image>jboss/wildfly:20.0.1.Final</docker.base-image>
<docker.target-image-name>apiman/on-wildfly:latest</docker.target-image-name>
- <docker.target-image-name.alias>wildfly-master</docker.target-image-name.alias>
</properties>
<dependencies>
<artifactId>apiman-distro-tools</artifactId>
<version>${project.version}</version>
<type>zip</type>
- </dependency><!-- Keycloak -->
+ </dependency>
+ <!-- Keycloak -->
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-server-overlay</artifactId>
<images>
<image>
<name>${docker.target-image-name}</name>
- <alias>${docker.target-image-name.alias}</alias>
+ <alias>${git.commit.id}</alias>
<build>
<dockerFileDir>${project.basedir}/src/main/docker</dockerFileDir>
<assembly>
</inline>
</assembly>
<tags>
- <tag>wildfly-master</tag>
+ <tag>${git.commit.id}</tag>
</tags>
</build>
<run>

MODIFY
fastbuild.sh
fastbuild.sh
-#!/usr/bin/bash
+#!/bin/bash
set -o nounset
set -o errtrace
set -e
set -x
-
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
export MVN=
@@ -23,7 +22,7 @@ cd $SCRIPT_DIR
cd parent
$MVN clean install
cd $SCRIPT_DIR
-$MVN clean install -DskipTests -Dmaven.javadoc.skip -nsu -Pinstall-all-wildfly
+$MVN clean install -DskipTests -Dmaven.javadoc.skip -nsu -Pinstall-all-wildfly -Pdocker
echo "Done"

MODIFY
manager/ui/war/ci/docker-compose.yml
manager/ui/war/ci/docker-compose.yml
version: "3.9"
services:
+ reverse-proxy:
+ image: traefik:v2.5
+ container_name: traefik
+ command: --providers.docker --entrypoints.http.address=:8080 --log.level=DEBUG
+ ports:
+ - "8877:8080"
+ volumes:
+ - /var/run/docker.sock:/var/run/docker.sock
+
keycloak:
+ container_name: keycloak
image:
- quay.io/keycloak/keycloak:13.0.0
- ports:
- - "8081:8080"
- - "8444:8443"
+ quay.io/keycloak/keycloak:15.0.2
environment:
KEYCLOAK_USER: admin
KEYCLOAK_PASSWORD: admin123!
KEYCLOAK_IMPORT: /tmp/apiman-realm-for-keycloak.json
- KEYCLOAK_FRONTEND_URL: http://${HOSTNAME}:2772/auth
+ KEYCLOAK_FRONTEND_URL: http://${HOSTNAME}:8877/auth
PROXY_ADDRESS_FORWARDING: 'true'
# KEYCLOAK_LOGLEVEL: DEBUG
volumes:
- ${PWD}/apiman-realm-for-keycloak.json:/tmp/apiman-realm-for-keycloak.json
+ labels:
+ - traefik.enable=true
+ - traefik.http.routers.keycloak.rule=Host(`${HOSTNAME}`)
+ - traefik.http.routers.keycloak.entrypoints=http
+ - traefik.http.routers.keycloak.rule=PathPrefix(`/auth`)
+ - traefik.http.routers.keycloak.service=keycloak-service
+ - traefik.http.services.keycloak-service.loadbalancer.server.port=8080
+
apiman:
- image:
- apiman/on-wildfly:wildfly-master
- ports:
- - "8085:8080"
+ container_name: apiman
+ image: ${APIMAN_IMAGE_ID}
+ # ports:
+ # - "8085:8080"
depends_on:
- keycloak
environment:
- APIMAN_AUTH_URL: http://${HOSTNAME}:2772/auth
+ APIMAN_AUTH_URL: http://keycloak:8080/auth
+ labels:
+ - traefik.enable=true
+ # Apiman UI
+ - traefik.http.routers.apiman-ui.rule=Host(`${HOSTNAME}`)
+ - traefik.http.routers.apiman-ui.entrypoints=http
+ - traefik.http.routers.apiman-ui.rule=PathPrefix(`/apimanui`)
+ - traefik.http.routers.apiman-ui.service=apiman-ui-service
+ - traefik.http.services.apiman-ui-service.loadbalancer.server.port=8080
+ # Apiman Manager API
+ - traefik.http.routers.apiman-api.rule=Host(`${HOSTNAME}`)
+ - traefik.http.routers.apiman-api.entrypoints=http
+ - traefik.http.routers.apiman-api.rule=PathPrefix(`/apiman`)
+ - traefik.http.routers.apiman-api.service=apiman-api-service
+ - traefik.http.services.apiman-api-service.loadbalancer.server.port=8080
+ # Apiman Gateway
+ - traefik.http.routers.apiman-gateway.rule=Host(`${HOSTNAME}`)
+ - traefik.http.routers.apiman-gateway.entrypoints=http
+ - traefik.http.routers.apiman-gateway.rule=PathPrefix(`/apiman-gateway`)
+ - traefik.http.routers.apiman-gateway.service=apiman-gateway-service
+ - traefik.http.services.apiman-gateway-service.loadbalancer.server.port=8080
+ # Apiman Gateway API
+ - traefik.http.routers.apiman-gateway-api.rule=Host(`${HOSTNAME}`)
+ - traefik.http.routers.apiman-gateway-api.entrypoints=http
+ - traefik.http.routers.apiman-gateway-api.rule=PathPrefix(`/apiman-gateway-api`)
+ - traefik.http.routers.apiman-gateway-api.service=apiman-gateway-api-service
+ - traefik.http.services.apiman-gateway-api-service.loadbalancer.server.port=8080
+
+# networks:
+# proxy:
+# external: false

MODIFY
manager/ui/war/ci/run-e2e.sh
manager/ui/war/ci/run-e2e.sh
set -x -e
export HOSTNAME
-export KEYCLOAK_VERSION
+export APIMAN_IMAGE_ID
-HOSTNAME=$(hostname)
-KEYCLOAK_VERSION=13.0.0
+#HOSTNAME=$(hostname)
+HOSTNAME=localhost
+APIMAN_IMAGE_ID="apiman/on-wildfly:$(git rev-parse HEAD)"
# Latest 12.x version that we have in the POM is not working properly with all of our docker settings. Use this when it does...
#$(mvn -q -Dexec.executable="echo" -Dexec.args='${version.org.keycloak}' --non-recursive exec:exec -f ../../../pom.xml)
-GULP_PS=
cleanup () {
- echo "Cleaning up Gulp and Docker..."
- pkill -TERM -P "$GULP_PS"
+ echo "Cleaning up Docker compose..."
docker-compose down -v --remove-orphans
}
trap cleanup ERR EXIT
-# The CI gulpfile is run from directory above because it extends the original file and we want to avoid complications with
-# path handling. This adds a few proxy routes so that Cypress does not complain about mixed origins.
-# It uses the UI from the docker container rather than the local version, so just be aware of that.
-yarn run gulp --gulpfile gulpfileCI.js &
-
-## Save gulp PID so we can kill it later during cleanup
-GULP_PS=$!
-echo "Gulp process ID is: $GULP_PS"
-
# Start docker container from latest local docker to give us a backend. Daemon mode, so will need to clean up later.
docker-compose up -d
# We need to figure out when the backend is actually available, so we use this handy 'wait-on' status utility.
# Check out `waitOnConfig.js` for username and password injection.
-yarn run wait-on -v -d 15000 -t 300000 -c waitOnConfig.js "http://$HOSTNAME:2772/apiman/system/status"
+yarn run wait-on -v -d 15000 -t 300000 -c waitOnConfig.js "http://$HOSTNAME:8877/apiman/system/status"
# If CI env var set, use record mode and export to Cypress dashboard.
if [[ -n $CI ]]
then
- yarn cy:run --record --config baseUrl="http://$HOSTNAME:2772/apimanui/,retries=3,defaultCommandTimeout=10000"
+ yarn cy:run --record --config baseUrl="http://$HOSTNAME:8877/apimanui/,retries=3,defaultCommandTimeout=10000"
else
- yarn cy:run --config baseUrl="http://$HOSTNAME:2772/apimanui/,retries=3,defaultCommandTimeout=10000"
+ yarn cy:run --config baseUrl="http://$HOSTNAME:8877/apimanui/,retries=3,defaultCommandTimeout=10000"
fi
\ No newline at end of file

MODIFY
manager/ui/war/yarn.lock
manager/ui/war/yarn.lock
@@ -1109,9 +1109,9 @@ camel-case@^4.1.1:
tslib "^2.0.3"
caniuse-lite@^1.0.30001264:
- version "1.0.30001265"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001265.tgz#0613c9e6c922e422792e6fcefdf9a3afeee4f8c3"
- integrity sha512-YzBnspggWV5hep1m9Z6sZVLOt7vrju8xWooFAgN6BA5qvy98qPAPb7vNUzypFaoh2pb3vlfzbDO8tB57UPGbtw==
+ version "1.0.30001278"
+ resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001278.tgz"
+ integrity sha512-mpF9KeH8u5cMoEmIic/cr7PNS+F5LWBk0t2ekGT60lFf0Wq+n9LspAj0g3P+o7DQhD3sUdlMln4YFAWhFYn9jg==
caseless@~0.12.0:
version "0.12.0"

MODIFY
pom.xml
pom.xml
<goals>
<goal>revision</goal>
</goals>
+ <phase>initialize</phase>
</execution>
</executions>
<configuration>
+ <injectAllReactorProjects>true</injectAllReactorProjects>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<dateFormat>yyyy-MM-dd'T'HH:mm:ss'Z'</dateFormat>
<dateFormatTimeZone>UTC</dateFormatTimeZone>
<verbose>false</verbose>
<generateGitPropertiesFile>false</generateGitPropertiesFile>
- <skipPoms>true</skipPoms>
+ <skipPoms>false</skipPoms>
<injectAllReactorProjects>false</injectAllReactorProjects>
<failOnNoGitDirectory>false</failOnNoGitDirectory>
<failOnUnableToExtractRepoInfo>false</failOnUnableToExtractRepoInfo>

ci: use Traefik proxy server to manage CI compose setup

ci: tag latest docker image build with git commit ID to remove any ambiguity