Giter VIP home page Giter VIP logo

getting-started-java's Introduction

getting started java spring redis

wercker status

Spring-boot version

This is an absolutely minimal example of a Java-based multi-docker application, under Continuous Integration by Wercker. It consists of two containers:

  • a REST api service and
  • a REDIS key/value store service

The REST api contains one resource which increments a page-hit counter in the REDIS service and prints a greeting containing this counter in a text/html response.

Dev mode

Wercker allows you to run your apps and your dependencies locally - the so called Dev Mode.

To use dev mode you need a docker environment running locally. A convenient way to get this all installed is to download the Docker Toolbox, and if you are not on Linux you need Virtualbox.

There are several ways of preparing your Docker environment to suit your specific needs. One simplistic method would be:

Starting your docker-machine

$ docker-machine start default

Updating your environment

$ eval "$(docker-machine env default)"

Check your environment variables and make note of the IP assigned to your docker-machine.

Running your system under Wercker in Dev Mode

$ cd <your project root = location of wercker.yml>
$ wercker dev --publish 8080

You should now be able to visit

http://<ip of your docker-machine>:8080/hello

The IP is typically 192.168.99.100. To make sure:

$ env|grep 'DOCKER_HOST'

Deployment to Google Container Engine / Kubernetes

Setup the initial environment

To get started with GKE follow the instructions here

If you haven't already - create the cluster



$ gcloud container clusters create ${POD_NAME} \
            
    --num-nodes 1 \
            
    --machine-type g1-small    

Create your redis Pod with a singe instance

$ kubectl create -f kubernetes/redis-rc.json         

Then attach a service

$ kubectl create -f kubernetes/redis-svc.json

Next create the pod for the example service

$ kubectl create -f kubernetes/java-spring-redis-rc.json

And create and expose this service as a Load Balancer to the external world

$ kubectl create -f kubernetes/java-spring-redis-svc.json  

Building and uprading with Wercker

You can use Wercker to build and deploy from the command line.

$ wercker build

will build the app and

$ wercker deploy

will build the container and push it to docker hub. Finally

$ wercker deploy --deploy-target upgrade

will replace the service on GKE with a new version.

Known issues

  • With the current setup it is not practical to use watch/reload functionality of Wercker Dev Mode. We are looking into this. The solution is likely to be made available as a Wercker Custom Step

For further details refer to the source code as well as to the Wercker, Docker and Virtualbox documentation.

getting-started-java's People

Contributors

torstenek avatar

Watchers

James Cloos 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.