Deploying Containers with Rancher

365 views

Published on

You have talked your development team and relevant people into using containers, and everything is going great. Now you need to deploy your app, but how do you do it? How do you manage multiple environments like Staging and Production? How do you get your container images where they need to go? Do you need a full stack of orchestration like Mesos or Kubernetes? Each application and deployment situation is different, but one tool can help small and medium-sized applications manage all these containers floating around. Follow along as we look at Rancher, a free and open source management software for your containers, which will provide you not only with server and container management, but deployment options as well.

Published in: Technology

Deploying Containers with Rancher

  1. 1. Deploying Containers with Rancher Chris Tankersley @dragonmantank Day Camp 4 Developers, Ops for Devs Day Camp 4 Developers - Ops for Devs 1
  2. 2. What Is Rancher? Day Camp 4 Developers - Ops for Devs 2
  3. 3. Rancher and RancherOS Day Camp 4 Developers - Ops for Devs 3
  4. 4. Why Use Rancher? Day Camp 4 Developers - Ops for Devs 4
  5. 5. Manages your Containers Day Camp 4 Developers - Ops for Devs 5
  6. 6. Manages your Hosts Day Camp 4 Developers - Ops for Devs 6
  7. 7. Allows you to monitor containers Day Camp 4 Developers - Ops for Devs 7
  8. 8. Allows you to manage your applications Day Camp 4 Developers - Ops for Devs 8
  9. 9. Allows you to deploy your applications Day Camp 4 Developers - Ops for Devs 9
  10. 10. Allows you to deploy your applications Day Camp 4 Developers - Ops for Devs 10
  11. 11. Supports Docker Compose Day Camp 4 Developers - Ops for Devs 11
  12. 12. Installation Day Camp 4 Developers - Ops for Devs 12
  13. 13. Install Docker on a machine Day Camp 4 Developers - Ops for Devs 13
  14. 14. Using Docker Machine Day Camp 4 Developers - Ops for Devs 14
  15. 15. Our Setup •  3 Machines •  1 Rancher Server •  2 Rancher Nodes •  All running RancherOS •  Docker 1.11 Day Camp 4 Developers - Ops for Devs 15
  16. 16. docker-machine Command docker-machine create -d virtualbox --virtualbox-boot2docker-url http://releases.rancher.com/os/latest/rancheros.iso --virtualbox-memory “2048” [node name] Day Camp 4 Developers - Ops for Devs 16 hMp://docs.rancher.com/os/running-rancheros/workstaQon/docker-machine/
  17. 17. Machines Build Day Camp 4 Developers - Ops for Devs 17
  18. 18. Add rancher/server to the master Day Camp 4 Developers - Ops for Devs 18 docker run -d --restart=always -p 8080:8080 –name=rancher rancher/server
  19. 19. Add rancher/agent to nodes Day Camp 4 Developers - Ops for Devs 19 docker run -d --privileged -v /var/run/docker.sock:/var/run/docker.sock rancher/agent:v0.7.9 http://192.168.99.100:8080/v1/scripts/[hash]
  20. 20. All Done! Day Camp 4 Developers - Ops for Devs 20
  21. 21. Manual Container Deployments Day Camp 4 Developers - Ops for Devs 21
  22. 22. Add Container to Node Day Camp 4 Developers - Ops for Devs 22
  23. 23. Fill out Container Info Day Camp 4 Developers - Ops for Devs 23
  24. 24. Wait for it to become active Day Camp 4 Developers - Ops for Devs 24
  25. 25. Wait for it to become active Day Camp 4 Developers - Ops for Devs 25
  26. 26. See it running Day Camp 4 Developers - Ops for Devs 26
  27. 27. Visit the Container Day Camp 4 Developers - Ops for Devs 27
  28. 28. Metrics Day Camp 4 Developers - Ops for Devs 28
  29. 29. Viewing Container Metrics Day Camp 4 Developers - Ops for Devs 29
  30. 30. Viewing Host Metrics Day Camp 4 Developers - Ops for Devs 30
  31. 31. Stacks Day Camp 4 Developers - Ops for Devs 31
  32. 32. What are Stacks? Day Camp 4 Developers - Ops for Devs 32
  33. 33. Adding a Service Day Camp 4 Developers - Ops for Devs 33
  34. 34. Adding a Service Day Camp 4 Developers - Ops for Devs 34
  35. 35. Adding a Service Day Camp 4 Developers - Ops for Devs 35
  36. 36. Adding a Service Day Camp 4 Developers - Ops for Devs 36
  37. 37. Adding a Service Day Camp 4 Developers - Ops for Devs 37
  38. 38. Rancher Auto-Deploys Day Camp 4 Developers - Ops for Devs 38
  39. 39. Add an Apache/PHP Service Day Camp 4 Developers - Ops for Devs 39
  40. 40. Let it deploy Day Camp 4 Developers - Ops for Devs 40
  41. 41. Visit the web server Day Camp 4 Developers - Ops for Devs 41
  42. 42. Check Deployments in Infrastructure Day Camp 4 Developers - Ops for Devs 42
  43. 43. Custom Repositories Day Camp 4 Developers - Ops for Devs 43
  44. 44. Adding Private/Custom Registry Day Camp 4 Developers - Ops for Devs 44
  45. 45. Type in Auth Info Day Camp 4 Developers - Ops for Devs 45
  46. 46. All the nodes can use it! Day Camp 4 Developers - Ops for Devs 46
  47. 47. Deploying Upgrades Day Camp 4 Developers - Ops for Devs 47
  48. 48. Deployment Types •  Blue-Green Deployments •  Rolling Deployments Day Camp 4 Developers - Ops for Devs 48
  49. 49. Blue-Green Deployments Day Camp 4 Developers - Ops for Devs 49 Router App v1 App v2
  50. 50. Blue-Green Deployments Day Camp 4 Developers - Ops for Devs 50 Router App v3 App v2
  51. 51. Blue-Green Deployments Day Camp 4 Developers - Ops for Devs 51 Router App v3 App v2
  52. 52. Rolling Deployments Day Camp 4 Developers - Ops for Devs 52 App v1
  53. 53. Rolling Deployments Day Camp 4 Developers - Ops for Devs 53 App v2
  54. 54. Rolling Deployments Day Camp 4 Developers - Ops for Devs 54 App v2
  55. 55. New Container for Web Server # Dockerfile FROM php:apache COPY index.php /var/www/html Day Camp 4 Developers - Ops for Devs 55
  56. 56. Push to Docker Hub Day Camp 4 Developers - Ops for Devs 56
  57. 57. Upgrade Webserver Container Day Camp 4 Developers - Ops for Devs 57
  58. 58. Upgrade Webserver Container Day Camp 4 Developers - Ops for Devs 58
  59. 59. Rancher Upgrades it Day Camp 4 Developers - Ops for Devs 59
  60. 60. Rancher lets us know it’s done Day Camp 4 Developers - Ops for Devs 60
  61. 61. Check Container once Upgraded Day Camp 4 Developers - Ops for Devs 61
  62. 62. Rollback or Finish Day Camp 4 Developers - Ops for Devs 62
  63. 63. Do it again •  Edit My Code •  Build My Image •  Push to Docker Hub •  Upgrade the Service Day Camp 4 Developers - Ops for Devs 63
  64. 64. Rancher CLI Day Camp 4 Developers - Ops for Devs 64
  65. 65. What is it? •  Rancher has an API! •  Small executable that interacts with Rancher API •  Kind of like a custom docker-compose Day Camp 4 Developers - Ops for Devs 65
  66. 66. Get an API Key Day Camp 4 Developers - Ops for Devs 66
  67. 67. Get an API Key Day Camp 4 Developers - Ops for Devs 67
  68. 68. Download Rancher CLI Day Camp 4 Developers - Ops for Devs 68
  69. 69. Export Stack Config Day Camp 4 Developers - Ops for Devs 69
  70. 70. Two Config Files Day Camp 4 Developers - Ops for Devs 70
  71. 71. docker-compose.yml Day Camp 4 Developers - Ops for Devs 71
  72. 72. Deploy Script Day Camp 4 Developers - Ops for Devs 72 ACCESS_KEY="C4F407CE1D8C59EB53BE" SECRET="daNENHR241Jzm5Z9iw6VsujD9hWfjHWrDzkKmKiA" RANCHER_URL="http://192.168.99.100:8080" ./rancher-compose --secret-key=${SECRET} --access-key=${ACCESS_KEY} --url=${RANCHER_URL} -- file=docker-compose.yml --rancher-file=rancher-compose.yml -p phptest up --upgrade -d
  73. 73. Edit and Deploy Day Camp 4 Developers - Ops for Devs 73
  74. 74. Edit and Deploy Day Camp 4 Developers - Ops for Devs 74
  75. 75. Finish Upgrade Day Camp 4 Developers - Ops for Devs 75
  76. 76. Storage Pools Day Camp 4 Developers - Ops for Devs 76
  77. 77. What do they do? •  Convoy •  Plugins that allow distributed volumes •  GlusterFS, NFS Day Camp 4 Developers - Ops for Devs 77
  78. 78. Networking Day Camp 4 Developers - Ops for Devs 78
  79. 79. Key Features •  Deployments keep links intact •  Networks can span hosts Day Camp 4 Developers - Ops for Devs 79
  80. 80. Thanks! -  Docker for Developers -  LearningContainers.com -  hMp://ctankersley.com -  @dragonmantank -  chris@ctankersley.com Day Camp 4 Developers - Ops for Devs 80 Rate this talk on Joind.in hMps://joind.in/talk/ce080

×