https://github.com/bugbiteme/catalog-spring-boot
catalog-spring-boot needed for OpenShift microservice application coolstore
https://github.com/bugbiteme/catalog-spring-boot
Last synced: about 1 year ago
JSON representation
catalog-spring-boot needed for OpenShift microservice application coolstore
- Host: GitHub
- URL: https://github.com/bugbiteme/catalog-spring-boot
- Owner: bugbiteme
- Created: 2018-05-20T15:57:44.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-26T21:19:03.000Z (almost 8 years ago)
- Last Synced: 2025-01-31T12:36:17.820Z (over 1 year ago)
- Language: Java
- Size: 15.6 KB
- Stars: 0
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# catalog-spring-boot
This microservice can be run on it's own, but is intended to be run as part of the "coolstore" project in openshift.
Instructions for deploying the entire coolstore application will be available soon.
## Run inventory-wildfly-swarm as a stand-alone RestAPI service running locally
Using maven, run the following command to run and test the inventory microservice locally:
`$ mvn package`
then
`$ mvn spring-boot:run`
Once you see `Started CatalogApplication in 7.327 seconds (JVM running for 8.602)` or something similar
validate it is running using curl (or a web browser)
`curl http://localhost:9000/api/catalog`
output
`[{"itemId":"329299","name":"Red Fedora","description":"Official Red Hat Fedora","price":34.99},...}]`
terminate service `ctrl-c`
## Build and deploy catalog service on OpenShift.
Assuming you have logged into OpenShift, make sure you are in the coolstore project:
`$ oc project coolstore`
### Deploying from local source using Maven
To build and deploy the catalog service into OpenShift using the fabric8 maven plugin, run the following Maven command:
`$ mvn fabric8:deploy`
While you are waiting for the deploy command to complete, you can log into the OpenShift web consol and check the progress of your deployment, and even view the build and deployment logs, which should look very similar to the messages seen when running the service locally.
### Deploying from github
The Java S2I image enables developers to automatically build, deploy and run java applications on demand, in OpenShift Container Platform, by simply specifying the location of their application source code or compiled java binaries. In many cases, these java applications are bootable “fat jars” that include an embedded version of an application server and other frameworks (wildfly-swarm in this instance).
Deploy the service from github
`$ oc new-app https://github.com/bugbiteme/catalog-spring-boot.git --name catalog --image-stream=redhat-openjdk18-openshift`
A build gets created and starts building the Node.js Web UI container image. You can see the build logs using OpenShift Web Console or OpenShift CLI:
`$ oc logs -f bc/catalog`
In order to access the Web UI from outside (e.g. from a browser), it needs to get added to the load balancer. Run the following command to add the Web UI service to the built-in HAProxy load balancer in OpenShift.
~~~
$ oc expose svc/catalog
$ oc get route catalog
~~~
While you are waiting for the deploy command to complete, you can log into the OpenShift web consol and check the progress of your deployment, and even view the build and deployment logs, which should look very similar to the messages seen when running the service locally.
### In the event of no jdk image
Some versions of minishift do not include the openjdk image stream. In this case, we need to use the Java S2I image to tell OpenShift how to find it. This is done by creating an image stream. The image stream definition can be downloaded here and used. To add the image stream to your project run the following command:
`$ oc create -f openjdk-s2i-imagestream.json`
### Validate
Once the service has been deployed, you can get the url by running
`$ oc get route`
validate it is running using curl (or a web browser)
`curl http://CATALOGSERVICEURL/api/catalog
output
`[{"itemId":"329299","name":"Red Fedora","description":"Official Red Hat Fedora","price":34.99},...}]`
For more information:
[http://guides-cdk-roadshow.b9ad.pro-us-east-1.openshiftapps.com/index.html#/workshop/roadshow/module/spring-boot](http://guides-cdk-roadshow.b9ad.pro-us-east-1.openshiftapps.com/index.html#/workshop/roadshow/module/spring-boot)