Giter VIP home page Giter VIP logo

spring-boot-docker-camel's Introduction

spring-boot-docker-camel

Demonstrates the deployment of Camel within Spring Boot and integration with Docker using various integration technologies

Project Overview

This project demonstrates the integration capabilities of Apache Camel within Spring Boot and Docker. The Camel context is initialized within the Spring Boot framework via the Camel Spring Boot Component with two primary functions: proxy inquiries via REST to Docker and to broadcast events produced by Docker to a websockets endpoint with the Async HTTP Client for websockets. Each integration with Docker leverages the Camel Docker component. Spring Boot also exposes a servlet to handle inbound REST requests to Camel along with managing the websockets endpoint.

A webpage has been provided to expose the operations which can be made to Docker and to consume messages published to the websockets endpoint

Docker Proxy

A REST endpoint is exposed using the Camel Rest DSL to consume requests destined for Docker. A combination of configuration within the Rest DSL and content based routing determines valid and invalid requests. Invalid requests return an appropriate message to the user. Valid request undergo message enrichment to allow for the appropriate invocation of Docker. Results are returned to the user in JSON format.

Broadcast Docker Events

The Docker REST API exposes a service which allows for the monitoring of events within the Docker daemon. A camel route is configured to consume messages from this service which are then sent to a websockets endpoint.

Camel Components

The following Camel components are leveraged:

Prerequisites

  • Java 6+
  • Maven
  • Docker
    • The REST API of a local or remote instance of Docker must be available

Configuration

This section describes the components which can be configured within the application

Spring Boot

External configurations can be provided to Spring Boot in the application.properties file located in src/main/resources. These can be referenced by Spring Boot itself or as an external properties within Came;

Docker

The location of Docker must be configured using the docker.server and docker.port properties within the application.properties

Build and Deployment

Since the project is leveraging Spring Boot, it can be deployed in a number of different ways. The following sections describe these options

Command Line

Use the Spring Boot Maven Plugin to launch the application. Run the following command in the project directory

mvn clean spring-boot:run 

Tomcat

The project can be built as a Web Archive (.war) and deployed to Tomcat.

Build and deploy

Build and package the project using the following command

mvn clean install 

Copy the .war file from the project target directory to the Tomcat deploy folder

Running the Application

Once successfully deployed, the application will be available at:

http://localhost:8080/spring-boot-docker-camel

Displaying Events

Events from Docker are displayed in a text box within the sample web page. The following command can be used to create a minimalistic container producing events to the websockets endpoint:

docker run -it --rm busybox /bin/sh

A new container should be created and events should be visible on the webpage. From the interactive shell inside the container created above, enter exit to destroy the container, thus producing additional events

Viewing Docker Statistics

Certain statistics of Docker have been exposed through Camel route via REST services. Links are available on the webpage to invoke these services. Responses are returned in raw ison format

spring-boot-docker-camel's People

Contributors

sabre1041 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.