How developer's life gets easier

  • Situation
    • One pipeline
  • Solution
    • Multiple pipelines
  • Demo
  • Summary

Shipping ...

Shipping ...

Git helps us to handle complexity ...

GitHub

So our deployments should be easy, right?

Still waiting?

Is this your deployment pipeline?

Classic Build Pipeline Setup

Our Solution

Important steps to remove typical bottlenecks:

  • Use branches for each feature or hot-fix
  • Have automated tests
  • Have pre-commit testing, before merging into master
  • Have each feature branch deployed on your stage.

Dockerize a Node webapp

        FROM iojs:1.6.3-onbuild
        # That's all.

        # + using unusual runtime - here: io.js
        # + automatically runs npm install on-build
        # + copies additional files considering .dockerignore
      

GitHub Branching

Idea: Let's have one branch per feature

Tagging the Docker Image

'latest' won't work.

PROJ=project-x
GIT_BRANCH=feature-1

IMAGE=$PROJ:$GIT_BRANCH
CONTAINER=$PROJ_$GIT_BRANCH

docker build -t $IMAGE .
docker run -d -P \
    --name $NAME $IMAGE

# optionally add git_hash ...
        

Nice!

... who can send me a link to the latest version?

Nginx Proxy

Possible mapping schemes:

  • Forwarding to "upstream servers":
  • http:// feature-1_ABD134EF .stage.ci/project/
  • Forwarding and url rewriting :
  • http://stage.ci/project/ feature-1_ABD134EF

Complex? These Nginx configurations should be generated and deleted automatically!

Solution: nginx-proxy

Jason Wilder created a simple tool for automatic Nginx proxy configuration:

      docker run -d -p 80:80 \
        -v /var/run/docker.sock:/tmp/docker.sock \
        -t jwilder/nginx-proxy
      

Built-in Nginx, listens to docker events, uses docker-gen with host-based-rules templating

Containers need extra parameter

      docker run -P d -name project:branchName \
         -e VIRTUAL_HOST=project-branchName.dev-stage
        project:branchName
      

curl http://project-branchName.dev-stage/index.html

Nginx gets automatically configured on start and stop.

Demo

Alternatives

Thanks For Listening

Links

Images