tosin2013.quarkus_cafe_demo_role

Documentation

For full documentation, check out the Github Pages Site: quarkuscoffeeshop.github.io.

QuarkusCoffeeshop Installation

NOTE: Make sure you have Ansible installed. You can find the installation guide here.

The QuarkusCoffeeshop Ansible Role sets up a basic installation that includes the microservices for a coffee shop, the Crunchy PostgreSQL database, and AMQ Streams (Kafka).

This role will deploy a demo application that is event-driven, built with Quarkus, AMQ Streams (Kafka), and MongoDB. The application is deployed on OpenShift (Kubernetes). You can find the source code for the quarkuscoffeeshop on GitHub, along with support documentation here.

Requirements

  • An OpenShift Cluster version 4.12 or higher
  • Docker or Podman

Currently tested on:

  • OpenShift 4.12.2
  • OpenShift Pipelines: 1.9.0
  • AMQ Streams: 2.3.0-0odm
  • Postgres Operator: v5.3.0
  • OpenShift Quay: v3.8.1
  • OpenShift GitOps: v1.7.1

Quick Start

Set Environment Variables for Standard Deployment

Run this command to deploy the application on a single cluster with the services listed below:

  • AMQ Streams
  • Postgres Operator configuration
  • Quarkus Coffeeshop Helm deployment
$ cat >source.env<<EOF
CLUSTER_DOMAIN_NAME=clustername.example.com
TOKEN=sha256~XXXXXXXXXXXX
ACM_WORKLOADS=n
AMQ_STREAMS=y
CONFIGURE_POSTGRES=y
MONGODB_OPERATOR=n
MONGODB=n
HELM_DEPLOYMENT=y
DELETE_DEPLOYMENT=false
DEBUG=-v
EOF
$ podman run -it --env-file=./source.env quay.io/quarkuscoffeeshop/quarkuscoffeeshop-ansible:v4.12.1

Set Environment Variables for ACM Workloads

Services included:

  • Gogs server
  • OpenShift Pipelines
  • OpenShift GitOps
  • Quay.io
  • AMQ Streams
  • Postgres Template deployment
  • homeoffice Tekton pipelines
  • quarkus-coffeeshop Tekton pipelines
$ cat >source.env<<EOF
CLUSTER_DOMAIN_NAME=clustername.example.com
TOKEN=sha256~XXXXXXXXXXXX
ACM_WORKLOADS=y
AMQ_STREAMS=y
CONFIGURE_POSTGRES=y
HELM_DEPLOYMENT=n
DELETE_DEPLOYMENT=false
DEBUG=-v
EOF
$ podman run -it --env-file=./source.env quay.io/quarkuscoffeeshop/quarkuscoffeeshop-ansible:v4.12.1

Optional: Change Namespace for Helm Deployments

Default is quarkuscoffeeshop-demo.

$ cat >source.env<<EOF
CLUSTER_DOMAIN_NAME=clustername.example.com
TOKEN=sha256~XXXXXXXXXXXX
ACM_WORKLOADS=n
AMQ_STREAMS=y
CONFIGURE_POSTGRES=y
MONGODB_OPERATOR=n
MONGODB=n
HELM_DEPLOYMENT=y
NAMESPACE=changeme
DELETE_DEPLOYMENT=false
DEBUG=-v
EOF
$ podman run -it --env-file=./source.env quay.io/quarkuscoffeeshop/quarkuscoffeeshop-ansible:v4.12.1

Screenshots

quarkuscoffeeshop topology

quarkuscoffeeshop AMQ Kafka topics

Visit: quarkuscoffeeshop Web App Example quarkuscoffeeshop application

Usage

export ENDPOINT="quarkuscoffeeshop-web-quarkus-cafe-demo.apps.ocp4.example.com"
curl --request POST http://${ENDPOINT}/order \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
-d '{
    "beverages": [
        {"item": "COFFEE_WITH_ROOM", "name": "Mickey"},
        {"item": "CAPPUCCINO", "name": "Minnie"}
    ],
    "kitchenOrders": [
        {"item": "CAKEPOP", "name": "Mickey"},
        {"item": "CROISSANT", "name": "Minnie"}
    ]
}'

Developer Notes

To develop and modify the code, ensure you have:

  • An OpenShift Cluster version 4.10 or higher
  • Ansible installed on your machine
  • oc CLI installed
  • Ansible community.kubernetes module installed via ansible-galaxy collection install community.kubernetes
  • Helm binary installed
  • Postgres Operator for Quarkus CoffeeShop 5.0.1-SNAPSHOT Deployments
  • pip3 installed

Role Variables

Type Description Default Value
deployment_method Docker or s2i build docker
skip_amq_install Skip Red Hat AMQ Install false
skip_mongodb_operator_install Skip MongoDB Operator Install false
single_mongodb_install Skip single instance MongoDB false
skip_quarkuscoffeeshop_helm_install Skip Quarkus Coffeeshop Helm chart install false
openshift_token OpenShift login token 123456789
openshift_url OpenShift target URL https://master.example.com
project_namespace OpenShift Project name for Quarkus Coffee Shop quarkus-cafe-demo
insecure_skip_tls_verify Skip insecure TLS verify true
default_owner Default owner of template files root
default_group Default group of template files root
delete_deployment Delete the deployment and project for Quarkus Coffee Shop false
amqstartingCSV Red Hat AMQ CSV version amqstreams.v1.6.1
mongodbstartingCSV MongoDB Ops Manager version mongodb-enterprise.v1.8.0
config_location Default location for application templates "/tmp/"
version_barista Default container barista tag 5.0.0-SNAPSHOT
version_counter Default container counter tag 5.0.1-SNAPSHOT
version_customermocker Default container customermocker tag 3.0.1
version_kitchen Default container kitchen tag 5.0.0-SNAPSHOT
version_web Default container web tag 5.0.1-SNAPSHOT
helm_chart_version Version of Quarkus Coffee Shop Helm Chart 3.4.4
pgsql_username Default PostgreSQL user coffeeshopadmin
postgres_password The PostgreSQL password used in deployment must be changed
pgsql_url Default PostgreSQL URL 'jdbc:postgresql://coffeeshopdb:5432/coffeeshopdb?currentSchema=coffeeshop'
storeid Store ID for web frontend RALEIGH
quarkus_log_level Quarkus coffee shop log level INFO
quarkuscoffeeshop_log_level Microservice log level DEBUG

Download the Deployment Script

To download the deploy-quarkuscoffeeshop-ansible.sh script:

$ curl -OL https://raw.githubusercontent.com/quarkuscoffeeshop/quarkuscoffeeshop-ansible/master/files/deploy-quarkuscoffeeshop-ansible.sh
$ chmod +x deploy-quarkuscoffeeshop-ansible.sh
$ ./deploy-quarkuscoffeeshop-ansible.sh -d ocp4.example.com -t sha-123456789 -p 123456789 -s ATLANTA

To Build Container Image

podman build -t quarkuscoffeeshop-ansible:v0.0.2 -f Dockerfile

Test Container

podman run -it --env-file=./source.env quarkuscoffeeshop-ansible:v0.0.2 bash

or

podman run -it --env-file=./source.env localhost/quarkuscoffeeshop-ansible:v0.0.2

Delete Old Containers

podman rm $(podman ps -a | grep Exited | awk '{print $1}')
podman rmi localhost/quarkuscoffeeshop-ansible:v0.0.2 

Troubleshooting

To force delete Kafka CRDs after a bad install:

oc get crds -o name | grep '.*\.strimzi\.io' | xargs -r -n 1 oc delete

To-Do

  • Manage Kubernetes (K8s) objects deployment example using Ansible.

License

This project is licensed under GPLv3.

Author Information

This role was created in 2020 by Tosin Akinosho.

Informazioni sul progetto

The quarkus-cafe-demo-role will deploy a event-driven demo application built with Quarkus, AMQ Streams (Kafka).

Installa
ansible-galaxy install tosin2013.quarkus_cafe_demo_role
Licenza
Unknown
Download
115
Proprietario
Associate Principal Solution Architect RedHat. Enthusiast in Cloud, DevOps, and AI. Specializing in AWS, GCP, Azure, Docker, Kubernetes, and Terraform.