create account

[SYSTEMS GEEK SERIES] Roll your own Docker Platform: Faster and cheaper than the cloud, more rebellious than legal weed! by faddat

View this thread on: hive.blogpeakd.comecency.com
· @faddat · (edited)
$628.94
[SYSTEMS GEEK SERIES] Roll your own Docker Platform: Faster and cheaper than the cloud, more rebellious than legal weed!
# Clustering docker:  A guide, with examples....

## Basic Manual Cluster
<center>![Model-of-cluster62821.png](https://www.steemimg.com/images/2016/09/14/Model-of-cluster62821.png)</center>

[Bash Code For Basic Manual Cluster](https://steemit.com/beyondbitcoin/@faddat/systems-geek-series-example-bash-for-roll-your-own-docker-platform-manual)

Here’s what you’ll need to run docker containers in production in a manual fashion over a cluster of hosts:

* Docker Daemon  (get.docker.com | bash)

    * Downloads Docker images

    * Builds docker images

    * Runs docker containers

* Weave Networking

    * Gives each container its own internal ip address ex: 10.*.*.*

    * If needed, provides each host with an internatl IP address as well to make connecting system services to those containers easy

* Caddy Web server

    * Automated HTTPS certificates

    * The "Caddyfile" can be configured to forward a container address like 10.32.0.1 to a web address with a public IP address like [www.jimmysfriedchicken.com](http://www.jimmysfriedchicken.com).  

Now, the above platform is manual.  It doesn’t automatically assign addresses based on container labels or other factors, and it won’t change the host that containers run on based on system resource availablity.  If you want that, you need to know that there are a number of incomplete attempts at achieving such containerization nirvana, such as:

### Docker Clustering Systems
<center>![Private Container Platform](http://www.nextplatform.com/wp-content/uploads/2016/03/rancher-private-container-block-diagram.jpg)</center>
<center>![Rancher Block Diagram](http://www.nextplatform.com/wp-content/uploads/2016/03/rancher-block-diagram.jpg)</center>
Images from: http://www.nextplatform.com/2016/03/29/rancher-rides-herd-containers-borg-style/ (Thanks!)


* Docker Swarm (not built into the docker binary)

* Docker Swarm Mode 1.12 (built into the docker binary post 1.12)

* Kubernetes

* Nomad + Consul + Registrator

* Rancher

* Mesos (to some degree:  Mesos is a cluster manager first and foremost, and it is able to use Docker)

* Mesosphere (again, to some degree: Mesosphere is Mesos’s Open Source/Commercially Supported big brother that integrates more PaaS like features.)  

* Kontina

* Flynn

## Fastest (To get running) Automated Cluster

<center>![CiscoUCSb11e4.jpg](https://www.steemimg.com/images/2016/09/14/CiscoUCSb11e4.jpg)</center>

**Docker Swarm Mode**

* Docker Daemon  (get.docker.com | bash)

    * Downloads Docker images

    * Builds docker images

    * Runs docker containers

    * Swarm Mode

* Container networking (won’t need weave)

* Host Networking

* Scheduling

* Orchestration (managing computational load)

But that leaves a significant gap, or depending on your perspective as to what constitutes a complete platform, several signficiant gaps:

* Virtual Hosting / Reverse Proxying (though technically the RP/LB is covered, then again, it’s not covered….)

* Storage management

* Monitoring Service Metrics

* Logging Container Logs

But suppose that you could forgeo these items, with the exception of Virtual Hosting.  Then, your best bet by far would be to set up Docker-flow-proxy, which mercifully has full support ofr swarm mode since its latest release.  So basically docker-flow-proxy is an automated HAPROXY setup that will provide an API to you to call when you launch a container, like this: 

----
From https://github.com/vfarcic/docker-flow-proxy:

### **Reconfigure**

Reconfigures the proxy using information stored in Consul

The following query arguments can be used to send as a *reconfigure* request to *Docker Flow: Proxy*. They should be added to the base address :/v1/docker-flow-proxy/reconfigure.

<table>
  <tr>
    <td>Query</td>
    <td>Description</td>
    <td>Required</td>
    <td>Default</td>
    <td>Example</td>
  </tr>
  <tr>
    <td>consulTemplateBePath</td>
    <td>The path to the Consul Template representing a snippet of the backend configuration. If specified, the proxy template will be loaded from the specified file.</td>
    <td></td>
    <td></td>
    <td>/consul_templates/tmpl/go-demo-be.tmpl</td>
  </tr>
  <tr>
    <td>consulTemplateFePath</td>
    <td>The path to the Consul Template representing a snippet of the frontend configuration. If specified, the proxy template will be loaded from the specified file.</td>
    <td></td>
    <td></td>
    <td>/consul_templates/tmpl/go-demo-fe.tmpl</td>
  </tr>
  <tr>
    <td>distribute</td>
    <td>Whether to distribute a request to all the instances of the proxy. Used only in the swarm mode.</td>
    <td>No</td>
    <td>false</td>
    <td>true</td>
  </tr>
  <tr>
    <td>pathType</td>
    <td>The ACL derivative. Defaults to path_beg. SeeHAProxy path for more info.</td>
    <td>No</td>
    <td></td>
    <td>path_beg</td>
  </tr>
  <tr>
    <td>port</td>
    <td>The internal port of a service that should be reconfigured. The port is used only in the swarmmode</td>
    <td>Only in swarmmode</td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td>serviceDomain</td>
    <td>The domain of the service. If specified, the proxy will allow access only to requests coming to that domain.</td>
    <td>No</td>
    <td></td>
    <td>ecme.com</td>
  </tr>
  <tr>
    <td>serviceName</td>
    <td>The name of the service. It must match the name stored in Consul.</td>
    <td>Yes</td>
    <td></td>
    <td>books-ms</td>
  </tr>
  <tr>
    <td>servicePath</td>
    <td>The URL path of the service. Multiple values should be separated by a comma (,).</td>
    <td>Yes (unless consulTemplatePath is present)</td>
    <td></td>
    <td>/api/v1/books</td>
  </tr>
  <tr>
    <td>skipCheck</td>
    <td>Whether to skip adding proxy checks. This option is used only in the defaultmode.</td>
    <td>No</td>
    <td>false</td>
    <td>true</td>
  </tr>
</table>


### **Remove**

Removes a service from the proxy

The following query arguments can be used to send a *remove* request to *Docker Flow: Proxy*. They should be added to the base address [PROXY_IP]:[PROXY_PORT]/v1/docker-flow-proxy/remove.

<table>
  <tr>
    <td>Query</td>
    <td>Description</td>
    <td>Required</td>
    <td>Default</td>
    <td>Example</td>
  </tr>
  <tr>
    <td>serviceName</td>
    <td>The name of the service. It must match the name stored in Consul</td>
    <td>Yes</td>
    <td></td>
    <td>go-demo</td>
  </tr>
  <tr>
    <td>distribute</td>
    <td>Whether to distribute a request to all the instances of the proxy. Used only in the swarm mode.</td>
    <td>No</td>
    <td>false</td>
    <td>true</td>
  </tr>
</table>


----

So This is probably the fastest path available today to a functional docker platform.  Just use docker swarm mode and then add in docker-flow-proxy.  There’s a *A LOT* that this doesn’t do but that’s kind of the point.  If you want to know more about more advanced implementations, just drop me a line at faddat@gmail.com preferably using Google Hangouts.  

Next article will be on the easiest to run docker platform:  [Rancher](https://rancher.com).
----
## If you enjoyed this post, please thank @officialfuzzy with a follow and an appearance on his weekly show!
### If you enjoyed this post, please follow me, @faddat!
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 94 others
properties (23)
authorfaddat
permlinkroll-your-own-docker-platform-faster-and-cheaper-than-the-cloud-more-rebellious-than-legal-weed
categorybeyondbitcoin
json_metadata{"tags":["beyondbitcoin","steem","docker","linux","systems"],"image":["https://www.steemimg.com/images/2016/09/14/Model-of-cluster62821.png","http://www.nextplatform.com/wp-content/uploads/2016/03/rancher-private-container-block-diagram.jpg","http://www.nextplatform.com/wp-content/uploads/2016/03/rancher-block-diagram.jpg","https://www.steemimg.com/images/2016/09/14/CiscoUCSb11e4.jpg"],"links":["https://steemit.com/beyondbitcoin/@faddat/systems-geek-series-example-bash-for-roll-your-own-docker-platform-manual","http://www.jimmysfriedchicken.com","http://www.nextplatform.com/2016/03/29/rancher-rides-herd-containers-borg-style/","https://github.com/vfarcic/docker-flow-proxy:","https://rancher.com"],"users":["officialfuzzy","faddat"]}
created2016-09-14 14:50:09
last_update2016-09-14 22:01:51
depth0
children6
last_payout2016-10-16 06:19:54
cashout_time1969-12-31 23:59:59
total_payout_value536.294 HBD
curator_payout_value92.643 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length7,240
author_reputation36,581,868,473,026
root_title"[SYSTEMS GEEK SERIES] Roll your own Docker Platform: Faster and cheaper than the cloud, more rebellious than legal weed!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,243,777
net_rshares103,809,296,266,237
author_curate_reward""
vote details (158)
@blend ·
$0.13
Nice! A bit complicated but still well done!
👍  
properties (23)
authorblend
permlinkre-faddat-roll-your-own-docker-platform-faster-and-cheaper-than-the-cloud-more-rebellious-than-legal-weed-20160914t145058790z
categorybeyondbitcoin
json_metadata{"tags":["beyondbitcoin"]}
created2016-09-14 14:52:06
last_update2016-09-14 14:52:06
depth1
children0
last_payout2016-10-16 06:19:54
cashout_time1969-12-31 23:59:59
total_payout_value0.098 HBD
curator_payout_value0.032 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length44
author_reputation814,142,283,510
root_title"[SYSTEMS GEEK SERIES] Roll your own Docker Platform: Faster and cheaper than the cloud, more rebellious than legal weed!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,243,792
net_rshares517,306,458,679
author_curate_reward""
vote details (1)
@jessej · (edited)
Cool, But... What is Clustering docker?
And if it like the Cloud that you can OWN!
What's the cost of this in ALL of its GLORY!?
Plus this isn't there any more: https://github.com/vfarcic/docker-flow-proxy:
properties (22)
authorjessej
permlinkre-faddat-roll-your-own-docker-platform-faster-and-cheaper-than-the-cloud-more-rebellious-than-legal-weed-20160916t031003848z
categorybeyondbitcoin
json_metadata{"tags":["beyondbitcoin"],"links":["https://github.com/vfarcic/docker-flow-proxy:"]}
created2016-09-16 03:09:15
last_update2016-09-16 03:17:12
depth1
children1
last_payout2016-10-16 06:19:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length206
author_reputation20,025,748
root_title"[SYSTEMS GEEK SERIES] Roll your own Docker Platform: Faster and cheaper than the cloud, more rebellious than legal weed!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,261,642
net_rshares0
@faddat ·
There's a lot more than docker-flow-proxy.  My setup costs me about $160/mo for four skylake quad core servers with 32gb and 2 SSDs each.  

Here's the link to the bash:  https://steemit.com/beyondbitcoin/@faddat/systems-geek-series-example-bash-for-roll-your-own-docker-platform-manual
properties (22)
authorfaddat
permlinkre-jessej-re-faddat-roll-your-own-docker-platform-faster-and-cheaper-than-the-cloud-more-rebellious-than-legal-weed-20160916t043354329z
categorybeyondbitcoin
json_metadata{"tags":["beyondbitcoin"],"links":["https://steemit.com/beyondbitcoin/@faddat/systems-geek-series-example-bash-for-roll-your-own-docker-platform-manual"]}
created2016-09-16 04:33:54
last_update2016-09-16 04:33:54
depth2
children0
last_payout2016-10-16 06:19:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length286
author_reputation36,581,868,473,026
root_title"[SYSTEMS GEEK SERIES] Roll your own Docker Platform: Faster and cheaper than the cloud, more rebellious than legal weed!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,262,235
net_rshares0
@linkback-bot-v0 ·
This post has been linked to from another place on Steem.


  - [Steemit Club 500 - 15 September 2016](https://steemit.com/stats/@topten/steemit-club-500-15-september-2016) by @topten


Learn more about [**linkback bot v0.4**](https://steemit.com/steem/@ontofractal/steem-linkback-bot-v0-4-released). Upvote if you want the bot to continue posting linkbacks for your posts. Flag if otherwise.

Built by @ontofractal
properties (22)
authorlinkback-bot-v0
permlinkre-faddat-roll-your-own-docker-platform-faster-and-cheaper-than-the-cloud-more-rebellious-than-legal-weed-linkbacks
categorybeyondbitcoin
json_metadata{}
created2016-09-16 13:22:00
last_update2016-09-16 13:22:00
depth1
children0
last_payout2016-10-16 06:19:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length416
author_reputation1,915,954,976,722
root_title"[SYSTEMS GEEK SERIES] Roll your own Docker Platform: Faster and cheaper than the cloud, more rebellious than legal weed!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,265,602
net_rshares0
@miserableoracle ·
$0.13
This is sooooo advanced.. I feel like learning rocket science.. 
The efforts you've put into this.. Awesome... ^^
👍  
properties (23)
authormiserableoracle
permlinkre-faddat-roll-your-own-docker-platform-faster-and-cheaper-than-the-cloud-more-rebellious-than-legal-weed-20160914t145755582z
categorybeyondbitcoin
json_metadata{"tags":["beyondbitcoin"]}
created2016-09-14 14:57:57
last_update2016-09-14 14:57:57
depth1
children0
last_payout2016-10-16 06:19:54
cashout_time1969-12-31 23:59:59
total_payout_value0.098 HBD
curator_payout_value0.032 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length113
author_reputation1,655,543,921,926
root_title"[SYSTEMS GEEK SERIES] Roll your own Docker Platform: Faster and cheaper than the cloud, more rebellious than legal weed!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,243,864
net_rshares517,306,458,679
author_curate_reward""
vote details (1)
@zionuziriel ·
Thanks for sharing it. Nice post!
properties (22)
authorzionuziriel
permlinkre-faddat-roll-your-own-docker-platform-faster-and-cheaper-than-the-cloud-more-rebellious-than-legal-weed-20160916t021022941z
categorybeyondbitcoin
json_metadata{"tags":["beyondbitcoin"]}
created2016-09-16 02:12:06
last_update2016-09-16 02:12:06
depth1
children0
last_payout2016-10-16 06:19:54
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length33
author_reputation382,539,730,607
root_title"[SYSTEMS GEEK SERIES] Roll your own Docker Platform: Faster and cheaper than the cloud, more rebellious than legal weed!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id1,261,228
net_rshares0