Improve README instructions. Fix #56

This commit is contained in:
Charles Moulliard
2017-03-26 17:44:35 +02:00
parent 16b4eaf001
commit b82fcba3ec

View File

@@ -1,11 +1,46 @@
# Hello World Example
This is a `Hello World` spring cloud application.
This Spring Boot application exposes an endpoint that we can call to receive a `Hello World` message as response. The application is configured using the
@RestController and the method returning the message is annotated with `@RequestMapping("/")`
To run the application on Kubernetes:
The uberjar of the Spring Boot application is packaged within a Docker image using the [Fabric8 Maven plugin](maven.fabric8.io) and next deployed top of the Kubernetes management platform as a pod
using the replication controller created by the plugin.
mvn clean package fabric8:build fabric8:deploy fabric8:start
To play with the example, it is required to have access to a Kubernetes Management Platform which is available on GCE. If you don't have an account on GCE,
you can install locally Kubernetes & Docker using `[Minikube](https://kubernetes.io/docs/getting-started-guides/minikube/)` within a Virtual Machine
managed by a hypervisor (Xhyve, Virtualbox or KVM) if your machine is not a native Unix operating system.
The script to install `minikube` is
```
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.17.1/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
```
When the client is installed on your machine, you can start kubernetes using this command:
```
minikube start
```
Next, you can play with this Spring Boot application in the cloud using the following maven command to deploy:
```
mvn clean package fabric8:deploy
```
When the application has been deployed, you can access its service or endpoint:
```
minikube service kubernetes-hello-world
```
And next you can curl the endpoint
```
curl http://IP_OR_HOSTNAME/
```
To run the integration tests:
## Integration test
mvn clean install -Pintegration
To deploy the replication controller, create the pod & access its service on Kubernetes, we will use the Arquillian Kubernetes Cube framework.
It will use the yaml configuration file generated by the Fabric8 maven plugin in order to talk to the platform toi create the different objects;replication controller,
pod, service ...
When the service becomes available, the unit test which is a HTTP Client will call the endpoint to verify that it receives as reponse message "Hello World"
To play with the integration test, execute the following maven command:
mvn clean install -Pintegration