Please see the Github Pages Site for complete documentation: quarkuscoffeeshop.github.io
- OCP4 ACM Hub
- OCP4 ACM Managed
- OCP4 ACM Managed
$ curl -s "https://raw.githubusercontent.com/\
kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
$ sudo mv kustomize /usr/local/bin/
$ curl -OL https://raw.githubusercontent.com/tosin2013/postgres-operator/main/scripts/deploy-postgres-operator.sh
$ chmod +x deploy-postgres-operator.sh
$ ./deploy-postgres-operator.sh
./deploy-postgres-operator.sh [OPTION]
Options:
-d Add domain
-t OpenShift Token
-u Uninstall deployment
To deploy postgres-operator playbooks
./deploy-postgres-operator.sh -d ocp4.example.com -o sha-123456789
To Delete postgres-operator playbooks from OpenShift
./deploy-postgres-operator.sh -d ocp4.example.com -o sha-123456789 -u true
$ curl -OL https://raw.githubusercontent.com/quarkuscoffeeshop/quarkuscoffeeshop-ansible/dev/files/deploy-quarkuscoffeeshop-ansible.sh
$ chmod +x deploy-quarkuscoffeeshop-ansible.sh
$ cat >env.variables<<EOF
ACM_WORKLOADS=n
AMQ_STREAMS=y
CONFIGURE_POSTGRES=y
MONGODB_OPERATOR=n
MONGODB=n
HELM_DEPLOYMENT=n
EOF
$ ./deploy-quarkuscoffeeshop-ansible.sh -d ocp4.example.com -t sha-123456789 -p 123456789 -s ATLANTA
The script will provide the following workloads
- Gogs server
- OpenShift Pipelines
- OpenShift GitOps
- Quay.io
- AMQ Streams
- Postgres Template deployment
- homeoffice Tekton pipelines
- quarkus-coffeeshop Tekton pipelines
$ curl -OL https://raw.githubusercontent.com/quarkuscoffeeshop/quarkuscoffeeshop-ansible/dev/files/deploy-quarkuscoffeeshop-ansible.sh
$ chmod +x deploy-quarkuscoffeeshop-ansible.sh
$ cat >env.variables<<EOF
ACM_WORKLOADS=y
AMQ_STREAMS=y
CONFIGURE_POSTGRES=n
MONGODB_OPERATOR=n
MONGODB=n
HELM_DEPLOYMENT=n
EOF
$ ./deploy-quarkuscoffeeshop-ansible.sh -d ocp4.example.com -t sha-123456789 -p 123456789 -s ATLANTA
Run generated command on target machine
Login into hub cluster
oc login -u admin -p XXXX --insecure-skip-tls-verify https://api.YOURCLUSTER1.DOMAIN:6443
Set the name of the context for hub cluster
oc config rename-context $(oc config current-context) hubcluster
Login into 1st cluster (A environment)
oc login -u admin -p XXXX --insecure-skip-tls-verify https://api.YOURCLUSTER1.DOMAIN:6443
Set the name of the context for (A environment)
oc config rename-context $(oc config current-context) cluster1
Login into 2nd cluster (B environment) ::: OPTIONAL
oc login -u admin -p XXXX --insecure-skip-tls-verify https://api.YOURCLUSTER2.DOMAIN:6443
Set the name of the context (B environment)
oc config rename-context $(oc config current-context) cluster2
Login into 3rd cluster (C environment) ::: OPTIONAL
oc login -u admin -p XXXX --insecure-skip-tls-verify https://api.YOURCLUSTER3.DOMAIN:6443
Set the name of the context (C environment)
oc config rename-context $(oc config current-context) cluster3
# Switch to hub
oc config use-context hubcluster
# Switch to cluster1
oc config use-context cluster1
# List the nodes in cluster1
oc get nodes
# Switch to cluster2
oc config use-context cluster2
# List the nodes in cluster2
oc get nodes
# Switch to cluster3 ::: Optional
oc config use-context cluster3
# List the nodes in cluster3 ::: Optional
oc get nodes
# Switch back to cluster1
oc config use-context cluster1
From ACM Login to ACM Managed cluster (OCP4 ACM Hub)
Fork quarkuscoffeeshop-gitops github repo
Git clone your forked repo to server
Optional: Create a personal access token for forked repo Creating a personal access token
Update acm_configs/02_channel.yaml replace with your repo
pathname: 'https://github.com/quarkuscoffeeshop/quarkuscoffeeshop-gitops.git'
- imageTag is located under the kustomiztion.yaml in each directory
- enviornment varaibles are located in each directory under patch-env.yaml
$ echo "Cluster 1: $(oc --context=cluster1 get ingresses.config.openshift.io cluster -o jsonpath='{ .spec.domain }')"
$ ENDPOINT=$(oc --context=cluster1 get ingresses.config.openshift.io cluster -o jsonpath='{ .spec.domain }')
$ sed -i "s/apps.ocp4.example.com/${ENDPOINT}/g" clusters/overlays/cluster1/quarkuscoffeeshop-web/patch-env.yaml
$ cat clusters/overlays/cluster1/quarkuscoffeeshop-web/patch-env.yaml
$ sed -i "s/apps.ocp4.example.com/${ENDPOINT}/g" clusters/overlays/cluster1/quarkuscoffeeshop-customermocker/patch-env.yaml
$ cat clusters/overlays/cluster1/quarkuscoffeeshop-customermocker/patch-env.yaml
$ echo "Cluster 2: $(oc --context=cluster2 get ingresses.config.openshift.io cluster -o jsonpath='{ .spec.domain }')"
$ ENDPOINT=$(oc --context=cluster2 get ingresses.config.openshift.io cluster -o jsonpath='{ .spec.domain }')
$ sed -i "s/apps.ocp4.example.com/${ENDPOINT}/g" clusters/overlays/cluster2/quarkuscoffeeshop-web/patch-env.yaml
$ cat clusters/overlays/cluster2/quarkuscoffeeshop-web/patch-env.yaml
$ sed -i "s/apps.ocp4.example.com/${ENDPOINT}/g" clusters/overlays/cluster2/quarkuscoffeeshop-customermocker/patch-env.yaml
$ cat clusters/overlays/cluster2/quarkuscoffeeshop-customermocker/patch-env.yaml
$ echo "Cluster 3: $(oc --context=cluster3 get ingresses.config.openshift.io cluster -o jsonpath='{ .spec.domain }')"
$ ENDPOINT=$(oc --context=cluster3 get ingresses.config.openshift.io cluster -o jsonpath='{ .spec.domain }')
$ sed -i "s/apps.ocp4.example.com/${ENDPOINT}/g" clusters/overlays/cluster3/quarkuscoffeeshop-web/patch-env.yaml
$ cat clusters/overlays/cluster3/quarkuscoffeeshop-web/patch-env.yaml
$ sed -i "s/apps.ocp4.example.com/${ENDPOINT}/g" clusters/overlays/cluster3/quarkuscoffeeshop-customermocker/patch-env.yaml
$ cat clusters/overlays/cluster3/quarkuscoffeeshop-customermocker/patch-env.yaml
POSTGRES_CLUSTERONE='CHANGEPASSWORD'
POSTGRES_CLUSTERTWO='CHANGEPASSWORD'
POSTGRES_CLUSTERTHREE='CHANGEPASSWORD'
sed -i "s|'changepassword'|'${POSTGRES_CLUSTERONE}'|g" clusters/overlays/cluster1/quarkuscoffeeshop-counter/patch-env.yaml
cat clusters/overlays/cluster1/quarkuscoffeeshop-counter/patch-env.yaml
sed -i "s|'changepassword'|'${POSTGRES_CLUSTERTWO}'|g" clusters/overlays/cluster2/quarkuscoffeeshop-counter/patch-env.yaml
cat clusters/overlays/cluster2/quarkuscoffeeshop-counter/patch-env.yaml
sed -i "s|'changepassword'|'${POSTGRES_CLUSTERTHREE}'|g" clusters/overlays/cluster3/quarkuscoffeeshop-counter/patch-env.yaml
cat clusters/overlays/cluster3/quarkuscoffeeshop-counter/patch-env.yaml
cp clusters/overlays/cluster1/quarkuscoffeeshop-web/route.yaml.backup clusters/overlays/cluster1/quarkuscoffeeshop-web/route.yaml
cp clusters/overlays/cluster2/quarkuscoffeeshop-web/route.yaml.backup clusters/overlays/cluster2/quarkuscoffeeshop-web/route.yaml
cp clusters/overlays/cluster3/quarkuscoffeeshop-web/route.yaml.backup clusters/overlays/cluster3/quarkuscoffeeshop-web/route.yaml
# Define the variable of `ROUTE_CLUSTER1`
ROUTE_CLUSTER1=quarkuscoffeeshop-web-quarkuscoffeeshop-demo.$(oc --context=cluster1 get ingresses.config.openshift.io cluster -o jsonpath='{ .spec.domain }')
# Replace the value of changeme with `ROUTE_CLUSTER1` in the file `route.yaml`
sed -i "s/changeme/${ROUTE_CLUSTER1}/" clusters/overlays/cluster1/quarkuscoffeeshop-web/route.yaml
# Verify Change
cat clusters/overlays/cluster1/quarkuscoffeeshop-web/route.yaml
# Define the variable of `ROUTE_CLUSTER2`
ROUTE_CLUSTER2=quarkuscoffeeshop-web-quarkuscoffeeshop-demo.$(oc --context=cluster2 get ingresses.config.openshift.io cluster -o jsonpath='{ .spec.domain }')
# Replace the value of changeme with `ROUTE_CLUSTER2` in the file `route.yaml`
sed -i "s/changeme/${ROUTE_CLUSTER2}/" clusters/overlays/cluster2/quarkuscoffeeshop-web/route.yaml
# Verify Change
cat clusters/overlays/cluster2/quarkuscoffeeshop-web/route.yaml
# Define the variable of `ROUTE_CLUSTER3` ::: OPTIONAL
ROUTE_CLUSTER3=quarkuscoffeeshop-web-quarkuscoffeeshop-demo.$(oc --context=cluster3 get ingresses.config.openshift.io cluster -o jsonpath='{ .spec.domain }')
# Replace the value of changeme with `ROUTE_CLUSTER3` in the file `route.yaml` ::: OPTIONAL
sed -i "s/changeme/${ROUTE_CLUSTER3}/" clusters/overlays/cluster3/quarkuscoffeeshop-web/route.yaml
# Verify Change
cat clusters/overlays/cluster3/quarkuscoffeeshop-web/route.yaml
Cluster1
kustomize build clusters/overlays/cluster1 | less
Cluster2
kustomize build clusters/overlays/cluster2 | less
Cluster3
kustomize build clusters/overlays/cluster3 | less
Commit and push changes to Github
git add clusters/
git commit -m "Updating Variables for Deployment"
git push
Use context hubcluster
oc config use-context hubcluster
Quarkus Cafe Deployment on ACM using tekton pipelines
Create namespace for subscription
oc create -f acm-configs/01_namespace.yaml
Create a Channel
oc create -f acm-configs/02_channel.yaml
Create application
oc create -f acm-configs/03_application_webapp.yaml
Confirm Clusters are properly labeled
clusterid=cluster1
clusterid=cluster2
clusterid=cluster3
clusterid=...
Create placement rules
oc create -f acm-configs/04_placement_cluster1.yaml
oc create -f acm-configs/04_placement_cluster2.yaml
oc create -f acm-configs/04_placement_cluster3.yaml
Create subscription
oc create -f acm-configs/05_subscription_cluster1.yaml
oc create -f acm-configs/05_subscription_cluster2.yaml
oc create -f acm-configs/05_subscription_cluster3.yaml
cluster 1
oc config use-context cluster1
oc get pods -n quarkuscoffeeshop-demo
cluster 2
oc config use-context cluster1
oc get pods -n quarkuscoffeeshop-demo
cluster 3
oc config use-context cluster1
oc get pods -n quarkuscoffeeshop-demo
Test against cluster 1
ROUTE_CLUSTER1=quarkuscoffeeshop-web-quarkuscoffeeshop-demo.$(oc --context=cluster1 get ingresses.config.openshift.io cluster -o jsonpath='{ .spec.domain }')
echo http://$ROUTE_CLUSTER1/cafe
Test against cluster 2
ROUTE_CLUSTER2=quarkuscoffeeshop-web-quarkuscoffeeshop-demo.$(oc --context=cluster2 get ingresses.config.openshift.io cluster -o jsonpath='{ .spec.domain }')
echo http://$ROUTE_CLUSTER2/cafe
Test against cluster 3 ::: OPTIONAL
ROUTE_CLUSTER3=quarkuscoffeeshop-web-quarkuscoffeeshop-demo.$(oc --context=cluster3 get ingresses.config.openshift.io cluster -o jsonpath='{ .spec.domain }')
echo http://$ROUTE_CLUSTER3/cafe
- Add HAproxy Global load balancer support
- Ansible Tower ACM Integration
- Create Bootstrap Script