diff --git a/docs/images/kompose-maven-output-diagram.png b/docs/images/kompose-maven-output-diagram.png new file mode 100644 index 00000000..307a4e90 Binary files /dev/null and b/docs/images/kompose-maven-output-diagram.png differ diff --git a/docs/integrations.md b/docs/integrations.md index f63c72f5..577544ba 100644 --- a/docs/integrations.md +++ b/docs/integrations.md @@ -31,3 +31,15 @@ __Link:__ [https://github.com/adfinis-sygroup/aem-docker/tree/master](https://gi __Description:__ "Download and unarchive the latest kompose release asset for your OS" __Link:__ [https://github.com/chouseknecht/kompose-install-role](https://github.com/chouseknecht/kompose-install-role) + +### Fabric8 Maven Plugin by Red Hat + +__Description:__ "Maven is one of the widely used build tools for Java applications. The Fabric8 Maven Plugin is a maven extension that simplifies the deployment of Java applications to Kubernetes or OpenShift cluster. +The main task of this plugin is to build Docker images, generate Kubernetes or OpenShift resource descriptors and run/deploy the application on Kubernetes or OpenShift cluster. +Plugin has wide range of configuration options. Docker Compose is one of the option to bring up deployments on Kubernetes or OpenShift cluster. +Technically, Fabric8 Maven Plugin processes the external docker-compose.yml file and generates Kubernetes or OpenShift resources via Kompose." + +__Links:__ + +* [Quickstart](/docs/maven-example) +* [Documentation](https://maven.fabric8.io/#docker-compose) diff --git a/docs/maven-example.md b/docs/maven-example.md new file mode 100644 index 00000000..89f5d3f6 --- /dev/null +++ b/docs/maven-example.md @@ -0,0 +1,89 @@ +# Fabric8 Maven Plugin + Kompose: +Lets deploy a Springboot Java application with Docker Compose file using Fabric8 Maven Plugin to Kubernetes or OpenShift. + +##### Requirements +* Linux or MacOS or Windows +* JDK 1.7+ - [JDK Quick Installation Guide](http://openjdk.java.net/install/) +* Maven 3.x+ - [Maven Installation Guide](http://www.baeldung.com/install-maven-on-windows-linux-mac) +* Kompose - [Kompose Installation Guide](/docs/installation) + +__1. Clone the example project from GitHub__ +```bash +$ git clone https://github.com/piyush1594/kompose-maven-example.git +``` + +Change current directory to `kompose-maven-example` directory. +```bash +$ cd kompose-maven-example +``` + +__2. Add Fabric8 Maven Plugin to your project__ +```bash +$ mvn io.fabric8:fabric8-maven-plugin:3.5.28:setup +``` + +Adds the Fabric8 Maven Plugin configuration to `pom.xml` of project. `pom.xml` is manifest or deployment descriptor file of a maven project. + +__3. Install Kompose through Maven__ +```bash +$ mvn fabric8:install +``` + +This command installs the `kompose` on the host. + +__4. Configure Fabric8 Maven Plugin to use a Docker Compose file__ +```bash + + io.fabric8 + fabric8-maven-plugin + + path for docker compose file + + + + + resource + build + + + + +``` + +Add the `` and `` sections to `pom.xml` as shown in above `pom.xml` snippet. Update the `` to provide the relative path of Docker Compose file from `pom.xml` + +__5. Deploy application on Kubernetes or OpenShift__ + + Make sure that Kubernetes/OpenShift cluster or Minikube/minishift is running. In case, if anything of this is not running, you can run minishift to test this application by using following command. +```bash +$ minishift start +``` + + Below command deploys this application on Kubernetes or OpenShift. +```bash +$ mvn fabric8:deploy +``` + +Now that your service has been deployed, let's access it by querying `pod`, `service` from Kubernetes or OpenShift. +```bash +$ oc get pods +NAME READY STATUS RESTARTS AGE +springboot-docker-compose-1-xl0vb 1/1 Running 0 5m +springboot-docker-compose-s2i-1-build 0/1 Completed 0 7m +``` + +```bash +$ oc get svc +NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE +springboot-docker-compose 172.30.205.137 8080/TCP 6m +``` + +Lets access the Springboot service. +```bash +$ minishift openshift service --in-browser springboot-docker-compose +Created the new window in existing browser session. +``` + +It will open your application endpoint in default browser. + +![Output-Diagram](/docs/images/kompose-maven-output-diagram.png)