Skip to content

Latest commit

 

History

History
669 lines (527 loc) · 16.3 KB

cd-codemotion2014-meetup.org

File metadata and controls

669 lines (527 loc) · 16.3 KB

1

1.1

2 Introduction

2.1

2.1.1 What is this all about?

  • A brief introduction to Continuous Delivery.
  • How each tool fits in the big picture.
  • The approach I propose, without the pain.
  • Help to get you started on your own.
  • Advance towards Continuous Deployment.

3 Continuous Delivery

3.1

3.1.1

3.1.2 Continuous Delivery - Jez Humble and David Farley

\textit{“Encouraging greater collaboration between everyone involved in software delivery in order to release valuable software faster and more reliably.”}

3.2

3.3 Automation

3.3.1 Bots welcome

  • Speed up the release of new features.
  • Special focus on risk: automate everything!
  • Advance towards Continuous Deployment.
  • No need for code freeze.
  • Automated tagging.

4

4.1

5 Maven

5.1

5.1.1 Maven quote

\textit{“Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.”}

5.1.2 Maven logo

\includegraphics[width=100pt]{maven.png}

\small{http://maven.apache.org}

5.2 Modularization

5.2.1 Convention

  • All logic is isolated in its own module.
  • No multi-module projects, unless for WARs.
  • All modules inherit from a common, logic-less module: the parent POM.

5.3 Versioning

5.3.1 Versions are unique and time-ordered

  • All in-house modules share the same version (\texttt{latest-SNAPSHOT}).
  • Actual versions are resolved when generating releases.

5.3.2 version

6

6.1

7 Jenkins

7.1

7.1.1 Jenkins

\textit{“An extendable open source continuous integration server.”}

7.1.2 Jenkins logo

\includegraphics[width=100pt]{jenkins.png}

http://jenkins-ci.org

7.2

7.3 \textit{get-new-version} job

7.3.1 One \textbf{job} to rule them all

  • Helper job to automate the tagging and packaging process.
  • Checks out parent-pom code.
  • Gets launched for every change, and generates a new tagged release.

7.4

7.5

7.5.1

7.6 \textit{get-new-version} job

7.6.1 Maven Embedded is too embedded

  • Maven jobs in Jenkins run Maven Embedded engine.
  • Maven annotates parent jobs as dependencies in the dependency graph.
  • The new \textit{release} job cannot be a Maven job.
  • Otherwise, it triggers an infinite loop of downstream jobs.

8

8.1

9 Docker

9.1

9.1.1 Docker

\textit{“An open platform for distributed applications for developers and sysadmins.”}

9.1.2 Docker

\includegraphics[width=100pt]{docker-whale-home-logo.png}

http://www.docker.com

9.2 Docker

9.2.1 Docker

“The Docker Engine container comprises just the application and its dependencies. It runs as an isolated process in userspace on the host operating system, sharing the kernel with other containers. Thus, it enjoys the resource isolation and allocation benefits of VMs but is much more portable and efficient.”

9.3 Docker Concepts (1)

9.3.1 Packaging applications

  • \textbf{Image}: Packaged application and dependencies. Ready to launch.
  • \textbf{Container}: An isolated (process, memory, network, etc.) environment, running an \textit{image}.
  • \textbf{Volume}: A folder within a container, accessible from the host. Can be directly mapped to a folder in the host.

9.4 Docker Concepts (2)

9.4.1 Running applications

  • \textbf{Link}: Docker mechanism to help containers communicate with each other. It’s defined as \texttt{–link container:alias}:
    • \textit{container}: the name of the external, already running container,
    • \textit{alias}: the name used locally in the new container, pointing to the external container. Docker adds it to /etc/hosts, and defines some environment properties.
  • \textbf{Exposed port}: Docker service can map host ports to internal ports, when the container starts.

9.5 phusion-baseimage

9.5.1 Cleaning things up

  • A minimal Ubuntu base image modified for Docker-friendliness.
  • Takes care of the problem of:
    • Zombie processes,
    • Logger daemon,
    • Cron jobs.
  • Motivation explained in their website: “Your Docker image might be broken without you knowing it”

https://phusion.github.io/baseimage-docker/

9.6 Dockerfile templates

9.6.1 Variables in Dockerfiles

  • Based on wking’s approach and code for Gentoo-based images: https://github.com/wking/dockerfile
  • Modified for phusion-baseimage.
  • Enhanced with in-house bash scripting framework: dry-wit.
  • Allows placeholders in Dockerfiles.

10

10.1

11 MCollective

11.1

11.1.1 MCollective

\textit{“MCollective is a powerful orchestration framework.}

\textit{Run actions on thousands of servers simultaneously, using existing plugins or writing your own.”}

11.1.2 MCollective

\includegraphics[width=100]{mcollective-logo.png}

\small{http://www.puppetlabs.com}

11.2 ssh in a loop (1)

11.2.1 Pros

  • Simple and straightforward.
  • Fast enough up to a certain number of hosts.
  • Easy and cheap to adapt to perform different tasks.
  • Scriptable.

11.3 ssh in a loop (2)

11.3.1 Cons

  • Scripts with hard-coded host names or IPs.
  • Requires way too much information about the production environment.
  • Cannot easily run remote commands which expect some kind of interaction.
  • When the number of host grows, the risk of overlook reported problems increases.
  • Requires dealing with account permissions, SSO, etc.

11.4 MCollective

11.4.1 Pros

  • Scales with the number of hosts in production.
  • Extendable via plugins.
  • Doesn’t require system accounts, SSO on production hosts.
  • Puppet module available for servers.

11.4.2 Cons

  • More complex architecture.
  • Requires middleware.
  • Scaling beyond certain size requires tuning.
  • Middleware should be fault-tolerant.
  • Misconfigured setups can generate excessive traffic.

11.5 Architecture

11.6 Middleware

12

12.1

13 Shipyard

13.1

13.1.1 Citadel

\textit{“Citadel is a toolkit for scheduling containers on a Docker cluster.”}

13.1.2 Citadel

\includegraphics[width=100]{citadel-logo.png}

\small{http://citadeltoolkit.org}

13.2 Shipyard

13.2.1 \textit{Composable Docker Management}

\textit{“Built on the Docker cluster management toolkit Citadel, Shipyard gives you the ability to manage Docker resources [..]”}

Plus: application routing and load balancing, centralized logging, deployment, etc.

13.2.2 Shipyard

\includegraphics[width=100]{shipyard-logo.png}

\small{http://shipyard-project.com}

13.3

13.4

14

14.1

15 Puppet

15.1

15.1.1 Puppet

\textit{“Puppet manages your servers: you describe machine configurations in an easy-to-read declarative language, and Puppet will bring your systems into the desired state and keep them there.”}

15.1.2 Puppet

\includegraphics[width=100]{puppet-logo.png}

\small{http://www.puppetlabs.com}

15.2

15.3 Puppet on guests

15.3.1 Pros

  • Images can be deployed anywhere.
  • It doesn’t require a convention to map host volumes or data containers.
  • Containers can respond to changes propagated via Puppet.

15.3.2 Cons

  • Containers take much longer to start.
  • Automatic generation, auto-sign, and auto-accept SSL certificates.
  • Puppet infrastructure required in production.

15.4 Puppet on hosts

15.4.1 Pros

  • Containers are stateless.
  • Containers launch fast.

15.4.2 Cons

  • Containers need to be prepared to read their configuration from plain files.
  • The command for launching containers depends on the Puppet configuration for that host.
  • Puppet infrastructure required in production.

15.5 Puppet to manage data-container images

15.6 Environment isolated in data containers

15.6.1 Pros

  • Data containers launch the Puppet agent: their configuration can evolve over time.
  • Puppet sets up the configuration depending on the environment.
  • Launching containers do not depend on the host.

15.6.2 Cons

  • Puppet infrastructure needed in production.
  • SSL certificate magic takes place on data containers.

16 Next steps

16.1

16.2 Now what?

16.2.1 First things first

16.3 And then?

16.3.1 Customize and test

  • Build mcollective-client and mcollective-server images.
  • Install shipyard and mcollective server agent in a test environment.
  • Launch docker containers from the mcollective client, via mcollective shell agent.
  • Try Interlock in the path to Continuous Deployment!