This article describes how to create and deploy an FIS 2.0 project using the s2i source workflow. It creates a project from scratch and using github repository one can deploy their FIS 2.0 camel and spring-boot based project to an Openshift environment. Below are the steps in the sequence, which should be followed to deploy the application easily.
- Firstly, one should setup an Openshift environment with FIS image and templates as per doc https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.3/html-single/fuse_integration_services_2.0_for_openshift/.
- Create a directory spring-boot somewhere in the local path. Now go to this folder.
mkdir spring-boot
cd spring-boot
- Execute the following to download spring-boot archetype:
mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeCatalog=https://maven.repository.redhat.com/ga/io/fabric8/archetypes/archetypes-catalog/2.2.195.redhat-000004/archetypes-catalog-2.2.195.redhat-000004-archetype-catalog.xml -DarchetypeGroupId=org.jboss.fuse.fis.archetypes -DarchetypeArtifactId=spring-boot-camel-xml-archetype -DarchetypeVersion=2.2.195.redhat-000004
- In github repo, create a new repository. Let's say we created 'testingAgain'. Copy the repository url.
- Now create a local git repository and add the remote github url to the local git repo.
git init
git add *
git commit -m "Added spring-boot project"
git remote add origin https://github.com/1984shekhar/testingAgain.git
git push origin master
- On Openshift console, click on 'Add to Project'. One can find this on the top panel in the Openshift GUI.
- In the 'Browse Catalog' search for spring. Select s2i-spring-boot-camel. This quickstart is a simple example of camel and spring-boot.
- Once selected, we can set below parameters. While other parameters can be left as it is.
Application Name: test-camel-spring-boot
Git Repository URL: https://github.com/1984shekhar/sourceS2I_fis_example.git
#Git Reference refers to brnach name or tag.
Git Reference: master
Application Version: 1.0
- Click on Create, it will redirect to a different page.
- Click on 'Go to overview' on that page.
- Go to 'Applications -> Pods'- You should see a POD.
test-camel-spring-boot-1-build with status Running.
- Click on the Pod 'test-camel-spring-boot-1-build'.
- Go to Logs tab. Scroll at the bottom, it will download artifacts.
- Within a couple of minutes in logs, at last, you would find:
Pushing [==================================================>] 142.2 MB
Pushing
Pushed
latest: digest: sha256:756fe8a1b7fe53c174824c48b56d8b28e6ba48dadb9b9d0d4164ae76abebc58a size: 9646
Push successful
- Click on 'Go to overview' on that page.
- We would see another pod like:
test-camel-spring-boot-1-3k38z in Running phase.
test-camel-spring-boot-1-build in Completed phase.
- Pod test-camel-spring-boot-1-3k38z is an actual pod. Click on it and go to Logs tab.
- We should see logs like:
08:16:39.411 [Camel (camel) thread #0 - timer://foo] INFO simple-route - 477
08:16:49.411 [Camel (camel) thread #0 - timer://foo] INFO simple-route - 497
08:16:59.411 [Camel (camel) thread #0 - timer://foo] INFO simple-route - 289
08:17:09.411 [Camel (camel) thread #0 - timer://foo] INFO simple-route - 872
08:17:19.412 [Camel (camel) thread #0 - timer://foo] INFO simple-route - 401
- Using oc client we can verify with the command:
[cpandey@cpandey karaf-camel]$ oc get pods
NAME READY STATUS RESTARTS AGE
test-camel-spring-boot-1-3k38z 1/1 Running 0 3mtest-camel-spring-boot-1-build 0/1 Completed 0 13m
[cpandey@cpandey karaf-camel]$
Whether you are new to Containers or have experience, downloading this cheat sheet can assist you when encountering tasks you haven’t done lately.
Last updated: January 12, 2018