Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Unicode Character 'HAPPY PERSON RAISING ONE HAND' (U+1F64B)

Slide 5

Slide 5 text

Hosting?

Slide 6

Slide 6 text

Testing?

Slide 7

Slide 7 text

Live Testing?

Slide 8

Slide 8 text

OS Updates?

Slide 9

Slide 9 text

Deployments?

Slide 10

Slide 10 text

Load Balancing?

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

SIN CE 2000

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

(#) Internet

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

(d|t) Digital Transformation

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

System Container?

Slide 22

Slide 22 text

System? Container

Slide 23

Slide 23 text

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!

Slide 24

Slide 24 text

MACHINE CPU, RAM, BIOS/IO ("physical hardware")

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

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

Slide 27

Slide 27 text

APPLICATION OS KERNEL MACHINE Server Machine "Bare Metal"

Slide 28

Slide 28 text

Virtualization

Slide 29

Slide 29 text

VirtualBox XEN LXD Docker

Slide 30

Slide 30 text

APPLICATION OS KERNEL MACHINE H VirtualBox "Hardware Virtualization"

Slide 31

Slide 31 text

XEN "Paravirtualization" APPLICATION OS KERNEL MACHINE

Slide 32

Slide 32 text

APPLICATION OS KERNEL MACHINE LXD "System Container"

Slide 33

Slide 33 text

APP APP APP LIB LIB LIB KERNEL MACHINE Docker "Application Container"

Slide 34

Slide 34 text

LXD

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

Features ● Images ● Instant Snapshots ● Remotes, Transfer ● Space efficient ● Disc- / Ram- / CPU Efficiency!

Slide 37

Slide 37 text

LXC CLI LXD Daemon LXC / Net.-Bridge ZFS LXD Components / Architecture

Slide 38

Slide 38 text

C:\>_ LXD Operations LXC local Commands

Slide 39

Slide 39 text

Create Container lxc launch ubuntu:16.04 my-container

Slide 40

Slide 40 text

List Containers lxc list

Slide 41

Slide 41 text

Start Container lxc start my-container

Slide 42

Slide 42 text

Stop Container lxc stop my-container

Slide 43

Slide 43 text

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

Slide 44

Slide 44 text

Copy Container lxc copy my-container new-con

Slide 45

Slide 45 text

Rename Container lxc move my-container mynewname

Slide 46

Slide 46 text

Destroy Container lxc delete my-container

Slide 47

Slide 47 text

Snapshots Points in Time Icon made by Madebyoliver from www.flaticon.com is licensed by CC 3.0 BY

Slide 48

Slide 48 text

Create Snapshot lxc snapshot my-container or lxc snapshot my-container my-snap

Slide 49

Slide 49 text

Delete Snapshot lxc delete my-container/snapshot

Slide 50

Slide 50 text

Restore Snapshot lxc restore my-container snapshot

Slide 51

Slide 51 text

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

Slide 52

Slide 52 text

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

Slide 53

Slide 53 text

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

Slide 54

Slide 54 text

= ? GB Icon made by Freepik from www.flaticon.com is licensed by CC 3.0 BY

Slide 55

Slide 55 text

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

Slide 56

Slide 56 text

ZFS Copy - on - Write

Slide 57

Slide 57 text

ZFS Copy - on - Write

Slide 58

Slide 58 text

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

Slide 59

Slide 59 text

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

Slide 60

Slide 60 text

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

Slide 61

Slide 61 text

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

Slide 62

Slide 62 text

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

Slide 63

Slide 63 text

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

Slide 64

Slide 64 text

HOSTING

Slide 65

Slide 65 text

HTTP Proxies Exposing Containers

Slide 66

Slide 66 text

Nginx Proxy HTTP Requests LXD Host LXD Container NGINX HTTP Proxy Apache / PHP

Slide 67

Slide 67 text

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; } }

Slide 68

Slide 68 text

NginX Proxy HTTP Requests LXD Host LXD Container A NGINX HTTP Proxy Apache / PHP LXD Container B Apache / PHP

Slide 69

Slide 69 text

Deployment Strategy blue-green

Slide 70

Slide 70 text

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

Slide 71

Slide 71 text

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

Slide 72

Slide 72 text

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

Slide 73

Slide 73 text

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; } }

Slide 74

Slide 74 text

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

Slide 75

Slide 75 text

Deployment Strategy blue-green LXD Host LXD Container B NGINX HTTP Proxy Apache / PHP

Slide 76

Slide 76 text

Image source: http://www.flickr.com/photos/rietje/76566707/ CC BY 2.0

Slide 77

Slide 77 text

Features ● VPCs: Networking / Bridges / ... ● cgroups (...): Limiting Ressources ● Live (State) Migration (experimental) ● Nesting: Docker within LXD Containers ● Setup: Modern Kernel Features required ● OpenStack: Nodes

Slide 78

Slide 78 text

LXD System Containers: Lean & Fast, support Snapshots & Remotes & Transfers

Slide 79

Slide 79 text

Thanks! Questions? Christoph Lühr [email protected] [email protected] @chluehr Slides license Attribution-NonCommercial-ShareAlike 3.0 http://creativecommons.org/licenses/by-nc-sa/3.0/

Slide 80

Slide 80 text

Links & References ● LXD https://linuxcontainers.org/lxd/