amazon web services - How Docker and Ansible fit together to implement Continuos Delivery/Continuous Deployment -
i'm new configuration management , deployment tools. have implement continuous delivery/continuous deployment tool 1 of interesting projects i've ever put hands on.
first of all, individually, i'm comfortable aws
, know ansible
is, logic behind , purpose. not have same level of understanding of docker
got idea. went through lot of internet resources, can't the big picture.
what i've been struggling how fit together. using ansible
, can manage infrastructure code; building ec2
instances, installing packages... can deploy full application pulling code, modify config files , start web server. docker
is, itself, tool packages application , ensures can run wherever deploy it.
my problems are:
how docker (or ansible , docker) extend continuous integration process!?
suppose have source code repository, team members finish working on feature , push work. jenkins detects this, runs acceptance/unit/integration test suites , if passed, declares stable build. how docker fits here? mean when team pushes work, jenkins have pull docker file source coded within app, build image of application, start container , run tests against or runs tests classic way , if builds docker image docker file , saves in private place? should jenkins tag final image using x.y.z example!?
docker containers configuration :
suppose have image built jenkins
stored somewhere, how handle deploying same image different environments, , even, different configurations parameters ( vhosts config, db hosts, queues urls, s3 endpoints, etc...) flexible way deal issue without breaking docker
principles? these configurations backed in image when gets build or when container based on started, if how injected?
ansible , docker:
ansible
provides docker
module manage docker
containers. assuming solved problems mentioned above, when want deploy new version x.t.z of app, tell ansible
pull image stored on, start app container, how inject configuration settings!? ansible have log in docker image, before it's running ( sounds insane me ) , use jinja2 templates same way classic host!? if not, how handled?!
excuse me if long question or if misspelled something, thinking out loud. i'm blocked past 2 weeks , can't figure out correct workflow. want reference future readers.
please, helpful read experiences , solutions because looks common workflow. thank in advance. appreciated.
i answer in parts
how docker (or ansible , docker) extend continuous integration process!?
since docker images same everywhere, use docker images if production images. therefore, when committed code, build docker image. run tests against it. when tests pass, tag image accordingly. since docker fast, feasible workflow. docker changes incremental; therefore, images have minimal impact on storage. when tests fail, may choose save image too. in way, developer pull image , investigate why tests failed. developer may choose run tests in machine since docker images in jenkins , machine not different.
what brings developers have same environment, same version of software since decide 1 used in docker images. have come across bugs due differences between developer machines. example in same operating system, unicode settings may affect code. in docker images developers test against same settings, same version software.
docker containers configuration :
if using private repository, , should use one, configuration changes not affect hard disk space much. therefore except security configurations, such db passwords, can apply configuration changes docker images(baking configuration container). can use ansible apply not-stored configurations deployed images before/after startup using environment variables or docker volumes.
does ansible have log in docker image, before it's running ( sounds insane me ) , use jinja2 templates same way classic host!? if not, how handled?!
no, ansible not log in docker image, ansible jinja2 templates can used change dockerfile. can change dockerfile templates , can inject configuration different files. tag files accordingly , have configured images spin up.
Comments
Post a Comment