All Projects → foostan → Consul With Docker

foostan / Consul With Docker

The environment of Consul with Docker include Consul Template and Registrator

Projects that are alternatives of or similar to Consul With Docker

Dockerfiles
50+ DockerHub public images for Docker & Kubernetes - Hadoop, Kafka, ZooKeeper, HBase, Cassandra, Solr, SolrCloud, Presto, Apache Drill, Nifi, Spark, Consul, Riak, TeamCity and DevOps tools built on the major Linux distros: Alpine, CentOS, Debian, Fedora, Ubuntu
Stars: ✭ 847 (+1335.59%)
Mutual labels:  consul
Spring Cloud Learning
☁️适合刚接触微服务架构的初学者了解和学习微服务,主要集成了注册中心、服务网关、配置中心、熔断机制、应用监控。
Stars: ✭ 37 (-37.29%)
Mutual labels:  consul
Spring Cloud Zuul Ratelimit
Rate limit auto-configure for Spring Cloud Netflix Zuul
Stars: ✭ 1,018 (+1625.42%)
Mutual labels:  consul
Gentleman
Full-featured, plugin-driven, extensible HTTP client toolkit for Go
Stars: ✭ 886 (+1401.69%)
Mutual labels:  consul
Constructr Consul
This library enables to use Consul as cluster coordinator in a ConstructR based node
Stars: ✭ 32 (-45.76%)
Mutual labels:  consul
Socket Io
基于Hyperf微服务协程框架开发的sokcet-io分布式系统
Stars: ✭ 38 (-35.59%)
Mutual labels:  consul
Consul Conf
🐳 Consul.conf provides responsive web interface for managing configuration of your services in Consul key-value storage through beautiful and customizable dashboards, distributed as a lightweight Docker image.
Stars: ✭ 25 (-57.63%)
Mutual labels:  consul
Consul
Consul - Open Government and E-Participation Web Software
Stars: ✭ 1,088 (+1744.07%)
Mutual labels:  consul
Docker Swarm Consul
Toward a Production-Ready Docker Swarm Cluster with Consul
Stars: ✭ 32 (-45.76%)
Mutual labels:  consul
Dister
dister(Distribution Cluster)是一款轻量级高性能的分布式集群管理软件,实现了分布式软件架构中的常用核心组件,包括:服务配置管理中心、服务注册与发现、服务健康检查、服务负载均衡。dister的灵感来源于ZooKeeper、Consul、Etcd,它们都实现了类似的分布式组件,但是dister更加的轻量级、低成本、易维护、架构清晰、简单实用、性能高效,这也是dister设计的初衷。
Stars: ✭ 41 (-30.51%)
Mutual labels:  consul
Docker Discovery Registrator Consul
Service discovery library for JVM based applications running in Docker containers that use the Registrator service registry bridge with Consul as a backend
Stars: ✭ 21 (-64.41%)
Mutual labels:  consul
Traefik
The Cloud Native Application Proxy
Stars: ✭ 36,089 (+61067.8%)
Mutual labels:  consul
Ultimate Backend
Multi tenant SaaS starter kit with cqrs graphql microservice architecture, apollo federation, event source and authentication
Stars: ✭ 978 (+1557.63%)
Mutual labels:  consul
Go Micro Services
HTTP up front, Protobufs in the rear
Stars: ✭ 853 (+1345.76%)
Mutual labels:  consul
Consul Kv Dashboard
Consul KVS based dashboard web application.
Stars: ✭ 49 (-16.95%)
Mutual labels:  consul
Consul Terraform Sync
Consul Terraform Sync is a service-oriented tool for managing network infrastructure near real-time.
Stars: ✭ 26 (-55.93%)
Mutual labels:  consul
Sample Vertx Microservices
Two applications in different branches illustrates how to create asynchronous microservices with Vert.x, Consul and MongoDB, and how to secure them with Vert.x OAuth2 module and Keycloak
Stars: ✭ 37 (-37.29%)
Mutual labels:  consul
Aspnetcore.services
Examples for ASP.NET Core webservices
Stars: ✭ 59 (+0%)
Mutual labels:  consul
Containerpilot
A service for autodiscovery and configuration of applications running in containers
Stars: ✭ 1,078 (+1727.12%)
Mutual labels:  consul
Nagios Plugins
450+ AWS, Hadoop, Cloud, Kafka, Docker, Elasticsearch, RabbitMQ, Redis, HBase, Solr, Cassandra, ZooKeeper, HDFS, Yarn, Hive, Presto, Drill, Impala, Consul, Spark, Jenkins, Travis CI, Git, MySQL, Linux, DNS, Whois, SSL Certs, Yum Security Updates, Kubernetes, Cloudera etc...
Stars: ✭ 1,000 (+1594.92%)
Mutual labels:  consul

consul-with-docker

Consul Template and Registrator(https://github.com/gliderlabs/registrator) have good chemistry, and combine Consul and Docker effectively. For example, they enable to update HAProxy node that is running on Docker easy and quickly, in real time.

This repository is environment of Consul with Docker include Consul Template and Registrator. Usage is here in Japanese http://fstn.hateblo.jp/entry/2014/10/26/153247

Overview

Overview Figure

A Virtual Machine include these packages

  • Docker
  • Consul
  • Consul Template
  • Registrator
  • HAProxy

and, the endpoint of web services is 192.168.33.11:80 in this environment.

Prepare environment

Build by Vagrant and Ansible

$ git clone https://github.com/foostan/consul-with-docker.git
$ cd consul-with-docker
$ vagrant up

Run Consul agent

[email protected]:~$ consul agent -data-dir=/tmp/consul -server -bootstrap
==> WARNING: Bootstrap mode enabled! Do not enable unless necessary
==> WARNING: It is highly recommended to set GOMAXPROCS higher than 1
==> Starting Consul agent...
==> Starting Consul agent RPC...
==> Consul agent running!
         Node name: 'node-1'
        Datacenter: 'dc1'
            Server: true (bootstrap: true)
       Client Addr: 127.0.0.1 (HTTP: 8500, DNS: 8600, RPC: 8400)
      Cluster Addr: 10.0.2.15 (LAN: 8301, WAN: 8302)
    Gossip encrypt: false, RPC-TLS: false, TLS-Incoming: false

Run Consul template

[email protected]:~$ sudo consul-template\
 -consul=localhost:8500\
 -template="/vagrant/haproxy.ctmpl:/etc/haproxy/haproxy.cfg:service haproxy reload"

Run Registrator

[email protected]:~$ registrator consul:

Build tinyweb and Run a container

Build tinyweb

Tinyweb is a simple web server for a test environment by nc command.

[email protected]:~$ docker build -t foostan/tinyweb /vagrant/tinyweb/

Run a container

docker run -p 80 -d foostan/tinyweb
c437b2717b76dde8c31211fea09bc5bb60b8c16892161db24cb31a1b49543ae1
[email protected]:~$ docker ps
CONTAINER ID        IMAGE                    COMMAND                CREATED             STATUS              PORTS                   NAMES
c437b2717b76        foostan/tinyweb:latest   "\"/bin/sh -c 'while   5 minutes ago       Up 5 minutes        0.0.0.0:49178->80/tcp   romantic_carson

Check

Add a tinyweb service in consul by Registrator and update HAProxy configuration by Consul Template after running a container.

Check Consul services

$ curl -s localhost:8500/v1/catalog/services | jq .
{
  "consul": [],
  "tinyweb": []
}
[email protected]:~$ curl -s localhost:8500/v1/catalog/service/tinyweb | jq .
[
  {
    "Node": "node-1",
    "Address": "10.0.2.15",
    "ServiceID": "node-1:romantic_carson:80",
    "ServiceName": "tinyweb",
    "ServiceTags": null,
    "ServicePort": 49178
  }
]

Added tinyweb and registrated address and port of a node.

Check HAProxy

[email protected]:~$ tail -n 7 /etc/haproxy/haproxy.cfg

frontend  main *:80
    default_backend    tinyweb

backend tinyweb
    balance roundrobin
    server node-1:romantic_carson:80 10.0.2.15:49178 check

Updated the HAProxy configuration.

Access check

[email protected]:~$ curl localhost
c437b2717b76

Without a virtual machine

$ curl 192.168.33.11
c437b2717b76

Run and kill multiple containers

Run 5 containers

[email protected]:~$ docker run -d -p 80 foostan/tinyweb
df9d19738e7610c448478c94ec10ab63259a2c78cfbe6437de2d3e7a8870b63e
[email protected]:~$ docker run -d -p 80 foostan/tinyweb
b7ddc05c645490c21c18b98161bef0994b9c2ad366ff6e85a0b45652ff204e6d
[email protected]:~$ docker run -d -p 80 foostan/tinyweb
0c31735035d4da4519ebbe7a6957ddb9bc1f865e5448c9ab838a742bff3178d3
[email protected]:~$ docker run -d -p 80 foostan/tinyweb
8be6547a4a418faf34be1727b40386c149dd34d41ce5f8efb8c37d37050849ee
[email protected]:~$ docker run -d -p 80 foostan/tinyweb
a7969a2dfa63d137d77369b5e9c519b5565ec0bc2b14126c300b24c11c25deb5

Updated the HAProxy configuration

[email protected]:~$ tail -n 12 /etc/haproxy/haproxy.cfg

frontend  main *:80
    default_backend    tinyweb

backend tinyweb
    balance roundrobin
    server node-1:hopeful_newton:80 10.0.2.15:49181 check
    server node-1:hopeful_torvalds:80 10.0.2.15:49179 check
    server node-1:naughty_elion:80 10.0.2.15:49182 check
    server node-1:romantic_carson:80 10.0.2.15:49178 check
    server node-1:sad_darwin:80 10.0.2.15:49180 check
    server node-1:thirsty_kowalevski:80 10.0.2.15:49183 check

Access check

$ curl 192.168.33.11
0c31735035d4
$ curl 192.168.33.11
df9d19738e76
$ curl 192.168.33.11
8be6547a4a41
$ curl 192.168.33.11
c437b2717b76
$ curl 192.168.33.11
b7ddc05c6454
$ curl 192.168.33.11
a7969a2dfa63

Kill containers and Updated the HAProxy configuration

[email protected]:~$ docker kill a7969a2dfa63 b7ddc05c6454 c437b2717b76
a7969a2dfa63
b7ddc05c6454
c437b2717b76
[email protected]:~$ tail -n 9 /etc/haproxy/haproxy.cfg

frontend  main *:80
    default_backend    tinyweb

backend tinyweb
    balance roundrobin
    server node-1:hopeful_newton:80 10.0.2.15:49181 check
    server node-1:hopeful_torvalds:80 10.0.2.15:49179 check
    server node-1:naughty_elion:80 10.0.2.15:49182 check
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].