Stuart winchester in Openshift 5 minutes

Fis2 On Cdk

Just a quick post to show how to get the FIS2 stuff working on the CDK, it’s REALLY quite easy..! All taken from the fis 2 documentation

You will need to have the following settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
    <profile>
      <id>fusesource.repo</id>
      <repositories>
        <repository>
          <id>redhat.ea</id>
          <name>Red Hat Early Release Repository</name>
          <url>https://maven.repository.redhat.com/earlyaccess/all</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
        </repository>
        <repository>
          <id>central</id>
          <name>central</name>
          <url>https://repo1.maven.org/maven2</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
        </repository>
        <repository>
          <id>redhat.ga</id>
          <name>Red Hat GA</name>
          <url>https://maven.repository.redhat.com/ga</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>redhat.ea</id>
          <name>Red Hat EA Community Release Repository</name>
          <url>https://maven.repository.redhat.com/earlyaccess/all</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
        </pluginRepository>
        <pluginRepository>
          <id>central</id>
          <name>central</name>
          <url>https://repo1.maven.org/maven2</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
        </pluginRepository>
        <pluginRepository>
          <id>redhat.ga</id>
          <name>Red Hat GA</name>
          <url>https://maven.repository.redhat.com/ga</url>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <releases>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
          </releases>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>

<activeProfiles>
	<activeProfile>fusesource.repo</activeProfile>
</activeProfiles>

</settings>

Create a java project using the following command/archetype

mvn archetype:generate \
  -DarchetypeCatalog=https://maven.repository.redhat.com/earlyaccess/all/io/fabric8/archetypes/archetypes-catalog/2.2.180.redhat-000004/archetypes-catalog-2.2.180.redhat-000004-archetype-catalog.xml \
  -DarchetypeGroupId=org.jboss.fuse.fis.archetypes \
  -DarchetypeArtifactId=spring-boot-camel-archetype \
  -DarchetypeVersion=2.2.180.redhat-000004

####
Define value for property 'groupId': : com.nullendpoint
Define value for property 'artifactId': : camel-springboot-logger
Define value for property 'version':  1.0-SNAPSHOT: : 1.0
Define value for property 'package':  com.nullendpoint: :
[INFO] Using property: spring-boot-version = 1.4.1.RELEASE
Confirm properties configuration:
groupId: com.nullendpoint
artifactId: camel-springboot-logger
version: 1.0
package: com.nullendpoint
spring-boot-version: 1.4.1.RELEASE
 Y: : Y

Next, we will ensure that our namespace has the fis 2.0 imagestreams, and then use the f8-m-p to build and push to openshift

oc login -u admin -p admin

oc new-project fis2
BASEURL=https://raw.githubusercontent.com/jboss-fuse/application-templates/application-templates-2.0.redhat-000026
oc replace --force -n fis2 -f ${BASEURL}/fis-image-streams.json
oc replace --force -n fis2 -f ${BASEURL}/quickstarts/karaf2-camel-amq-template.json
oc replace --force -n fis2 -f ${BASEURL}/quickstarts/karaf2-camel-log-template.json
oc replace --force -n fis2 -f ${BASEURL}/quickstarts/karaf2-camel-rest-sql-template.json
oc replace --force -n fis2 -f ${BASEURL}/quickstarts/karaf2-cxf-rest-template.json
oc replace --force -n fis2 -f ${BASEURL}/quickstarts/springboot-camel-amq-template.json
oc replace --force -n fis2 -f ${BASEURL}/quickstarts/springboot-camel-jdg-template.json
oc replace --force -n fis2 -f ${BASEURL}/quickstarts/springboot-camel-rest-sql-template.json
oc replace --force -n fis2 -f ${BASEURL}/quickstarts/springboot-camel-template.json
oc replace --force -n fis2 -f ${BASEURL}/quickstarts/springboot-camel-xml-template.json

mvn fabric8:deploy

This should now result in your application being built and deployed on the ocp platform..!

Pod running!