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

Preview:

Citation preview

Contain(erize)The Tests@markeijsermans

Software Engineer

Love DevOps

Love Docker

When you're a hammer...

Our unit test problemsmonolithic code basecomplex setupfew mockshits databasesslow

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

...the nail

Parallelize the testssolved a problemlow risk

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

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

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

Findings

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]

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!

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]

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

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]

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]

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

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]

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?

API first design*except a some commands like attach

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

Thank You!@markeijsermansmark.eijsermans@hootsuite.com

Recommended