This showcase demonstrates how to build a cloud native application using JEE and several cloud native infrastructure components. The individual parts will later be deployed and run on DC/OS.
- JEE Service Container: KumuluzEE
- API Gateway / Edge Server: Fabio
- Service Discovery: Consul
- Service Client: Jersey and Hystrix
- Configuration & Coordination: Consul
- Cluster Resource Manager: Mesos by DC/OS
- Cluster / Container Orchestrator: Marathon by DC/OS
- Diagnosability: Metrics
The application can be run on your local machine as well as on a remote DC/OS cluster.
- import the gradle project into your favorite IDE. JDK8 required.
- perform a gradle build:
$ ./gradlew clean build
- start the infrastructure (Consul and Fabio):
$ cd infrastructure
$ ./local-consul-up.sh
$ ./local-fabio-up.sh
- pick out a service within the
./services
directory and run itsMain
class. Important: set thePORT
environment variable before to free port of your choice. - now you hopefully see the service running within the JEE container and its service getting registered at Consul and Fabio.
You can also use docker-compose
to launch a complete local system (all micro services and all
required infrastructure like Consul and Fabio). You need a remote docker daemon like the one provided
by docker-machine
.
- point your DOCKER_HOST environment variable to the remote docker daemon. If you're using docker-machine on macOS this is as easy as
eval "$(docker-machine env default)"
. - build your docker files with the
buildDockerImage
gradle task. - now you can start the local system with
./infrastructure/dockerized-up.sh
and stop it with./infrastructure/dockerized-down.sh
.
- setup a DC/OS Cluster. You can do so locally by using DC/OS Vagrant (https://github.com/dcos/dcos-vagrant) or you use a public cloud provider. As the Vagrant setting consumes a lot of resources our current favorite is the packet (https://www.packet.net) IaaS cloud. It's fast and way cheaper than AWS for running a DC/OS cluster. A DC/OS cluster can be created by a Terraform script on Packet: https://dcos.io/docs/1.8/administration/installing/cloud/packet.
- install the DC/OS command line tool and auth it to your cluster.
- now you can start the cluster with
./infrastructure/marathonized-up.sh
and stop it with./infrastructure/marathonized-down.sh
.
If you want to deploy the microservices you've to push them to docker hub:
- point your DOCKER_HOST environment variable to the remote docker daemon. If you're using docker-machine on macOS this is as easy as
eval "$(docker-machine env default)"
. - set your docker hub credentials by using
./gradlew setCredentials --service docker --username <YOUR-DOCKER_HUB-USERNAME>
- Build and deploy the container:
$ ./gradlew clean build buildDockerImage pushDockerImage
This software is provided under the MIT open source license, read the LICENSE
file for details.