Pro Yearly is on sale from $80 to $50! »

LXD System Containers [en]

LXD System Containers [en]

Berlin PHP User Group @bephpug, March 7th, 2017

6e15b56fcb16fae0747810827be8ce8f?s=128

Christoph Lühr

March 07, 2017
Tweet

Transcript

  1. Christoph Lühr @chluehr / bePHPug 2017-03-07 LXD System Containers

  2. None
  3. None
  4. Unicode Character 'HAPPY PERSON RAISING ONE HAND' (U+1F64B)

  5. Hosting?

  6. Testing?

  7. Live Testing?

  8. OS Updates?

  9. Deployments?

  10. Load Balancing?

  11. None
  12. None
  13. SIN CE 2000

  14. Image source: http://www.flickr.com/photos/robby_van_moor/5702589201/ CC BY-ND 2.0

  15. None
  16. (#) Internet

  17. None
  18. (d|t) Digital Transformation

  19. https://en.wikipedia.org/wiki/File:Pimcore-logo-2016.svg

  20. https://en.wikipedia.org/wiki/File:Pimcore-logo-2016.svg

  21. System Container?

  22. System? Container

  23. Photo: drosen7900 http://www.flickr.com/photos/59691268@N00/26337022226 "The Internet Archive" Via: Photopin License: CC

    BY-NC-ND-2.0 https://creativecommons.org/licenses/by-nc-nd/2.0/ SERVER!
  24. MACHINE CPU, RAM, BIOS/IO ("physical hardware")

  25. LINUX / OS Kernel + Userspace (Init, Shells, Tools, Libs)

  26. APPLICATION PHP, Mysql, Redis, ... (Daemons, Services & Code)

  27. APPLICATION OS KERNEL MACHINE Server Machine "Bare Metal"

  28. Virtualization

  29. VirtualBox XEN LXD Docker

  30. APPLICATION OS KERNEL MACHINE H VirtualBox "Hardware Virtualization"

  31. XEN "Paravirtualization" APPLICATION OS KERNEL MACHINE

  32. APPLICATION OS KERNEL MACHINE LXD "System Container"

  33. APP APP APP LIB LIB LIB KERNEL MACHINE Docker "Application

    Container"
  34. LXD

  35. http://design.ubuntu.com/brand/canonical-logo

  36. Features • Images • Instant Snapshots • Remotes, Transfer •

    Space efficient • Disc- / Ram- / CPU Efficiency!
  37. LXC CLI LXD Daemon LXC / Net.-Bridge ZFS LXD Components

    / Architecture
  38. C:\>_ LXD Operations LXC local Commands

  39. Create Container lxc launch ubuntu:16.04 my-container

  40. List Containers lxc list

  41. Start Container lxc start my-container

  42. Stop Container lxc stop my-container

  43. Execute (in) Container lxc exec my-container my-cmd

  44. Copy Container lxc copy my-container new-con

  45. Rename Container lxc move my-container mynewname

  46. Destroy Container lxc delete my-container

  47. Snapshots Points in Time Icon made by Madebyoliver from www.flaticon.com

    is licensed by CC 3.0 BY
  48. Create Snapshot lxc snapshot my-container or lxc snapshot my-container my-snap

  49. Delete Snapshot lxc delete my-container/snapshot

  50. Restore Snapshot lxc restore my-container snapshot

  51. Create from Snapshot lxc copy my-container/my-snap \ new-container

  52. Space Requirements Icon made by Freepik from www.flaticon.com is licensed

    by CC 3.0 BY
  53. Icon made by Freepik from www.flaticon.com is licensed by CC

    3.0 BY 1 LXD Container = 1 GB
  54. = ? GB Icon made by Freepik from www.flaticon.com is

    licensed by CC 3.0 BY
  55. = ~1 GB! Icon made by Freepik from www.flaticon.com is

    licensed by CC 3.0 BY
  56. ZFS Copy - on - Write

  57. ZFS Copy - on - Write

  58. Remotes Image source: http://www.iconarchive.com/show/ios7-icons-by-icons8/Network-Remote-Control-icon.html

  59. Start remote Container lxc start my-remote:my-container

  60. All CLI remotely! lxc xxxxx my-remote:my-container

  61. Copy to Remote lxc copy my-container/my-snap \ my-remote:

  62. Recap: Container Spec. remote:my-container/my-snap

  63. Demo https://linuxcontainers.org/lxd/try-it/

  64. HOSTING

  65. HTTP Proxies Exposing Containers

  66. Nginx Proxy HTTP Requests LXD Host LXD Container NGINX HTTP

    Proxy Apache / PHP
  67. server { listen 80; server_name www.website.de; location / { proxy_pass

    http://10.1.1.264:80; client_max_body_size 100M; proxy_connect_timeout 300; proxy_send_timeout 300; proxy_read_timeout 300; send_timeout 300; } }
  68. NginX Proxy HTTP Requests LXD Host LXD Container A NGINX

    HTTP Proxy Apache / PHP LXD Container B Apache / PHP
  69. Deployment Strategy blue-green

  70. Deployment Strategy blue-green LXD Host LXD Container A NGINX HTTP

    Proxy Apache / PHP
  71. Deployment Strategy blue-green LXD Host LXD Container A NGINX HTTP

    Proxy Apache / PHP Snapshot copy of A
  72. Deployment Strategy blue-green LXD Host LXD Container A NGINX HTTP

    Proxy Apache / PHP LXD Container B Apache / PHP Testing
  73. server { listen 80; server_name www.website.de; set $host_blue 10.31.1.199; set

    $host_green 10.31.1.4; set $upstream $host_green; # default! if ($http_x_debug = "green") { set $upstream $host_green; } if ($http_x_debug = "blue") { set $upstream $host_blue; } location / { proxy_pass http://$upstream:80; } }
  74. Deployment Strategy blue-green LXD Host LXD Container B NGINX HTTP

    Proxy Apache / PHP LXD Container A Destroyed
  75. Deployment Strategy blue-green LXD Host LXD Container B NGINX HTTP

    Proxy Apache / PHP
  76. Image source: http://www.flickr.com/photos/rietje/76566707/ CC BY 2.0

  77. Features • VPCs: Networking / Bridges / ... • cgroups

    (...): Limiting Ressources • Live (State) Migration (experimental) • Nesting: Docker within LXD Containers • Setup: Modern Kernel Features required • OpenStack: Nodes
  78. LXD System Containers: Lean & Fast, support Snapshots & Remotes

    & Transfers
  79. Thanks! Questions? Christoph Lühr luehr@r-pentomino.de christoph.luehr@basilicom.de @chluehr Slides license Attribution-NonCommercial-ShareAlike

    3.0 http://creativecommons.org/licenses/by-nc-sa/3.0/
  80. Links & References • LXD https://linuxcontainers.org/lxd/