Browse Source

Merge branch 'master' into redhat

pull/20/head
Andrea Tarocchi 8 years ago
parent
commit
e12a022623
  1. 69
      README.adoc
  2. 32
      src/main/resources/META-INF/resources/rest-http-index.html

69
README.adoc

@ -13,50 +13,33 @@ This booster introduces the mechanics of interacting with a remote (exposed by A
Use this booster to:
* Execute an HTTP GET request on the `camel/greetings/{name}` endpoint by using the URL parameter `{name}`
* Produce a response in JSON format with a payload of Hello, $name! (where $name is replaced by the value of the URL parameter from the HTTP GET request).
* Produce a response in JSON format with a payload of `Hello, $name!` (where `$name` is replaced by the value of the URL parameter from the HTTP GET request).
* Browse the API's Swagger page.
== Deployment options
You can run this booster in the following modes:
* Standalone on your machine
* Single-node OpenShift cluster
* OpenShift Online at link:{launchURL}[]
* Standalone on your machine
The most effective way to use this booster is to deploy and run the project on OpenShift.
For more details about running this booster on a single-node OpenShift cluster, CI/CD deployments, as well as the rest of the runtime, see the link:http://appdev.openshift.io/docs/spring-boot-runtime.html[Spring Boot Runtime Guide].
IMPORTANT: This booster requires Java 8 JDK or later and Maven 3.3.x or later.
== Running the booster standalone on your machine
To run this booster as a standalone project on your local machine:
. Download the project and extract the archive on your local filesystem.
. Build the project:
+
[source,bash,options="nowrap",subs="attributes+"]
----
$ cd PROJECT_DIR
$ mvn clean package
----
. Run the services:
+
[source,bash,options="nowrap",subs="attributes+"]
----
$ mvn spring-boot:run
----
. Go to link:http://localhost:8080[] and then follow the instructions on that page.
== Running the booster on a single-node OpenShift cluster
If you have a single-node OpenShift cluster, such as Minishift or the Red Hat Container Development Kit, link:http://appdev.openshift.io/docs/minishift-installation.html[installed and running], you can deploy your booster there.
A single-node OpenShift cluster provides you with access to a cloud environment that is similar to a production environment.
IMPORTANT: You need to run this example on Container Development Kit 3.3 or OpenShift 3.7.
Both of these products have suitable Fuse images pre-installed.
If you run it in an evironment where those images are not preinstalled follow the steps described in <<single-node-without-preinstalled-images>>.
If you have a single-node OpenShift cluster, such as Minishift or the Red Hat Container Development Kit, link:http://appdev.openshift.io/docs/minishift-installation.html[installed and running], you can deploy your booster there.
To deploy your booster to a running single-node OpenShift cluster:
To deploy this booster to a running single-node OpenShift cluster:
. Download the project and extract the archive on your local filesystem.
@ -74,6 +57,13 @@ $ oc login -u developer -p developer
$ oc new-project MY_PROJECT_NAME
----
. Change the directory to the folder that contains the extracted booster application (for example, `my_openshift/fuse-rest-http-booster-master`) :
+
[source,bash,options="nowrap",subs="attributes+"]
----
$ cd my_openshift/fuse-rest-http-booster-master
----
. Build and deploy the project to the OpenShift cluster:
+
[source,bash,options="nowrap",subs="attributes+"]
@ -84,9 +74,10 @@ $ mvn clean -DskipTests fabric8:deploy -Popenshift
. In your browser, navigate to the `MY_PROJECT_NAME` project in the OpenShift console.
Wait until you can see that the pod for the `fuse-rest-http-booster` application has started up.
. Just above the entry for the `fuse-rest-http-booster` application on the `Overview` page, find the URL of the form `http://fuse-rest-http-booster-MY_PROJECT_NAME.OPENSHIFT_IP_ADDR.nip.io`.
. On the project's `Overview` page, locate the URL for the `fuse-rest-http-booster` application. The URL uses this form:
`http://fuse-rest-http-booster-MY_PROJECT_NAME.OPENSHIFT_IP_ADDR.nip.io`.
. Click on the URL to access the greetings service application and then follow the instructions on that page.
. Click the URL to access the greetings service application and then follow the instructions on that page.
[#single-node-without-preinstalled-images]
=== Running the booster on a single-node OpenShift cluster without preinstalled images
@ -129,10 +120,32 @@ Wait until you can see that the pod for the `fuse-rest-http-booster` application
Click on the URL to access the greetings service application and follow the instructions on that page.
== Running the booster on OpenShift Online
You can deploy the circuit breaker booster directly to OpenShift Online when you create the project at link:{launchURL}[].
To deploy this booster directly to OpenShift Online when you create the project at link:{launchURL}[].
. Go to link:{launchURL}[].
. At the *Deployment step*, select *Use OpenShift Online*.
. Follow the on-screen instructions to create a new *REST API Level 0* project by using the *Fuse* runtime.
NOTE: As part of the process of creating this booster, link:{launchURL}[] sets up a project with a CI/CD deployment of this booster. You can see the status of this deployment in your single-node OpenShift cluster or OpenShift Online web console.
== Running the booster standalone on your machine
To run this booster as a standalone project on your local machine:
. Download the project and extract the archive on your local filesystem.
. Build the project:
+
[source,bash,options="nowrap",subs="attributes+"]
----
$ cd PROJECT_DIR
$ mvn clean package
----
. Run the services:
+
[source,bash,options="nowrap",subs="attributes+"]
----
$ mvn spring-boot:run
----
. Go to link:http://localhost:8080[] and then follow the instructions on that page.

32
src/main/resources/META-INF/resources/rest-http-index.html

@ -2,7 +2,7 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>REST HTTP Mission - Red Hat Fuse</title>
<title>REST HTTP - Red Hat Fuse</title>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
@ -11,21 +11,27 @@
<body>
<div class="container">
<div>
<h1>REST HTTP Mission - Red Hat Fuse</h1>
<h1>REST HTTP - Red Hat Fuse</h1>
<p class="lead">
The REST API Level 0 mission shows how to map business operations to a remote procedure call endpoint over HTTP using a REST framework. This mission corresponds to Level 0 in the Richardson Maturity Model.
By using this Fuse booster, you can implement this mission by quickly prototyping and flexibly designing your REST API.
The REST API Level 0 mission demonstrates how to map business operations to a remote procedure call endpoint over HTTP using a REST framework. This mission corresponds to Level 0 in the Richardson Maturity Model.
</p>
<p class="lead">
This booster introduces the mechanics of interacting with a remote (exposed by Apache Camel) service using the HTTP protocol. Use this booster to:
<dl>
<dt class="lead"><strong>Execute an HTTP GET request on camel/greetings/{name} endpoint:</strong></dt>
<dd class="lead"><a class="btn btn-info" href="/camel/greetings/Jacopo" target="_blank">camel/greetings/{name}</a> by using the URL parameter <code>{name}</code></dd>
<dt class="lead">Produce a response in JSON format with a payload of Hello, $name! </dt>
<dd class="lead">where $name is replaced by the value of the URL parameter from the HTTP GET request.</dd>
<dt class="lead"><strong>Browse the API's Swagger page:</strong></dt>
<dd class="lead"><a class="btn btn-info" href="/webjars/swagger-ui/index.html?url=/camel/api-doc&validatorUrl=" target="_blank">API Swagger page</a> This page displays the Swagger UI for the REST API.</dd>
</dl>
By using this Fuse booster, you can implement this mission to quickly prototype and flexibly design your REST API.
</p>
<p class="lead">
This booster introduces the mechanics of interacting with a remote (exposed by Apache Camel) service using the HTTP protocol.
</p>
<p class="lead">
Use this booster to:
<ul class="lead">
<li>Execute an HTTP GET request on the <code>camel/greetings/{name}</code> endpoint:
<a class="btn btn-info" href="/camel/greetings/Jacopo" target="_blank">camel/greetings/{name}</a> </li>
<li>Produce a response in JSON format with a payload of <code>Hello, $name!</code>
where <code>$name</code> is replaced by the value of the <code>{name}</code> URL parameter from the HTTP GET request.</li>
<li>Browse the REST API's Swagger page: <a class="btn btn-info" href="/webjars/swagger-ui/index.html?url=/camel/api-doc&validatorUrl=" target="_blank">API Swagger page</a></li>
</ul>
</p>
</div>
</div>

Loading…
Cancel
Save