pc = personal cloud for codemotion (milan)

74
01

Upload: aestas-it

Post on 04-Jul-2015

267 views

Category:

Technology


0 download

DESCRIPTION

Have you ever wished to run production clone on your laptop to find that annoying bug? With decreasing hardware costs and growing hardware performance characteristics it becomes possible. Virtualization tools like VirtualBox come very handy at simulating real OS with real setup. Tools like Vagrant (VirtualBox wrapper) make it even easier. This presentation gives several hands-on demonstrations of Vagrant capabilities and the simplicity of integrating that into your normal development cycle.

TRANSCRIPT

Page 1: PC = Personal Cloud for CodeMotion (Milan)

01

Page 2: PC = Personal Cloud for CodeMotion (Milan)

LicenseCreative Commons 3.0 (BY­NC­SA)

02

Page 3: PC = Personal Cloud for CodeMotion (Milan)

About me03

Page 4: PC = Personal Cloud for CodeMotion (Milan)

Andrey AdamovichBio: Developer, coach, speaker, author, father

Company: Aestas/IT (http://aestasit.com)

E­mail: [email protected]

Linkedin: http://www.linkedin.com/in/andreyadamovich

Lanyrd: http://lanyrd.com/profile/andrey­adamovich

GitHub: https://github.com/aadamovich

SO: http://stackoverflow.com/users/162792/andrey­adamovich

Twitter: @aestasit

••••••••

04

Page 5: PC = Personal Cloud for CodeMotion (Milan)

Hardwareprogress

05

Page 6: PC = Personal Cloud for CodeMotion (Milan)

CPU DB: Recording MicroprocessorHistory

06

Page 7: PC = Personal Cloud for CodeMotion (Milan)

Multi­core processorsMost of modern processors are multi­core

Many of them use advanced techniques to support better parallelism

and resource utilisation (hyper­threading, caching etc.)

Many of them are optimized for virtualization

••

07

Page 8: PC = Personal Cloud for CodeMotion (Milan)

My laptop4 cores, 2.9GHz each, 16GB of RAM, 250GB SSD + 250GB HD

During coding, answering e­mails etc. hardly half of the cores is used

My mobile phone has as many cores as my laptop

My game console (Wii) is way less powerful than my phone

••••

08

Page 9: PC = Personal Cloud for CodeMotion (Milan)

Otherexamples

09

Page 10: PC = Personal Cloud for CodeMotion (Milan)

Paralella

10

Page 11: PC = Personal Cloud for CodeMotion (Milan)

Raspberry Pi cluster

11

Page 12: PC = Personal Cloud for CodeMotion (Milan)

OK12

Page 13: PC = Personal Cloud for CodeMotion (Milan)

Let's talkabout clouds

13

Page 14: PC = Personal Cloud for CodeMotion (Milan)

What iscloud?

14

Page 15: PC = Personal Cloud for CodeMotion (Milan)

Definition: CloudA cloud is a visible mass of liquid droplets or frozen crystals made of

water or various chemicals suspended in the atmosphere above the

surface of a planetary body.

Source: Wikipedia“15

Page 16: PC = Personal Cloud for CodeMotion (Milan)

Definition: Cloud computing ICloud computing is computing in which large groups of remote servers

are networked to allow centralized data storage and online access to

computer services or resources.

Source: Wikipedia“16

Page 17: PC = Personal Cloud for CodeMotion (Milan)

Definition: Cloud computing IICloud computing relies on sharing of resources to achieve coherence

and economies of scale, similar to a utility (like the electricity grid) over

a network.

Source: Wikipedia“17

Page 18: PC = Personal Cloud for CodeMotion (Milan)

Definition: Cloud computing IIICloud computing, or in simpler shorthand just "the cloud", also focuses

on maximizing the effectiveness of the shared resources.

Source: Wikipedia“18

Page 19: PC = Personal Cloud for CodeMotion (Milan)

X­as­a­ServiceSoftware­as­a­Service (users)

Platform­as­a­Service (devs)

Infrastructure­as­a­Service (devs + ops)

•••

19

Page 20: PC = Personal Cloud for CodeMotion (Milan)

IaaSIf you know how to work with your servers, then on top of IaaS you can

build other XaaS.

20

Page 21: PC = Personal Cloud for CodeMotion (Milan)

Components of effective IaaSVirtualized Computing + Storage services

Networking + Security services

OS image library service

Rich API

••••

21

Page 22: PC = Personal Cloud for CodeMotion (Milan)

IaaS componentsservers

disks

ip addresses

firewall settings (optional)

images (starting point)

snapshots (backups)

••••••

22

Page 23: PC = Personal Cloud for CodeMotion (Milan)

IaaS examplesAWS EC2

Google Compute Engine

Microsoft Azure

Digital Ocean

••••

23

Page 24: PC = Personal Cloud for CodeMotion (Milan)

IaaS vs.private cloud

24

Page 25: PC = Personal Cloud for CodeMotion (Milan)

In­house virtualizationComercial: VMWare, Oracle*, Parallels

Open­source: VirtualBox, KVM, Qemu, Xen, Docker, OpenStack••

25

Page 26: PC = Personal Cloud for CodeMotion (Milan)

VirtualBox

26

Page 27: PC = Personal Cloud for CodeMotion (Milan)

VirtualBoxPowerful virtualization product for enterprise as well as home use

It has nice GUI and command line tools with tons of parameters

It is open­source and free for personal use

•••

27

Page 28: PC = Personal Cloud for CodeMotion (Milan)

A bit of historyCreated by innotek GmbH

Open­sourced in 2007

innotek was acquired by Sun in 2008

Sun was acquired by Oracle in 2010

••••

28

Page 29: PC = Personal Cloud for CodeMotion (Milan)

VirtualBox islocal IaaS?29

Page 30: PC = Personal Cloud for CodeMotion (Milan)

Computingservices

30

Page 31: PC = Personal Cloud for CodeMotion (Milan)

Computing servicesWell, it's a virtualization software

Suports x86 and AMD64/Intel64

Supports many operating systems (Windows, Linux, Solaris, MacOS)

•••

31

Page 32: PC = Personal Cloud for CodeMotion (Milan)

Storageservices

32

Page 33: PC = Personal Cloud for CodeMotion (Milan)

Storage servicesWell, it's limited only by physical disk size

The faster the better (SSD?)••

33

Page 34: PC = Personal Cloud for CodeMotion (Milan)

Disk file formatsVDI (VirtualBox)

VMDK (VMWare)

VHD (Windows)

HDD (Parallels)

••••

34

Page 35: PC = Personal Cloud for CodeMotion (Milan)

Disk typesFixed­size disk file

Slower creation time, faster writes

Dynamically allocated storage file

Faster creation time, slower writes

File size is growing when more disk sectors are written

Defragmenting disk inside guest OS will reduce file size

••

••••

35

Page 36: PC = Personal Cloud for CodeMotion (Milan)

Networkingservices

36

Page 37: PC = Personal Cloud for CodeMotion (Milan)

VirtualBox networkingNAT with port forwarding

Bridged networking

Internal networking

Host­only netwokring

••••

37

Page 38: PC = Personal Cloud for CodeMotion (Milan)

IP address pool192.168.*.*  = 65'536 addresses

127.0.0.*  = 256 addresses••

38

Page 39: PC = Personal Cloud for CodeMotion (Milan)

HostsOn *nix in  /etc/hosts

On Windows in  C:\Windows\System32\drivers\etc\hosts••

39

Page 40: PC = Personal Cloud for CodeMotion (Milan)

Hosts file example   192.168.33.15  local.solaris.messagebroker.net

   192.168.48.112 local.ubuntu.app.it

   127.0.0.212    local.active.directory.com

01.

02.

03.

40

Page 41: PC = Personal Cloud for CodeMotion (Milan)

The cheapestDNS ever!

41

Page 42: PC = Personal Cloud for CodeMotion (Milan)

DisplayBuilt­in viewer

RDP/VNC

Headless mode

•••

42

Page 43: PC = Personal Cloud for CodeMotion (Milan)

SnapshotsVM settings

Virtual disk state (differencing)

Memory

•••

43

Page 44: PC = Personal Cloud for CodeMotion (Milan)

Image libraryLet's wait with this one a bit...

44

Page 45: PC = Personal Cloud for CodeMotion (Milan)

API =VBoxManage

45

Page 46: PC = Personal Cloud for CodeMotion (Milan)

VirtualBox commands

46

Page 47: PC = Personal Cloud for CodeMotion (Milan)

Vagrant

47

Page 48: PC = Personal Cloud for CodeMotion (Milan)

Vagrant featuresSimplified VirtualBox management (networking, security, shared

drives, etc.)

Easy to read and share configuration

Package virtual machines as reusable boxes

••

48

Page 49: PC = Personal Cloud for CodeMotion (Milan)

As simple as...   vagrant init ubuntu/trusty64

   vagrant up

   vagrant ssh

01.

02.

03.

49

Page 50: PC = Personal Cloud for CodeMotion (Milan)

Demo I50

Page 51: PC = Personal Cloud for CodeMotion (Milan)

Image library51

Page 52: PC = Personal Cloud for CodeMotion (Milan)

Vagrant cloud

52

Page 53: PC = Personal Cloud for CodeMotion (Milan)

What if thereis no suitablebox there?53

Page 54: PC = Personal Cloud for CodeMotion (Milan)

Create yourown!

54

Page 55: PC = Personal Cloud for CodeMotion (Milan)

Packer55

Page 56: PC = Personal Cloud for CodeMotion (Milan)

How to make an imageDownload ISO file with your (favorite) OS

Download VirtualBox guest additions ISO to match VirtualBox

version

Free up local disk space (2x used virtual disk size + ISO size)

Set­up environment variables

Create Packer's JSON configuration

Start Packer build

Go somewhere for 30­40 minutes

1.

2.

3.

4.

5.

6.

7.

56

Page 57: PC = Personal Cloud for CodeMotion (Milan)

Packer command    packer build ‐force solaris11.json 01.

57

Page 58: PC = Personal Cloud for CodeMotion (Milan)

How to use the imagevagrant box add my/solaris11 solaris11.box ‐‐force

vagrant init my/solaris11

vagrant up

1.

2.

3.

58

Page 59: PC = Personal Cloud for CodeMotion (Milan)

Demo II59

Page 60: PC = Personal Cloud for CodeMotion (Milan)

Disk re­sizing IFirst resize the file inside VirtualBox

Then resize partition in the guest OS

Choose maximum size carefully

•••

60

Page 61: PC = Personal Cloud for CodeMotion (Milan)

Disk re­sizing II    VBoxManage modifyhd <absolute path to file> \

                        ‐‐resize <size in MB>

01.

02.

61

Page 62: PC = Personal Cloud for CodeMotion (Milan)

Imaginary setup

62

Page 63: PC = Personal Cloud for CodeMotion (Milan)

Demo III63

Page 64: PC = Personal Cloud for CodeMotion (Milan)

VirtualBox­only solution

64

Page 65: PC = Personal Cloud for CodeMotion (Milan)

VirtualBox + Docker

65

Page 66: PC = Personal Cloud for CodeMotion (Milan)

Summary66

Page 67: PC = Personal Cloud for CodeMotion (Milan)

FormulaVirtualBox + Vagrant(Cloud) + Packer = Personal Cloud

67

Page 68: PC = Personal Cloud for CodeMotion (Milan)

Recap: Components of effective IaaSVirtualized Computing + Storage services

Networking + Security services

OS image library service

Rich API

••••

68

Page 69: PC = Personal Cloud for CodeMotion (Milan)

Personal cloud componentsMulti­core laptop or desktop computer

VirtualBox (or VMWare) + Vagrant for virtualization

Packer (and patience) for image creation

VagrantCloud or external USB drive for image library

/etc/hosts, NAT, tunnelling for DNS and other network magic

Provisioning tools (Puppet, Chef, Ansible etc.) to fully setup your cloud

machines

Version control to keep track of your machine definitions

••••••

•69

Page 70: PC = Personal Cloud for CodeMotion (Milan)

Documentation & linkshttps://www.virtualbox.org/manual/UserManual.html

https://docs.vagrantup.com/v2/

https://www.packer.io/docs

https://vagrantcloud.com/

••••

70

Page 71: PC = Personal Cloud for CodeMotion (Milan)

Technologies to followAutomation: Vagrant, Packer and other tools form HashiCorp

Virtualization: VirtualBox, VMWare, Parallels, Hyper­V, Xen etc.

Containers: Docker ecosystem

Build your own IaaS with OpenStack

PaaS offerings: OpenShift, CloudFoundry etc.

Cloud providers: AWS, Azure, GCE

••••••

71

Page 72: PC = Personal Cloud for CodeMotion (Milan)

Questions?72

Page 73: PC = Personal Cloud for CodeMotion (Milan)

Grazie!73

Page 74: PC = Personal Cloud for CodeMotion (Milan)

Slides + codehttps://github.com/aestasit/talks2014­codemotion­milan­pc­personal­

cloud­slides

https://github.com/aestasit/talks2014­codemotion­milan­pc­personal­

cloud­setup

74