Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Docker at Monoco.jp (LinkedIn)

255 views

Published on

  • Be the first to comment

  • Be the first to like this

Docker at Monoco.jp (LinkedIn)

  1. 1. Life before Docker Take notes of what you install and uninstall on the server
  2. 2. Life before Docker Pass along the installation note when someone want to copy the setting
  3. 3. Life Before Docker ➔Why the installation note does not work on their laptop/server? It’s their fault! ➔Production server busted? Go back to installation note.
  4. 4. VM? ➔How can you move it to production? Without rebuilding the image? ➔Can you run multiple instance using the same image? Without duplicating? ➔Shit, I just broke the image. Can we use the previous version? No rebuilding? ➔Can we make it slim? Like just 200MB for nginx stack?
  5. 5. “an open-source project that automates the deployment of applications inside software containers, by providing an additional layer of abstraction and automation of operating system–level virtualization on Linux.” Docker is
  6. 6. Share more resource with host ✓ Lightweight Ship the image anywhere (Linux ;) ✓ Portable Tag the image for archiving ✓ Versioning friendly Build on top other ✓ Stackable
  7. 7. ASCII Demo https://asciinema.org/a/14255
  8. 8. Dockerfile FROM nginx $ docker build -t rtl-nginx . $ docker run -d -p 80:80 rtl-nginx $ open http://172.16.42.43
  9. 9. Dockerfile #2 FROM nginx ADD html /usr/share/nginx/html $ docker build -t rtl-nginx-2 . $ docker kill <pid> $ docker run -d -p 80:80 rtl-nginx-2 $ open http://172.16.42.43
  10. 10. Dockerfile #3 FROM nginx # stale content bug on Nginx x Vagrant x Mac OSX RUN sed -i -e "s/sendfile.*/sendfile off;/g" /etc/nginx/nginx.conf $ docker run -d -p 80:80 -v htdocs/RTL/nginx/html:/usr/share/nginx/html rtl-nginx $ open http://172.16.42.43
  11. 11. Docker implementation 1. Base image a. Start with minimal stack b. Mimic production as much as you can c. Leave third party service alone 2. Dev image a. Add build-tools b. Add testing-tools: selenium, vnc 3. Deployable-image a. Add third party services: newrelic, etc b. Finalize config
  12. 12. Dev Workflow ➔Setup ◆ Virtual Box + Vagrant ◆ boot2docker ◆ docker-osx (directory mapping reason), alt boot2docker ➔Checkout dev image ➔Mess with code ➔Run tests ➔Commit and push
  13. 13. Continuous Integration cont. ➔Devs push code ➔Jenkins runs tests ➔Not OK? ◆ Complain in Hipchat ➔All OK? ◆ Build deployable-image ◆ Push image into private registry ◆ Notify devs on Hipchat
  14. 14. Staging ➔Jenkins runs tests on trunk ➔Build staging image ➔Push staging image to private registry ➔Tell Ansible to reload staging
  15. 15. Staging Env
  16. 16. Staging Env cont. ➔using Fig (http://fig.sh) ➔Images: ◆ web apps ◆ reverse-proxy (https://github.com/jwilder/nginx- proxy) ➔Flow (via Ansible) ◆ pull latest image ◆ restart web app instance ◆ reverse-proxy reloads itself
  17. 17. Production Env ➔Elastic Beanstalk ◆ using .ebextensions scripts to setup EC2 instance ◆ Newrelic for server monitoring ◆ Splunk for logging ➔Manual deployment ◆ i-am-not-so-sure environment ◆ fvck-it-ship-it enviroment
  18. 18. Next, The Holy Grail 12 Factors App http://12factor.net ➔Disposability (stateless) ◆ started or stopped at a moment’s notice ➔Config (via ENV vars) ◆ app’s config varies between dev, staging, production ➔Every setup is different. YMMV.
  19. 19. docker.com/tryit linkedin.com/in/neofreko akhmadf@gmail.com @neofreko

×