From d3d95e97199c34f0539f697969d08bf1dc3ba4b3 Mon Sep 17 00:00:00 2001 From: aurea munoz Date: Wed, 18 Sep 2019 11:55:02 +0200 Subject: [PATCH] feat: demo recording --- README.md | 5 ++ demo/play-demo.sh | 182 ++++++++++++++++++++++++++++++++++++++++++++++ demo/playdemo.md | 16 ++++ 3 files changed, 203 insertions(+) create mode 100755 demo/play-demo.sh create mode 100644 demo/playdemo.md diff --git a/README.md b/README.md index 9d92df7..eddcb68 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,11 @@ kubectl get ingress/hello-world Copy/paste the address displayed within the terminal in a browser and say Hello world 😉 +## Demonstration + +The following demonstration provides an overview of `hal`: + +[![asciicast](https://asciinema.org/a/TuqtFWyLA3YL97NxQEpk2qwvI.png)](https://asciinema.org/a/TuqtFWyLA3YL97NxQEpk2qwvI) ## Additional documentation diff --git a/demo/play-demo.sh b/demo/play-demo.sh new file mode 100755 index 0000000..8469f25 --- /dev/null +++ b/demo/play-demo.sh @@ -0,0 +1,182 @@ +#!/bin/bash + +#asciinema rec -w 2 & + +exec() { + echo "\$ $@"|pv -qL 20 ; "$@" ; + } + +echo " " +echo " " +echo " Simplify the deployment of Spring Boot applications using Halkyon Component Operator on Kubernetes"|pv -qL 30 +echo " In this demo, we will :"|pv -qL 20 +echo " --> Compose & link microservices"|pv -qL 20 +echo " --> Deploy a capability such as a database and link it to a microservice consuming it"|pv -qL 20 +echo " --> Code locally and next push/build on k8s/OpenShift"|pv -qL 20 +echo " "|pv -qL 20 +echo " Ready? Let's start!"|pv -qL 20 +echo " " +echo " " +sleep 3 + +clear && sleep 1 +echo "# Log on to the cluster using the oc client"|pv -qL 20 +#exec oc login https://api.cluster-b1c8.b1c8.sandbox941.opentlc.com:6443 -u user1 -p r3dh4t1! +exec oc login https://api.cluster-6c2c.6c2c.sandbox1254.opentlc.com:6443 -u user1 -p r3dh4t1! +sleep 3 + +clear && sleep 1 +echo "# Create a new project"|pv -qL 20 +exec oc new-project demo +sleep 3 + +clear && sleep 1 +echo "# Create a directory named demo and subsequently enter in"|pv -qL 20 +exec mkdir demo +exec cd demo +sleep 3 + +clear && sleep 1 +echo "# Create a pom.xml with the following content"|pv -qL 20 +sleep 1 +echo " + + + 4.0.0 + me.fruitsand + parent + 1.0.0-SNAPSHOT + Spring Boot - Demo + Spring Boot - Demo + pom + + fruit-backend-sb + fruit-client-sb + +" +sleep 3 +cat > pom.xml << ENDOFFILE + + + + 4.0.0 + me.fruitsand + parent + 1.0.0-SNAPSHOT + Spring Boot - Demo + Spring Boot - Demo + pom + + fruit-backend-sb + fruit-client-sb + + +ENDOFFILE +clear && sleep 1 +echo "# Create a new client project using the REST HTTP client template proposed by the scaffolding tool"|pv -qL 20 +exec hal component spring-boot -i fruit-client-sb -g me.fruitstand -p me.fruitstand.demo -s 2.1.6.RELEASE -t client -v 1.0.0-SNAPSHOT --supported=false fruit-client-sb +sleep 3 + +clear && sleep 1 +echo "# Create a backend project interactively and use as template the crud type and fruit-backend-sb as maven project name"|pv -qL 20 +exec hal component spring-boot fruit-backend-sb +sleep 3 + +clear && sleep 1 +echo "# Build the projects"|pv -qL 20 +echo "# Compile and generate the uber jar of the Spring Boot application client"|pv -qL 20 +exec mvn package -f fruit-client-sb +sleep 3 + +clear && sleep 1 +echo "# Repeat the command executed previously for the CRUD - backend microservice."|pv -qL 20 +echo "# We need to use the kubernetes profile because the project is set up to work both locally using H2 database for quick testing and "remotely" using a PostgreSQL database."|pv -qL 20 +exec mvn package -f fruit-backend-sb -Pkubernetes +sleep 3 + +clear && sleep 1 +echo "# Deploy the applications as components"|pv -qL 20 +exec hal component push -c fruit-client-sb,fruit-backend-sb +sleep 3 + +clear && sleep 1 +echo "# Check if the components have been correctly installed"|pv -qL 20 +exec oc get cp +sleep 3 + +clear && sleep 1 +echo "# Create a capability to install a PostgreSQL database using the interactive mode"|pv -qL 20 +exec hal capability create +sleep 3 + +clear && sleep 1 +echo "# Check the capability status"|pv -qL 20 +exec oc get capabilities +sleep 3 + +clear && sleep 1 +echo "# Link the microservices"|pv -qL 20 +echo "# We need to wire the fruit-backend-sb component with the postgres-db capability by creating a link between both"|pv -qL 20 +exec hal link create +sleep 3 + +clear && sleep 1 +echo "# Now, create a link targeting the fruit-client-sb component to wire the client and backend"|pv -qL 20 +exec hal link create +sleep 3 + +clear && sleep 1 +echo "# Check the link status"|pv -qL 20 +exec oc get links +sleep 3 + +clear && sleep 1 +echo "# Try the backend service to see if it works"|pv -qL 20 +echo "# So, get the route address of the backend microservice using this command "|pv -qL 20 +exec oc get routes/fruit-backend-sb --template={{.spec.host}} +echo " " +sleep 2 +echo "# Copy/paste the address displayed within the terminal in a browser and create some fruits ;-)"|pv -qL 20 +sleep 10 + +clear && sleep 1 +echo "# Try the client microservice to see if it works too"|pv -qL 20 +echo "# So, get also its route address "|pv -qL 20 +exec oc get routes/fruit-client-sb --template={{.spec.host}} +sleep 3 + +clear && sleep 1 +echo "# curl the service within your terminal, you should get the fruits created in the previous step."|pv -qL 20 +exec curl "http://$(oc get routes/fruit-client-sb --template={{.spec.host}})/api/client" + +# https://asciinema.org/a/TuqtFWyLA3YL97NxQEpk2qwvI \ No newline at end of file diff --git a/demo/playdemo.md b/demo/playdemo.md new file mode 100644 index 0000000..56f248e --- /dev/null +++ b/demo/playdemo.md @@ -0,0 +1,16 @@ +## How to record the scenario execution +### Introduction +We use `asciinema` tool to record the scenario, so the first step consist of [installing this tool](https://asciinema.org/docs/getting-started). + +In order to simulate the writing by hand of commands we use the `pv`, a tool for monitoring the progress of data through a pipe. So, proceed to install it: +``` +brew install pv +``` +### Instructions +- Launch the recording by running `asciinema rec` you start a new recording session. +If you want to shrink "long time of nothing" then you can use the `-w` switch, i.e. `asciinema rec -w 2` +Recording finishes when you exit the shell (hit Ctrl+D or type `exit`) + +- Launch the script who plays the demo `./demo/play-demo.sh ` + +Once the demo is over, asciinema will display the url where the video is available \ No newline at end of file