The Configmap mission provides a basic example of using a ConfigMap to externalize configuration used in an Apache Camel route. A ConfigMap is an object used to inject configuration data as simple key and value pairs into one or more Linux containers.
This booster exposes a simple api/greetings/
service that produce a response based on a configuration property in JSON format of the form {"greetings":"Hello, default"}
.
Changing the configmap value will live change the service’s response.
This booster can run in the following modes:
-
Standalone on your machine (although there will not be a Configmap to modify, the configuration will fall back to
application.properties
file) -
Single-node OpenShift cluster
-
OpenShift Online at https://developers.redhat.com/launch
The most effective way to demonstrate the 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 Spring Boot Runtime Guide.
Important
|
This booster requires Java 8 JDK or greater and Maven 3.3.x or greater. |
You can 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:
$ cd PROJECT_DIR $ mvn clean package
-
then run the services as follows:
$ mvn spring-boot:run
-
Visit http://localhost:8080 and follow the instructions on that page.
If you have a single-node OpenShift cluster, such as Minishift or the Red Hat Container Development Kit, 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.
To deploy your booster to a running single-node OpenShift cluster:
-
Download the project and extract the archive on your local filesystem.
-
Log in to your OpenShift cluster:
$ oc login -u developer -p developer
-
Create a new OpenShift project for the booster:
$ oc new-project MY_PROJECT_NAME
-
Build and deploy the project to the OpenShift cluster:
$ 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 thefuse-configmap-booster
application has started up. -
Just above the entry for the
fuse-configmap-booster
application on theOverview
page, there is a URL of the formhttp://fuse-configmap-booster-MY_PROJECT_NAME.OPENSHIFT_IP_ADDR.nip.io
. Click on the URL to access the greetings service application and follow the instructions on that page.
You can deploy the configmap booster directly to OpenShift Online when you create the project at https://developers.redhat.com/launch.
-
At the Deployment step, select Use OpenShift Online.
-
Follow the on-screen instructions to create a new Externalized Configuration project using the Fuse runtime.
Note
|
As part of the process of creating this booster, https://developers.redhat.com/launch 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. |