https://paulhammant.com/2013/07/14/legacy-application-strangulation-case-studies/
- Strangle Monolith
- Add a Microservice
- And Another
- Squeeze Monolith
- And Remove Dead
- First, build and deploy the catalog microservice (Based on Spring Boot)
$ cd ~/coolstore
$ git clone -b app-partner https://github.com/epe105/catalog
$ cd catalog
Please update <USERNAME>
below with your assigned username
$ oc project coolstore-<USERNAME>
$ mvn clean fabric8:deploy -Popenshift -DskipTests
Once the new catalog service is deployed, test it with curl:
$ oc get route/catalog
NAME HOST/PORT PATH SERVICES PORT TERMINATION
catalog catalog-coolstore-<USERNAME>.apps.ocp.naps-redhat.com catalog 8080
Curl using the HOST/PORT from the previous step
$ curl http://catalog-coolstore--USERNAME>.apps.ocp.naps-redhat.com/api/catalog
[{"itemId":"329299","name":"Red Fedora","desc":"Official Red Hat Fedora","price":34.99},{"itemId":"329199","name":"Forge Laptop Sticker","desc":"JBoss Community Forge Project Sticker","price":8.5}
...
You can also test it by clicking on the route to the catalog service and adding /api/catalog to the URL:
Now we will do the same for the Inventory service, based on WildFly Swarm:
$ cd ~/coolstore
$ git clone -b app-partner https://github.com/epe105/inventory
$ cd inventory
Please update <USERNAME>
below with your assigned username
$ oc project coolstore-<USERNAME>
$ mvn clean fabric8:deploy -Popenshift -DskipTests
Once the new inventory service is deployed, dump its database:
Get the POSTGRESQL_PASSWORD
$ oc env dc/inventory-database --list # get the POSTGRESQL_PASSWORD
Get the postgresql pod
$ oc get pods
oc rsh into the postgresql pod from the previous step
$ oc rsh inventory-database-1-kkxs2
sh-4.2$ psql -h $HOSTNAME -d $POSTGRESQL_DATABASE -U $POSTGRESQL_USER
Password for user userV31:XXXXXXXX
psql (9.5.4)
Type "help" for help.
monolith=> select * from inventory;
itemid | link | location | quantity
--------+-----------------------------------+----------+----------
329299 | http://maps.google.com/?q=Raleigh | Raleigh | 736
...
Exit out of psql and then the postgresql pod
monolith=> \q
sh-4.2$ exit
exit
Once the new service is deployed, test it with curl
You should get a JSON object representing the inventory availability of product 329299
$ oc get route/inventory
NAME HOST/PORT PATH SERVICES PORT TERMINATION
inventory inventory-coolstore-<USERNAME>.apps.ocp.naps-redhat.com inventory 8080
$ curl http://inventory-coolstore-<USERNAME>.apps.ocp.naps-redhat.com/api/inventory/329299
{"itemId":"329299","location":"Raleigh","quantity":736,"link":"http://maps.google.com/?q=Raleigh"}
You can also test it by clicking on the route to the inventory service and adding /api/inventory/329299 to the URL
Once the new Microservices are deployed, this is the Architecture of this Lab