-
Notifications
You must be signed in to change notification settings - Fork 770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Fabric8 Maven Plugin in Integration #836
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
<plugin> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>fabric8-maven-plugin</artifactId> | ||
<configuration> | ||
<composeFile>path for docker compose file</composeFile> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>resource</goal> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
``` | ||
|
||
Add the `<configuration>` and `<executions>` sections to `pom.xml` as shown in above `pom.xml` snippet. Update the `<composeFile>` 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 <none> 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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add screenshot of output screen ? |
||
|
||
![Output-Diagram](/docs/images/kompose-maven-output-diagram.png) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add blank line here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@piyush1594 please fix this comment then LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cdrage I already fixed it in the last commit.