[SYSTEMS GEEK SERIES] Roll your own Docker Platform: Faster and cheaper than the cloud, more rebellious than legal weed!
beyondbitcoin·@faddat·
0.000 HBD[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></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></center> <center></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></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!
👍 faddat, snowden, gidlark, steempower, blend, ola1, sjamayee, anomaly, miserableoracle, michaeldodridge, idol, jocelyn, error, joseph, hilarski, coar, murh, masteryoda, sakr, mark-waser, digital-wisdom, jwaser, herpetologyguy, morgan.waser, bwaser, ellepdub, ethical-ai, strong-ai, davidjkelley, thegoodguy, craig-grant, stephenkendal, zer0sum, riverhead, donchate, andu, biophil, blueorgy, creemej, fjccoin, poteshnik83, sunshine, heimindanger, lichtblick, ausbitbank, bitcoiner, steemleak, bitchplease, freesteem, dealzgal, steemchain, whalepool, merej99, brendio, michellek, kurtbeil, bigsambucca, freebornangel, roadhog, post-successful, jademont, cryptoctopus, anduweb, brindleswan, rxhector, masterinvestor, tycho, silver, silversteem, thecyclist, nextgencrypto, berniesanders, justin, steemservices, nextgenwitness, bentley, thecurator, fabien, officialfuzzy, fuzzyvest, james-show, sergey44, cass, laonie1, laonie2, laonie3, laonie4, laonie5, laonie6, laonie7, laonie8, laonie9, laonie10, laonie11, anonymous, summon, chris4210, stan, ned, matrixdweller, kaptainkrayola, curpose, ailo, prof, confucius, roto, revelbrooks, crion, morse, steemo, vive, wiss, stroully, lillianjones, buffett, igtes, ficholl, hitherise, fortuner, thadm, johnbyrd, bane, steemster1, coad, widell, jarvis, thermor, ciao, steema, yorsens, sharon, troich, eavy, sofa, msjennifer, thomasaustin, kurzer42, publicworker, joelbow, steempty, dmacshady, tinfoilfedora, kottai, warplat, asmolokalo, mynameisbrian, flexoble, l0k1, jessej, zionuziriel, rusla, hannixx42, someguy123, igster, drac59, mindfreak, rampant, mystictot,