Git Product home page Git Product logo

microzon's Introduction

Micro service shop example

Some words of warning

This is a demonstration how microservices may interact with each other and how to debug them. This is not supposed to be or become a real shop implementation. Most importantly: The current implementation intentionally contains several design flaws as they might occure in real life product development.

Used technologies

For simplicity all services are supposed to run on a Java-VM.

  • Web frontend
    • Based on Play 2.3 / Scala 2.11
    • Does not have any kind of persistence
  • Customer service
    • Based on Spring boot
    • Mysql backend via JPA/Hibernate
  • Product backend
    • Based on Spray 1.3.1
    • MongoDB backend via ReactiveMongo
  • (Shopping)Cart backend
    • Based on Scalatra with embedded Jetty
    • Mysql backend via ScalalikeJdbc

Getting started

Requirements

  • When using the vagrant environment we start up to 7 VMs with 8 Gb memory total, therefore a machine with at least 16 Gb is advisable
  • Java JDK 1.7 (OpenJDK and OracleJDK are both working)
  • An internet connection (expect lots of stuff being downloaded)
  • Either
    • Virtual Box 4.3
    • Vagrant 1.6
  • ... or
    • Docker 1.4

The setup has been tested with MacOS (Maverick/Yosemite) and Ubuntu 14.04. If you are using a different system you might encounter so far unknown problems.

Getting started

Since this is a project for experimentation it is possible to run the stuff via docker or vagrant/virtualbox.

Run via docker

Just move to the "docker" subdirectory and execute the run.sh script

cd docker
sh ./run.sh

(all the images should be available via the public docker hub)

After this the following URLs should work:

To build the images from scratch you fist have to build distributions of all the microservices (see below) and run the "build.sh" script.

For Mac users: You have should use boot2docker with can be either downloaded here http://boot2docker.io/ or installed via homebrew

brew install boot2docker

Ensure that the boot2docker VM has enough RAM, i.e. to run everything the VM should have at least 6GB

boot2docker init -m 6144
boot2docker up

Also note that you have to use the IP returned by boot2docker ip instead of localhost.

If you want to access all the services directly from your machine by their ip addresses (e.g. develop one of the services locally), you also might want to add a static route to the docker0 net inside the boot2docker VM:

sudo route -n add -net 172.17.0.0/16 $(boot2docker ip)

(Please check the network address with boot2docker ssh ifconfig docker0 just to be sure.)

Building the micro service distributions

First of all you should ensure that you hava all the submodules initialized and updated

git submodule init
git submodule update

All build scripts will create an distribution archive in /vagrant/dist

Note: As in real life several different build tools/configs are used for each project. Pay close attention to each of the commands, it is not always the same.

  • customer service
cd <project home>/microzon-customer
./gradlew clean dist
  • product service
cd <project home>/customer
./activator clean assembly
  • web frontend service
cd <project home>/web
./activator clean dist

Start the cluster via vagrant

#!bash
cd <project home>/vagrant
vagrant up

Populating the databases

  • product database For docker:
python product/src/main/scripts/populate.py localhost:8090

resp. for Mac users:

python product/src/main/scripts/populate.py $(boot2docker ip):8090

Enjoy the show

microzon's People

Contributors

untoldwind avatar yorkxylander avatar dstrebel avatar

Watchers

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