{"id":2209,"date":"2016-03-14T14:17:25","date_gmt":"2016-03-14T22:17:25","guid":{"rendered":"http:\/\/networkeffects.ca\/?p=2209"},"modified":"2016-03-17T07:19:12","modified_gmt":"2016-03-17T15:19:12","slug":"docker-cloud-byon-docker-compose","status":"publish","type":"post","link":"https:\/\/networkeffects.ca\/?p=2209","title":{"rendered":"Docker Cloud BYON &#038; Docker Compose"},"content":{"rendered":"<div class='e-content'><div style=\"width: 728px\" class=\"wp-caption alignleft\"><a href=\"http:\/\/giphy.com\/gifs\/ship-canal-container-9h92ggQve1Wxy\"><img loading=\"lazy\" decoding=\"async\" class=\"\" src=\"https:\/\/media.giphy.com\/media\/9h92ggQve1Wxy\/giphy.gif\" alt=\"\" width=\"718\" height=\"404\" \/><\/a><p class=\"wp-caption-text\">GIF: http:\/\/giphy.com\/gifs\/ship-canal-container-9h92ggQve1Wxy<\/p><\/div><\/p>\n<p>Late last year, Docker <a href=\"http:\/\/www.infoworld.com\/article\/2994988\/application-virtualization\/docker-grabs-cloud-container-manager-tutum.html\">snapped up cross-cloud container management service Tutum<\/a>, but it wasn&#8217;t clear how the acquired company&#8217;s handiwork would manifest under the Docker brand.\u00a0Tutum was\u00a0built from the ground up as a Docker tool. It gives visibility into containers, and enables a team to create, start, terminate or redeploy as needed. It also provides a dashboard view of all of the containers under team\u00a0management. \u00a0Tutum is now <a href=\"https:\/\/docs.docker.com\/docker-cloud\/release-notes\/#docker-cloud-1-0-release-notes\" target=\"_blank\">Docker Cloud<\/a>. Docker Cloud is a new service by Docker that implements all features previously offered by Tutum plus integration with <a href=\"https:\/\/hub.docker.com\/\" target=\"_blank\">Docker Hub Registry<\/a>.<\/p>\n<p>A group of us in BC are looking for ways\u00a0we can\u00a0provide <a href=\"http:\/\/clintlalonde.net\/2016\/02\/25\/ngdle-and-open-edtech\/\" target=\"_blank\">a more sustainable opened tech infrastructure \u00a0to BC higher education<\/a>. \u00a0We have begun looking for approaches to shared WordPress hosting. \u00a0I have been playing with <a href=\"https:\/\/stackfiles.io\/registry\" target=\"_blank\">Stackfiles<\/a> and <a href=\"https:\/\/docs.docker.com\/compose\/overview\/\" target=\"_blank\">Docker Compose<\/a> for the last few weeks and starting to get a clearer picture of how we might sustainably provide hosting for both dev and production WordPress hosting\u00a0for BC open education initiatives.<\/p>\n<p>As well as deploying and managing hosts on the supported cloud providers (<a href=\"https:\/\/aws.amazon.com\/ec2\/\" target=\"_blank\">EC2<\/a>, <a href=\"https:\/\/azure.microsoft.com\/en-us\/\" target=\"_blank\">Azure<\/a>, etc), Docker Cloud can use any Linux host as a node to deploy containers to. For this, you install an agent\u00a0which will allow you to connect the\u00a0Docker Cloud dashboard to your infrastructure. I went ahead and connected our new <a href=\"https:\/\/www.bc.net\/educloud-server\" target=\"_blank\">EduCloud<\/a> node to Docker Cloud last week and started experimenting with how services are managed. \u00a0Services\/sites can be setup\u00a0directly quickly using the\u00a0Docker Cloud web interface. \u00a0Services\/sites are managed via \u2018stacks\u2019 which are defined using <a href=\"https:\/\/docs.docker.com\/compose\/overview\/\" target=\"_blank\">Docker Compose<\/a>. \u00a0Compose is a tool for defining and running multi-container Docker applications. \u00a0This <a href=\"https:\/\/support.tutum.co\/support\/solutions\/articles\/5000583471-stack-yaml-reference\" target=\"_blank\">&#8216;stackfile&#8217;<\/a> contains the instructions required to pull from required repositories (eg: Docker Hub, Github, etc) and\u00a0configure your application\u2019s services. Then, using a single command, you can create and start all the services.<\/p>\n<p>Once a stackfile is defined, it can be used to deploy and\/or redeploy as many copies of an application as you need. \u00a0I found a &#8216;ready to deploy&#8217; <a href=\"https:\/\/stackfiles.io\/registry\" target=\"_blank\">WordPress stackfile\u00a0at this registry<\/a>:<\/p>\n<p style=\"padding-left: 30px;\"><em>wordpress:<\/em><br \/>\n<em> image: tutum\/wordpress-stackable:latest<\/em><br \/>\n<em> links: <\/em><br \/>\n<em> &#8211; db<\/em><br \/>\n<em> ports:<\/em><br \/>\n<em> &#8211; &#8220;80:80&#8221;<\/em><br \/>\n<em> environment:<br \/>\n<\/em><em>DB_NAME: wordpress<\/em><br \/>\n<em> DB_USER: admin<\/em><br \/>\n<em> DB_PASS: &#8220;**ChangeMe**&#8221;<\/em><br \/>\n<em>db:<\/em><br \/>\n<em> image: tutum\/mysql:5.5<\/em><br \/>\n<em> environment:<\/em><br \/>\n<em> MYSQL_PASS: &#8220;**ChangeMe**&#8221;<\/em><\/p>\n<p>To test out Docker Cloud\/Compose on EduCloud\u00a0I decided to reserve the domain opened.ca, create 2 subdomains, and map a separate WordPress installation to each subdomain. \u00a0I made 2 DNS entries and pointed them all to our EduCloud host.<\/p>\n<ul>\n<li><a href=\"http:\/\/tannismorgan.opened.ca\" target=\"_blank\">tannismorgan.opened.ca<\/a><\/li>\n<li><a href=\"http:\/\/brianlamb.opened.ca\" target=\"_blank\">brianlamb.opened.ca<\/a><\/li>\n<\/ul>\n<p>Without going too far down the Docker technical docs in this post, it is important to know that traffic between containers &amp; external networks runs on Ports. \u00a0No 2 containers be exposed on the same public port for HTTP traffic (Port 80\/443) without a proxy out in\u00a0front to handle traffic. \u00a0To accomplish this I decided to use\u00a0<a href=\"https:\/\/github.com\/jwilder\/nginx-proxy\" target=\"_blank\">nginx-proxy<\/a>, a container running nginx and <a href=\"https:\/\/github.com\/jwilder\/docker-gen\">docker-gen<\/a>. docker-gen generates reverse proxy configs for nginx and reloads nginx when containers are started and stopped thereby\u00a0automating all\u00a0that port mapping between containers and the public IP\/Ports. \u00a0All that is needed to unsure the reverse proxy works properly is to start your WordPress Docker container passing the <a href=\"http:\/\/tech.mybuilder.com\/virtual-hosts-with-docker\/\" target=\"_blank\">VIRTUAL_HOST variable<\/a>.<\/p>\n<p>That means adding 1 line to my Stackfile cribbed from Stackfile.io above and tweaking another:<\/p>\n<pre style=\"padding-left: 30px;\"><em>wordpress:<\/em>\r\n<em>image: tutum\/wordpress-stackable:latest<\/em>\r\n<em>links: <\/em>\r\n<em>- db<\/em>\r\n<em>ports:<\/em>\r\n<em>- \"5000:80\"<\/em>\r\n<em>environment:\u00a0\r\n<\/em><em>VIRTUAL_HOST=tannismorgan.opened.ca<\/em>\r\n<em>DB_NAME: wordpress<\/em>\r\n<em>DB_USER: admin<\/em>\r\n<em>DB_PASS: ----------<\/em>\r\n<em>db:<\/em>\r\n<em>image: tutum\/mysql:5.5<\/em>\r\n<em>environment:<\/em>\r\n<em>MYSQL_PASS: -----------<\/em><\/pre>\n<p>As I will have 2 stacks, I will need 2 internal ports. \u00a0For the purposes of this test I am using 5000 and 5001. \u00a0All of these map to Port 80\/443 facing the web. \u00a0\u00a0<a href=\"https:\/\/github.com\/jwilder\/nginx-proxy\" target=\"_blank\">nginx-proxy<\/a>\u00a0also needs to know what domains to listen for along with their associated internal port so I added the\u00a0<a href=\"http:\/\/tech.mybuilder.com\/virtual-hosts-with-docker\/\" target=\"_blank\">VIRTUAL_HOST variable<\/a>\u00a0and indicated the internal port for the tannismorgan.opened.ca test\u00a0Wordpress container (5000)\u00a0to ensure\u00a0sure the incoming request is routed correctly.<\/p>\n<p>I updated the 2 stackfiles and\u00a0clicked &#8216;Create &amp; Deploy&#8217;. \u00a0From start to finish, provisioning these WordPress sites took minutes.<\/p>\n<p><a href=\"http:\/\/networkeffects.ca\/wp-content\/uploads\/2016\/03\/dockcloud-screenshot.png\" rel=\"attachment wp-att-2205\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2205\" src=\"http:\/\/networkeffects.ca\/wp-content\/uploads\/2016\/03\/dockcloud-screenshot.png\" alt=\"dockcloud-screenshot\" width=\"1205\" height=\"517\" srcset=\"https:\/\/networkeffects.ca\/wp-content\/uploads\/2016\/03\/dockcloud-screenshot.png 1205w, https:\/\/networkeffects.ca\/wp-content\/uploads\/2016\/03\/dockcloud-screenshot-300x129.png 300w, https:\/\/networkeffects.ca\/wp-content\/uploads\/2016\/03\/dockcloud-screenshot-768x330.png 768w, https:\/\/networkeffects.ca\/wp-content\/uploads\/2016\/03\/dockcloud-screenshot-1024x439.png 1024w\" sizes=\"auto, (max-width: 1205px) 100vw, 1205px\" \/><\/a><\/p>\n<ul>\n<li><a href=\"http:\/\/tannismorgan.opened.ca\" target=\"_blank\">tannismorgan.opened.ca<\/a><\/li>\n<li><a href=\"http:\/\/brianlamb.opened.ca\" target=\"_blank\">brianlamb.opened.ca<\/a><\/li>\n<\/ul>\n<p>If you <a href=\"http:\/\/www.infosniper.net\/index.php?ip_address=brianlamb.opened.ca&amp;map_source=1&amp;overview_map=1&amp;lang=1&amp;map_type=1&amp;zoom_level=7\" target=\"_blank\">geolocate\u00a0any of these subdomains<\/a>, you will see that they all indicate they are hosted in Kamloops, BC (when, in fact, they are hosted on EduCloud using clever networking arrangement from TRU-IT folks.)<\/p>\n<p>Docker Cloud could be a dream for multi-tenant WordPress updates\/customizations. Simply make an exact copy of an existing WordPress stack, map your new development domain, and deploy your development spaces. \u00a0When your development is ready for production, change the VIRTUAL_HOST variable on the container to update your domain. Done.<\/p>\n<p>This is a simple example of a multiple MySQL+Wordpress Docker container stack running on EduCloud. <a href=\"https:\/\/hub.docker.com\/explore\/\" target=\"_blank\">There are hundreds of applications available at the Docker Hub.<\/a>\u00a0Looking forward to playing more and learning more with Docker Cloud\u00a0and Docker Compose this week as well as exploring how Docker Cloud might\u00a0be used for our inter-institutional <a href=\"https:\/\/en.wikipedia.org\/wiki\/DevOps\" target=\"_blank\">devops<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>[caption id=\"\" align=\"alignleft\" width=\"718\"] GIF: http:\/\/giphy.com\/gifs\/ship-canal-container-9h92ggQve1Wxy[\/caption] Late last year, Docker snapped up cross-cloud container management service Tutum, but it wasn&#8217;t clear how the acquired company&#8217;s handiwork would manifest under the Docker brand.\u00a0Tutum was\u00a0built from the ground up as a Docker tool. It gives visibility into containers, and enables a team to create, start, terminate or&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"webmentions_disabled_pings":false,"webmentions_disabled":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":3,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":""},"categories":[106,4],"tags":[115,113,114],"class_list":["post-2209","post","type-post","status-publish","format-standard","category-openetc","category-work","tag-bcop","tag-docker","tag-edtech","h-entry","hentry","kind-"],"kind":false,"_links":{"self":[{"href":"https:\/\/networkeffects.ca\/index.php?rest_route=\/wp\/v2\/posts\/2209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/networkeffects.ca\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/networkeffects.ca\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/networkeffects.ca\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/networkeffects.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2209"}],"version-history":[{"count":8,"href":"https:\/\/networkeffects.ca\/index.php?rest_route=\/wp\/v2\/posts\/2209\/revisions"}],"predecessor-version":[{"id":2217,"href":"https:\/\/networkeffects.ca\/index.php?rest_route=\/wp\/v2\/posts\/2209\/revisions\/2217"}],"wp:attachment":[{"href":"https:\/\/networkeffects.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/networkeffects.ca\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/networkeffects.ca\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}