23
Contain(erize) The Tests @markeijsermans

Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Embed Size (px)

Citation preview

Page 1: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Contain(erize)The Tests@markeijsermans

Page 2: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Software Engineer

Love DevOps

Love Docker

Page 3: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

When you're a hammer...

Page 4: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Our unit test problemsmonolithic code basecomplex setupfew mockshits databasesslow

Page 5: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Jenkins WoesJenkins was bottlenecking our server configurationsPhp 5.5.x roll-out took months

Page 6: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

...the nail

Page 7: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Parallelize the testssolved a problemlow risk

Page 8: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Jenkins x Jenkinsrun tests on 10 (or more) slavesgoal: Docker and git are the only dependencies

Page 9: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

unittest.sh kickoff scriptprivate docker registrycontainer for running testlinked container for dbs

Page 10: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Results25min down to 3min (could still be lower)...but, not all is rosy

Page 11: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Findings

Page 12: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Configuration Management

How to integrate Ansbile?

sshd adds +40MB (seems wrong)installed Ansible in base imagemaybe provision with chroot? (but lose layering)Packer.io? isn't quite there yetCM integration with Docker rumored

[soon to be fixed]

Page 13: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Why not just use Ansibledirectly on slaves?

continuous integration is continually integrating itself!automatic refresh (pull) before running testseasy to scale more slavesslaves re-usable for other tasks - not polluted with dependenciespart of the experiment!

Page 14: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

The "PID 1" problemneeds to watch sub-processes if they die and re-launchcan't be SIGKILL'dsome hacks needed to quiet upstartwe used supervisord - works wellinit integration coming (systemd, SysV, etc.)

[soon to be fixed]

Page 15: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

libcontainernew in version 0.9nsinit allows you to attachmight be implemented as "docker exec"lxc namespacing still has lxc-attach

Page 16: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Registry is slow from the cloudpush/pulling from local network to EC2 is painful+1GB containers!how about a local mirror?EDIT: added to the docker-registry a few weeks ago

[fixed]

Page 17: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Trimming the fatinstalling packages dumps a TON of stuff on the systemgreat way to find out what a package doesdpkg --no-install-recommendsfilter out /usr/share/{man | doc | info}trash apt cache (+100MB)flatten: docker export -> import

[solvable]

Page 18: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Container layering questionsbase -> Ansible -> runtime -> app -> unit test extras

Page 19: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Linking containerscumbersome.lots of verbose ENV VARS

ambassador container (hacky)?service discovery - serf, etcd, etc?

DB_PORT_3306_TCP=tcp://127.0.0.1

DB_PORT_3306_TCP_ADDR=127.0.0.1

DB_PORT_3306_TCP_PORT=3306

DB_PORT_3306_TCP_PROTO=tcp

...

[unknown]

Page 20: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Unknown maintenance profilenot all *nix tools ready for namespacingfree & top are broken (shows full system memory allocation)logs (on aufs, inside the container - good/bad?)problem? copy container locally, inspect?

Page 21: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

API first design*except a some commands like attach

Page 22: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Great for open-sourcinga projectdocker run ... done!

Page 23: Docker-Vancouver Meetup - March 18, 2014 - Contain(erize) the tests - Mark Eijsermans

Thank [email protected]@hootsuite.com