Giter VIP home page Giter VIP logo

docker-microservice-template's Introduction

docker-microservice-template

A template for create your own microservice with docker, docker-compose, nginx, consul, consul-template and registrator.

Overview

Container Description
Application Your application
registrator Service registry bridge for Docker
Consul Service discovery and configuration
Nginx with consul-template Load balancing and template rendering with Consul

Requirements

  • Docker (Tested on 1.6.0)
  • Ansible (Tested on 1.9.0)
  • Vagrant (Tested on 1.7.2)

Installation

  • Boot vagrant virtual machine. This will setup your local environment and VM configuration.
vagrant up
  • Run all containers.
docker-compose up -d
  • Then open below link. This will show you a simple 3-tier application.

http://172.17.8.101/example/php-mysql/

You can see example page, if not kill & rm containers and recreate them.
Now, you can edit applications by edit local files that Application Containers are mounted on VM mounted on host machine.

  • Exit containers
docker-compose kill && docker-compose rm
  • Restart containers
docker-compose up -d

or

docker-compose restart
  • You can easily scale your containers by docker-compose scale
docker-compose scale app=3
  • Containers knows each host's name via Consul DNS.
# attach to running container
$ docker exec -it dockermicroservicetemplate_app_1 /bin/bash
# name resolution
root@1be773ff5254:/var/www/html#  ping mysql.service.consul

PING mysql.service.consul (10.1.0.45): 56 data bytes
64 bytes from 10.1.0.45: icmp_seq=0 ttl=64 time=0.068 ms
64 bytes from 10.1.0.45: icmp_seq=1 ttl=64 time=0.090 ms

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

docker-microservice-template's People

Contributors

shufo avatar

Stargazers

 avatar  avatar  avatar

Watchers

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