docker containers & the future of drupal testing

36
Docker Containers: Testing automation and development in Drupal. Amsterdam - DevOps meetup, September 2014 A new strategy for automating Drupal testing @ricardoamaro

Upload: ricardo-amaro

Post on 29-Nov-2014

307 views

Category:

Technology


0 download

DESCRIPTION

Story of an investigation to improve cloud The sad VirtualMachine story Containers and non-containers DEMO - Drupal Docker Drupal Testbots story in a Glance Docker as a testing automation factor DEMO - Docker Tesbot Integration path

TRANSCRIPT

Page 1: Docker containers & the Future of Drupal testing

Docker Containers: Testing automation and development in Drupal.

Amsterdam - DevOps meetup, September 2014

A new strategy for automating Drupal testing@ricardoamaro

Page 2: Docker containers & the Future of Drupal testing

Free/Opensource software loverSenior Cloud Engineer @AcquiaDrupal.org infrastructure/devopsDrupalist & Linux enthusiast

Father, artist, community facilitator

@ricardoamarohttps://drupal.org/user/666176

About me

Page 3: Docker containers & the Future of Drupal testing

Story of an investigation to improve cloud

1. The sad VirtualMachine story

2. Containers and non-containers

3. DEMO - Drupal Docker

4. Drupal Testbots story in a Glance

5. Docker as a testing automation factor

6. DEMO - Docker Tesbot

7. Integration path

today’s meetup

Page 4: Docker containers & the Future of Drupal testing

Hardware virtualization or platform virtualization refers to the creation of a virtual machine that acts like a real computer with an operating system.

Software executed on these virtual machines is separated from the underlying hardware resources.

What is virtualization?

Page 5: Docker containers & the Future of Drupal testing

Cloud infrastructure providers like Amazon Web Service sell virtual machines. EC2 revenue is expected to surpass $1B in revenue this year. That's a lot of VMs…

Why should i care?Increase

+ efficiency+ availability+ security

Reduce

- costs- hardware- energy

Page 6: Docker containers & the Future of Drupal testing

Virtual Machine platforms

Page 7: Docker containers & the Future of Drupal testing

➢ We are also paying for lot of avoidable overhead.

➢ The Virtual Machine is a full-blown operating system image.

➢ This is a heavyweight solution to run applications in the cloud.

The sad Virtual Machine story...

Page 8: Docker containers & the Future of Drupal testing

What is the solution?

Page 9: Docker containers & the Future of Drupal testing

Containers used to be terrible, but not anymoreContainers used to be terrible, but not anymore

A new concept, a new hope

Page 10: Docker containers & the Future of Drupal testing

Because Docker has arrived!

Page 11: Docker containers & the Future of Drupal testing

On any recent Linux Kernel near you!

Page 12: Docker containers & the Future of Drupal testing

Source : http://www.linuxjournal.com/content/containers%E2%80%94not-virtual-machines%E2%80%94are-future-cloud

Virtual Machines vs Containers

Virtualization and paravirtualization require a full operating system image for each instance.

Page 13: Docker containers & the Future of Drupal testing

Source : http://www.linuxjournal.com/content/containers%E2%80%94not-virtual-machines%E2%80%94are-future-cloud

Virtual Machines vs Containers

Containers can share a single Linux Kernel and, optionally, other binary and library resources.

Page 14: Docker containers & the Future of Drupal testing

Source : http://www.linuxjournal.com/content/containers%E2%80%94not-virtual-machines%E2%80%94are-future-cloud

Virtual Machines vs Containers

Virtualization and paravirtualization require a full operating system image for each instance.

Containers can share a single operating system and, optionally, other binary and library resources.

Page 15: Docker containers & the Future of Drupal testing

The time to provision

Source : http://www.linuxjournal.com/content/containers%E2%80%94not-virtual-machines%E2%80%94are-future-cloud

Page 16: Docker containers & the Future of Drupal testing

mount /dev/sda /targetchroot /target

but that had no resource and security isolation goals for multi-tenant designs...

From the simple concept of “chroot”

source: http://openvz.org

Page 17: Docker containers & the Future of Drupal testing

CpuDevicesProcessesMemoryDisk spaceNetwork

Wha

t if y

ou co

uld

cont

rol..

.

Page 18: Docker containers & the Future of Drupal testing

Docker

Needcontrol over specifichost resources

cgroupsControl Groups provide a mechanism for aggregating/partitioning sets of tasks, and all their future children, into hierarchical groups with specialized behaviour.

~$ ls /sys/fs/cgroupblkio cpu cpuacct cpuset devices freezer hugetlb memory perf_event

Containers & Cgroups

https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt

Page 19: Docker containers & the Future of Drupal testing

use Docker

Page 20: Docker containers & the Future of Drupal testing

Docker Who??

Page 21: Docker containers & the Future of Drupal testing

this Docker

and ship them as containers

Page 22: Docker containers & the Future of Drupal testing

Ship containers? Build Once, Run Anywhere

Page 23: Docker containers & the Future of Drupal testing

https://github.com/ricardoamaro/docker-drupal

https://github.com/ricardoamaro/docker-drupal-nginx

Build and ship Drupal the Docker way:

Page 25: Docker containers & the Future of Drupal testing

the Commands:

attach Attach to a running container

commit Create a new image from a container's changes

diff Inspect changes on a container's filesystem

export Stream the contents of a container as a tar archive

history Show the history of an image

images List images

import Create a new filesystem image from the contents of a tarball

info Display system-wide information

inspect Return low-level information on a container

kill Kill a running container

login Register or Login to the docker registry server

logs Fetch the logs of a container

port Lookup the public-facing port which is NAT-ed to PRIVATE_PORT

ps List containers

pull Pull an image or a repository to the docker registry server

push Push an image or a repository to the docker registry server

restart Restart a running container

rm Remove a container

rmi Remove an image

run Run a command in a new container

start Start a stopped container

stop Stop a running container

tag Tag an image into a repository

version Show the docker version information

wait Block until a container stops, then print its exit code

The docker is awesome!the Apihttp://docs.docker.io/en/latest/api/registry_index_spec/

the Builderhttp://docs.docker.com/reference/builder/

the Registryhttp://docs.docker.io/en/latest/api/index_api/

Page 26: Docker containers & the Future of Drupal testing

Docker on Docker > v0.6

Page 27: Docker containers & the Future of Drupal testing

Changes to the container can be committed to the central index or rolled back

Continuous Deployments, Development & Testing... Keep only the good apples

Page 28: Docker containers & the Future of Drupal testing

How does this picture help the Drupal testing and the jobrunner?

TESTBOTS

Page 29: Docker containers & the Future of Drupal testing

Testbot is `Sad`

Actual running testbots were created in 2007 and revamped in 2009, need modernizing in order to overcome several pending issues that make them difficult to debug, go faster and be less prone to error.

Since they are full virtual servers, they consume much cpu, memory and IO. A part from that developers have ever increasing demands. Multiple environments and databases need to be tested and contained.

Page 30: Docker containers & the Future of Drupal testing

Testbots(jobrunner)

Runs the actual test

drupal.org

Issue queue starts processand displays

results

qa.drupal.org

keeps track of jobs and detailed

info

Current Drupal testing workflow (simplified):

Page 31: Docker containers & the Future of Drupal testing
Page 33: Docker containers & the Future of Drupal testing

Integration round table:

Page 34: Docker containers & the Future of Drupal testing

Testbot1

drupal.org

Issue queue starts processand displays

results

resultsdrupal.org

keeps track of jobs and detailed

info

New proposed Drupal testing workflow:

Jenkins

Dispatcher

Testbot2

Testbot3

Testbot4

Testbotn

Docker Container types:

- PHP5.3 / PHP5.4 / PHP5.5 / PHP5.6- MariaDB - MySQL- Sqlite - Postgresand others...

API

Page 35: Docker containers & the Future of Drupal testing

@ricardoamaro

Docker Containers: Testing automation

and development in Drupal.Amsterdam - DevOps meetup, September 2014

Page 36: Docker containers & the Future of Drupal testing

@ricardoamaro

Thank you!