Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using Quinoa for UI backend, rather than Node.js + express #297

Merged
merged 11 commits into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 4 additions & 195 deletions .github/workflows/build-push-container-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ jobs:
- rest-fights
- rest-heroes
- rest-villains
- ui-super-heroes
arch:
- amd64
- arm64
Expand Down Expand Up @@ -118,6 +119,7 @@ jobs:
- rest-fights
- rest-heroes
- rest-villains
- ui-super-heroes
arch:
- amd64
- arm64
Expand Down Expand Up @@ -187,71 +189,11 @@ jobs:
with:
image: "${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.CONTAINER_TAG }}-${{ matrix.arch }}"

build-ui-images:
if: ((github.event_name == 'workflow_dispatch') || ((github.event_name == 'workflow_run') && ((github.event.workflow_run.event == 'push') || (github.event.workflow_run.event == 'workflow_dispatch')) && (github.event.workflow_run.conclusion == 'success'))) && ((github.repository == 'quarkusio/quarkus-super-heroes') && ((github.event.workflow_run.head_branch == 'main')))
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- amd64
- arm64
steps:
- name: Calculate Branch (workflow_run event)
if: github.event_name == 'workflow_run'
run: |
echo "REF=${{ github.event.workflow_run.head_commit.id }}" >> $GITHUB_ENV
echo "BRANCH=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV

- name: Calculate Branch (workflow_dispatch event)
if: github.event_name == 'workflow_dispatch'
run: |
echo "REF=${{ github.sha }}" >> $GITHUB_ENV
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV

- name: Checkout from ${{ env.REF }}
uses: actions/checkout@v3
with:
ref: ${{ env.REF }}

- name: Set up QEMU
if: matrix.arch == 'arm64'
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true

- name: Create container tag (main branch)
if: env.BRANCH == 'main'
run: echo "CONTAINER_TAG=${{ env.LATEST_IMAGE_TAG }}-${{ matrix.arch }}" >> $GITHUB_ENV

- name: Create container tag (other branch)
if: env.BRANCH != 'main'
run: echo "CONTAINER_TAG=${{ env.LATEST_IMAGE_TAG }}-${{ env.BRANCH }}-${{ matrix.arch }}" >> $GITHUB_ENV

- name: Build UI image (${{ matrix.arch }})
uses: docker/build-push-action@v4
with:
context: ui-super-heroes
platforms: linux/${{ matrix.arch }}
push: false
load: true
tags: ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.CONTAINER_TAG }}

- name: Save UI image (${{ matrix.arch }})
uses: ishworkh/docker-image-artifact-upload@v1
with:
image: "${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.CONTAINER_TAG }}"

push-app-images:
if: ((github.event_name == 'workflow_dispatch') || ((github.event_name == 'workflow_run') && ((github.event.workflow_run.event == 'push') || (github.event.workflow_run.event == 'workflow_dispatch')) && (github.event.workflow_run.conclusion == 'success'))) && ((github.repository == 'quarkusio/quarkus-super-heroes') && ((github.event.workflow_run.head_branch == 'main')))
needs:
- build-jvm-images
- build-native-images
- build-ui-images
runs-on: ubuntu-latest
strategy:
matrix:
Expand All @@ -265,6 +207,7 @@ jobs:
- rest-fights
- rest-heroes
- rest-villains
- ui-super-heroes
arch:
- amd64
- arm64
Expand Down Expand Up @@ -350,77 +293,6 @@ jobs:
working-directory: ${{ matrix.project }}
run: "docker push -a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}"

push-ui-images:
if: ((github.event_name == 'workflow_dispatch') || ((github.event_name == 'workflow_run') && ((github.event.workflow_run.event == 'push') || (github.event.workflow_run.event == 'workflow_dispatch')) && (github.event.workflow_run.conclusion == 'success'))) && ((github.repository == 'quarkusio/quarkus-super-heroes') && ((github.event.workflow_run.head_branch == 'main')))
needs:
- build-jvm-images
- build-native-images
- build-ui-images
runs-on: ubuntu-latest
strategy:
matrix:
arch:
- amd64
- arm64
steps:
- name: Calculate Branch (workflow_run event)
if: github.event_name == 'workflow_run'
run: |
echo "REF=${{ github.event.workflow_run.head_commit.id }}" >> $GITHUB_ENV
echo "BRANCH=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV

- name: Calculate Branch (workflow_dispatch event)
if: github.event_name == 'workflow_dispatch'
run: |
echo "REF=${{ github.sha }}" >> $GITHUB_ENV
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV

- name: Checkout from ${{ env.REF }}
uses: actions/checkout@v3
with:
ref: ${{ env.REF }}

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: maven

- name: Create env vars (main branch)
if: env.BRANCH == 'main'
working-directory: ui-super-heroes
run: |
echo "CONTAINER_TAG=${{ env.LATEST_IMAGE_TAG }}-${{ matrix.arch }}" >> $GITHUB_ENV &&
echo "APP_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV

- name: Create env vars (other branch)
if: env.BRANCH != 'main'
working-directory: ui-super-heroes
run: |
echo "CONTAINER_TAG=${{ env.LATEST_IMAGE_TAG }}-${{ env.BRANCH }}-${{ matrix.arch }}" >> $GITHUB_ENV &&
echo "APP_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)-${{ env.BRANCH }}" >> $GITHUB_ENV

- name: Get Saved UI Image (${{ matrix.arch }})
uses: ishworkh/docker-image-artifact-download@v1
with:
image: "${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.CONTAINER_TAG }}"

- name: Login to quay
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_REPO_USERNAME }}
password: ${{ secrets.QUAY_REPO_TOKEN }}

- name: Tag UI image (${{ matrix.arch }})
working-directory: ui-super-heroes
run: docker tag ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.CONTAINER_TAG }} ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.APP_VERSION }}-${{ matrix.arch }}

- name: Push UI image (${{ matrix.arch }})
working-directory: ui-super-heroes
run: "docker push -a ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes"

create-app-multiarch-manifests:
holly-cummins marked this conversation as resolved.
Show resolved Hide resolved
if: ((github.event_name == 'workflow_dispatch') || ((github.event_name == 'workflow_run') && ((github.event.workflow_run.event == 'push') || (github.event.workflow_run.event == 'workflow_dispatch')) && (github.event.workflow_run.conclusion == 'success'))) && ((github.repository == 'quarkusio/quarkus-super-heroes') && ((github.event.workflow_run.head_branch == 'main')))
needs: push-app-images
Expand All @@ -437,6 +309,7 @@ jobs:
- rest-fights
- rest-heroes
- rest-villains
- ui-super-heroes
name: Create app multiarch manifests (${{ matrix.project }}-${{ matrix.kind }}java${{ matrix.java }})
steps:
- name: Calculate Branch (workflow_run event)
Expand Down Expand Up @@ -518,73 +391,10 @@ jobs:
-a ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.ADDITIONAL_TAG }}-arm64
docker manifest push ${{ env.IMAGE_BASE_NAME }}/${{ matrix.project }}:${{ env.ADDITIONAL_TAG }}

create-ui-multiarch-manifests:
if: ((github.event_name == 'workflow_dispatch') || ((github.event_name == 'workflow_run') && ((github.event.workflow_run.event == 'push') || (github.event.workflow_run.event == 'workflow_dispatch')) && (github.event.workflow_run.conclusion == 'success'))) && ((github.repository == 'quarkusio/quarkus-super-heroes') && ((github.event.workflow_run.head_branch == 'main')))
needs: push-ui-images
runs-on: ubuntu-latest
steps:
- name: Calculate Branch (workflow_run event)
if: github.event_name == 'workflow_run'
run: |
echo "REF=${{ github.event.workflow_run.head_commit.id }}" >> $GITHUB_ENV
echo "BRANCH=${{ github.event.workflow_run.head_branch }}" >> $GITHUB_ENV

- name: Calculate Branch (workflow_dispatch event)
if: github.event_name == 'workflow_dispatch'
run: |
echo "REF=${{ github.sha }}" >> $GITHUB_ENV
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV

- name: Checkout from ${{ env.REF }}
uses: actions/checkout@v3
with:
ref: ${{ env.REF }}

- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
cache: maven

- name: Create env vars (main branch)
if: env.BRANCH == 'main'
working-directory: ui-super-heroes
run: |
echo "CONTAINER_TAG=${{ env.LATEST_IMAGE_TAG }}" >> $GITHUB_ENV &&
echo "APP_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV

- name: Create env vars (other branch)
if: env.BRANCH != 'main'
working-directory: ui-super-heroes
run: |
echo "CONTAINER_TAG=${{ env.LATEST_IMAGE_TAG }}-${{ env.BRANCH }}" >> $GITHUB_ENV &&
echo "APP_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)-${{ env.BRANCH }}" >> $GITHUB_ENV

- name: Login to quay
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_REPO_USERNAME }}
password: ${{ secrets.QUAY_REPO_TOKEN }}

- name: Create and push multi-arch manifests
shell: bash
run: |
docker manifest create ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.CONTAINER_TAG }} \
-a ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.CONTAINER_TAG }}-amd64 \
-a ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.CONTAINER_TAG }}-arm64
docker manifest push ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.CONTAINER_TAG }}
docker manifest create ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.APP_VERSION }} \
-a ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.APP_VERSION }}-amd64 \
-a ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.APP_VERSION }}-arm64
docker manifest push ${{ env.IMAGE_BASE_NAME }}/ui-super-heroes:${{ env.APP_VERSION }}

deploy-resources-workflow-run:
if: ((github.event_name == 'workflow_run') && ((github.event.workflow_run.event == 'push') || (github.event.workflow_run.event == 'workflow_dispatch')) && (github.event.workflow_run.conclusion == 'success') && (github.repository == 'quarkusio/quarkus-super-heroes')) && ((github.event.workflow_run.head_branch == 'main'))
needs:
- create-app-multiarch-manifests
- create-ui-multiarch-manifests
uses: quarkusio/quarkus-super-heroes/.github/workflows/create-deploy-resources.yml@main
secrets: inherit
with:
Expand All @@ -595,7 +405,6 @@ jobs:
if: ((github.event_name == 'workflow_dispatch') && (github.repository == 'quarkusio/quarkus-super-heroes')) && ((github.ref_name == 'main'))
needs:
- create-app-multiarch-manifests
- create-ui-multiarch-manifests
uses: quarkusio/quarkus-super-heroes/.github/workflows/create-deploy-resources.yml@main
secrets: inherit
with:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build-push-ui-images.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Build and push UI image
# Note: this is not used on main, but needs to be on the default branch so it can be manually triggered

env:
LATEST_IMAGE_TAG: "latest"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/simple-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
- rest-fights
- rest-heroes
- rest-villains
- ui-super-heroes
name: "build-test-${{ matrix.project }}-${{ matrix.java }}"
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -88,6 +89,7 @@ jobs:
- rest-fights
- rest-heroes
- rest-villains
- ui-super-heroes
name: "native-build-test-${{ matrix.project }}"
steps:
- uses: actions/checkout@v3
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The base JVM version for all the applications is Java 17.

- [Super Hero Battle UI](ui-super-heroes)
- An Angular application to pick up a random superhero, a random supervillain, and makes them fight.
- Served with [Quarkus Quinoa](https://quarkiverse.github.io/quarkiverse-docs/quarkus-quinoa/dev/index.html)
- [Villain REST API](rest-villains)
- A classical HTTP microservice exposing CRUD operations on Villains, stored in a PostgreSQL database.
- Implemented with blocking endpoints using [RESTEasy Reactive](https://quarkus.io/guides/resteasy-reactive) and [Quarkus Hibernate ORM with Panache's active record pattern](https://quarkus.io/guides/hibernate-orm-panache).
Expand Down
4 changes: 2 additions & 2 deletions deploy/docker-compose/native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ services:
memory: 256M
cpus: '0.5'

ui-super-heroes:
image: quay.io/quarkus-super-heroes/ui-super-heroes:latest
ui-super-heroes-native:
image: quay.io/quarkus-super-heroes/ui-super-heroes:native-latest
container_name: ui-super-heroes
ports:
- "8080:8080"
Expand Down
4 changes: 2 additions & 2 deletions deploy/k8s/java17-knative.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ metadata:
app: ui-super-heroes
application: super-heroes
system: quarkus-super-heroes
app.openshift.io/runtime: nodejs
app.openshift.io/runtime: quarkus
app.kubernetes.io/part-of: super-heroes
app.kubernetes.io/name: ui-super-heroes
name: ui-super-heroes
Expand All @@ -1050,7 +1050,7 @@ spec:
app: ui-super-heroes
application: super-heroes
system: quarkus-super-heroes
app.openshift.io/runtime: nodejs
app.openshift.io/runtime: quarkus
app.kubernetes.io/part-of: super-heroes
app.kubernetes.io/name: ui-super-heroes
spec:
Expand Down
2 changes: 1 addition & 1 deletion deploy/k8s/java17-kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ metadata:
app: ui-super-heroes
application: super-heroes
system: quarkus-super-heroes
app.openshift.io/runtime: nodejs
app.openshift.io/runtime: quarkus
app.kubernetes.io/part-of: super-heroes
annotations:
app.openshift.io/connects-to: rest-fights
Expand Down
2 changes: 1 addition & 1 deletion deploy/k8s/java17-minikube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ metadata:
app: ui-super-heroes
application: super-heroes
system: quarkus-super-heroes
app.openshift.io/runtime: nodejs
app.openshift.io/runtime: quarkus
app.kubernetes.io/part-of: super-heroes
annotations:
app.openshift.io/connects-to: rest-fights
Expand Down
2 changes: 1 addition & 1 deletion deploy/k8s/java17-openshift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,7 @@ metadata:
app: ui-super-heroes
application: super-heroes
system: quarkus-super-heroes
app.openshift.io/runtime: nodejs
app.openshift.io/runtime: quarkus
app.kubernetes.io/part-of: super-heroes
annotations:
app.openshift.io/connects-to: rest-fights
Expand Down
4 changes: 2 additions & 2 deletions deploy/k8s/native-knative.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ metadata:
app: ui-super-heroes
application: super-heroes
system: quarkus-super-heroes
app.openshift.io/runtime: nodejs
app.openshift.io/runtime: quarkus
app.kubernetes.io/part-of: super-heroes
app.kubernetes.io/name: ui-super-heroes
name: ui-super-heroes
Expand All @@ -1050,7 +1050,7 @@ spec:
app: ui-super-heroes
application: super-heroes
system: quarkus-super-heroes
app.openshift.io/runtime: nodejs
app.openshift.io/runtime: quarkus
app.kubernetes.io/part-of: super-heroes
app.kubernetes.io/name: ui-super-heroes
spec:
Expand Down
2 changes: 1 addition & 1 deletion deploy/k8s/native-kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ metadata:
app: ui-super-heroes
application: super-heroes
system: quarkus-super-heroes
app.openshift.io/runtime: nodejs
app.openshift.io/runtime: quarkus
app.kubernetes.io/part-of: super-heroes
annotations:
app.openshift.io/connects-to: rest-fights
Expand Down
2 changes: 1 addition & 1 deletion deploy/k8s/native-minikube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ metadata:
app: ui-super-heroes
application: super-heroes
system: quarkus-super-heroes
app.openshift.io/runtime: nodejs
app.openshift.io/runtime: quarkus
app.kubernetes.io/part-of: super-heroes
annotations:
app.openshift.io/connects-to: rest-fights
Expand Down
2 changes: 1 addition & 1 deletion deploy/k8s/native-openshift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,7 @@ metadata:
app: ui-super-heroes
application: super-heroes
system: quarkus-super-heroes
app.openshift.io/runtime: nodejs
app.openshift.io/runtime: quarkus
app.kubernetes.io/part-of: super-heroes
annotations:
app.openshift.io/connects-to: rest-fights
Expand Down
Loading