With the recently released functionality in Fuse integration services on OpenShift we're able to run our integration services in a microservice style architecture in docker containers. We've been architecting services for Fuse like this for a long time, but now we can take advantage of the automation, process isolation, and packaging benefits of Docker which is crucial for a microservices style deployment.
Note, this project is currently focused on using the productized (Red Hat supported) versions of the FIS (Fuse integration services) libraries and frameworks from the http://fabric8.io project. The following versions of community projects can be expected in the productized release (please check the Red Hat documentation for official guidance on versions)
Project | Version |
---|---|
Apache Camel | 2.15.1.redhat-621084 |
Apache ActiveMQ | 5.11.0.redhat-621084 |
Apache CXF | 3.0.4.redhat-621084 |
Apache Karaf maven plugin | 4.0.2.redhat-621079 |
JBoss Fuse | 6.2.1.redhat-084 |
Fabric8 - kubernetes-model | 1.0.22.redhat-079 |
Fabric8 - kubernetes-client | 1.3.26.redhat-079 |
Fabric8 | 2.2.0.redhat-079 |
iPaaS Quickstarts | 2.2.0.redhat-079 |
The Camel routes used in this example are explained by the following diagram:
You should probably set up the basic developer tools to be able to go through these steps, examples. We will also cover more ideal workflows with developer-local setup of docker and openshift, so would be good to install the "optional" tools as well!
- Install JBoss Developer Studio 8.1.0 [https://www.jboss.org/products/devstudio.html]
- Install Apache Maven 3.2.x [http://maven.apache.org]
- Install JBoss Fuse 6.2.1 [https://www.jboss.org/products/fuse.html]
- Have access to an OpenShift installation
- (Optional, but recommended) Install the Red Hat CDK Beta for local development
- (Optional, but recommended) Install the native docker client libs for your operating system
- (Optional, but recommended) Install the native openshift client libs for your operating system
$ mvn clean install
This project ends up building a few important things:
- the project artifacts
- builds the jars as Apache Karaf bundles (if wish to deploy into karaf -- not required though)
- builds an Apache Karaf features file (if wish to deploy into karaf -- not required though)
- kubernetes.json files for each module, found in
target/classes/kubernetes.json
of each sub-module - a single, comprehensive kubernetes.json that has all of the submodule descriptor files to install all in one found in
rider-auto-ose-installer/target/classes/kubernetes.json
To build and install the Docker microservices, please have a look at the docs for each module, or the all-in-one installer
- All-in-one: rider-auto-ose-installer
- rider-auto-ws
- rider-auto-file
- rider-auto-backend
- rider-auto-normalizer
This example uses JBoss A-MQ, so we need to have that running in the same project/namespace as the rider-auto apps (including this module). To deploy AMQ, follow the instructions from the xPaaS AMQ documentation. On the CDK, you can do this:
oc create -f https://raw.githubusercontent.com/openshift/openshift-ansible/master/roles/openshift_examples/files/examples/v1.1/xpaas-templates/amq62-basic.json oc process amq62-basic -v APPLICATION_NAME=broker -v MQ_USERNAME=admin -v MQ_PASSWORD=admin
Or you can use the template i've included in the root of this project:
oc create -f amq.json
service "broker-amq-tcp" created
deploymentconfig "broker-amq" created
Note: as a user of the CDK, you may need cluster-admin rights by using the config file in /var/lib/origin/openshift.local.config/master/admin.kubeconfig. If you copy this to your ~/.kube/config file or set the location to it in $KUBECONFIG environment variable, you should be granted full cluster-admin rights and should be able to create the AMQ image. It is best to first login to the vagrant from your host machine:
vagrant ssh
Then sudo to root
sudo -s
Then login to OpenShift using the "system:admin" superuser on a dedicated admin interface (10.0.2.15):
oc login -u system:admin https://10.0.2.15:8443
Now you can create the AMQ service by running the following command (after copying and pasting the amq.json file to your root directory):
oc create -f amq.json
Note that the user name and password need to be admin/admin
as that's what the rider-auto-osgi project expects.
$ bin/fuse
- Add this projects features.xml config to Fuse from the Console (makes it easier to install bundles with all required dependencies)
JBossFuse:karaf@root> features:addUrl mvn:org.fusesource.examples/rider-auto-common/5.0-SNAPSHOT/xml/features
- Install the project.
JBossFuse:karaf@root> features:install rider-auto-osgi
- To test the file processing, there are existing files in the rider-auto-common module.
$ cp rider-auto-common/src/data/message1.xml /target/placeorder
To see what happened look at the log file, either from the console
JBossFuse:karaf@root> log:display
or from the command line
$ tail -f data/log/fuse.log
- To test the WS, use your favorite WS tool (e.g. SoapUI) against the following WSDL hosted by the rider-auto-ws bundle.
If you hit any problems please let the Fuse team know on the forums [https://community.jboss.org/en/jbossfuse]