/microsweeper-quarkus

A graphical game running on a Quarkus backend

Primary LanguageJavaScript

Red Hat Microsweeper demo with Quarkus

This demo uses a number of cloud technologies to implement a simple game from the earlier days of computing: Minesweeper!

Screenshot

Technologies include:


# To run quarkus in dev mode (it will automatically use Quarkus' dev services to create a DB)
alias q='quarkus'
q dev

# To access the app, hit http://localhost:8080 

# To deploy and run quarkus application in an OpenShift cluster
# (Required Operators: SeviceBinding, Crunchy Postgres for Kubernetes)
oc project dev
q build --no-tests --clean -Dquarkus.kubernetes.deploy=true

# To clean up
oc delete all --selector=demo.redhat.com/name=microsweeper
oc delete postgresclusters.postgres-operator.crunchydata.com postgresql
oc delete servicebindings.binding.operators.coreos.com microsweeper-appservice-postgresql
  • This repo has PipelineAsCode integrated. Check this gist for details. For already bootstraped PAC, need to create a PAC repo only, like this tkn pac create repo.
# By default, a 'test' namespace/project need to be setup for PAC-based CI/CD
# To create a PAC Repository at test namespace executes the following command
oc apply -f boot/argocd/repository.yaml
  • The Service Binding Operator doc and this github issue provide more details for the RBAC requirements.
    (Bug: Not sure why need to have a clusterrolebinding for the user if it is not in a cluster-admin role)
# Required for end-user deployment (e.g. user1) 
oc adm policy add-cluster-role-to-user clusterworkloadresourcemappings.servicebinding.io-v1alpha3-admin user1

# Required for system deployment (e.g. PipelineAsCode with a service account: pipeline at test project/namespace)
oc adm policy add-cluster-role-to-user clusterworkloadresourcemappings.servicebinding.io-v1alpha3-admin system:serviceaccount:test:pipeline

# Alternatively
oc apply -f boot/argocd/rolebinding.yaml
# The OTLP exporter can be enabled by these configuration properties
# Note: dev mode only for this demo
%dev.quarkus.opentelemetry.enabled = true
%dev.quarkus.opentelemetry.tracer.exporter.otlp.endpoint = http://localhost:4317
# Issues: need to explicitly turn on builtin sampler 
%dev.quarkus.opentelemetry.tracer.sampler=on

# To facilitate the demo, copy these yaml configuation files from
#   https://github.com/rhtevan/quick-quarkus/tree/main/.container
# Start collector and jaeger containers in the same pod
podman play kube .container/otel.yaml

# To check the pod status
podman pod ps --ctr-names --ctr-status 

POD ID        NAME        STATUS      CREATED         INFRA ID      NAMES                                                     STATUS
861d58b636a4  otel        Running     26 seconds ago  4eaddf66e0ea  861d58b636a4-infra,otel-collector,otel-jaeger-all-in-one  running,running,running

# To access the Jaeger UI, hit http://localhost:16686

# OTLP exporter is enabled for Dev mode only, and to shutdown and clean up
podman pod rm --force otel
podman pod ps --ctr-names --ctr-status 

Date: 2023-9-9