Top Banner
ACHIEVING CONTINUOUS DELIVERY: AN AUTOMATION STORY
39
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Achieving Continuous Delivery: An Automation Story

ACHIEVING CONTINUOUSDELIVERY:

AN AUTOMATION STORY

Page 2: Achieving Continuous Delivery: An Automation Story

ABOUT MEJAMES CAMMARATA, DIRECTOR - CORE ENGINEERING

Python developer since 2003

Started contributing to Cobbler in September of 2008, and tookover the project leadership in 2010

Joined Ansible in July, 2013

Page 3: Achieving Continuous Delivery: An Automation Story

WHAT IS CONTINUOUSDELIVERY?

Page 4: Achieving Continuous Delivery: An Automation Story

Continuous delivery aims to reduce the impact of releasingsoftware by doing it more frequently.

Popularized in the book 'Continuous Delivery: Reliable SoftwareReleases through Build, Test, and Deployment Automation',

written by Jez Humble and David Farley in 2010.

Page 5: Achieving Continuous Delivery: An Automation Story

(VIDEO)

Page 6: Achieving Continuous Delivery: An Automation Story

WHY USE ANSIBLE FORCONTINUOUS DELIVERY?

Page 7: Achieving Continuous Delivery: An Automation Story

SIMPLICITYNo agents, and a clean playbook syntax are undoubtably

Ansible's two greatest strengths.

Page 8: Achieving Continuous Delivery: An Automation Story

AUTOMATION OF COMPLEX DEPLOYMENTORCHESTRATION

Rolling reboots of web serversMigrating primary/secondary/tertiary databases like MySQLBuilding and deploying new AMIs/virtual instances orcontainers for immutable infrastructureRemoving/re-enabling monitoring on servers or services beingupdated

Page 9: Achieving Continuous Delivery: An Automation Story

REUSABILITY AND CONSISTENCYDevelopers using Vagrant or other setups locally can easilycheck out the exact same playbooks run in staging and/orproduction to ensure consistency.Your CI system can use the exact same playbooks too, ratherthan shell scripting everything.

Page 10: Achieving Continuous Delivery: An Automation Story

EXTENSIBILITYAnsible has over 250 modules included, but if you need tointerface with an API we don't support, writing modules toextend the functionality is very easy and straightforward.

Page 11: Achieving Continuous Delivery: An Automation Story

OTHERS HAVE ALREADY DONE THISTons of blogs out there already outline how to set all of this upusing Ansible, so most of the hard work has been done for you!

Ansible's user community has exploded, and getting help is easy.

Page 12: Achieving Continuous Delivery: An Automation Story

COMMON PATTERNS

Page 13: Achieving Continuous Delivery: An Automation Story

CONTINUOUS INTEGRATION SYSTEMJenkins/Hudson, TravisCI, etc.

(source, DevOps Reactions – http://bit.ly/1NkG1ax)

Page 14: Achieving Continuous Delivery: An Automation Story

SOURCE CONTROLStores both the application code and your Ansible playbooks

(infrastructure as data, not code).

All commits trigger an automatic deployment to the staging/QAenvironment(s), followed by automated testing.

If the automated testing passes, the deployment to productioncan triggered by a person or automatically.

Page 15: Achieving Continuous Delivery: An Automation Story

AUTOMATED TESTINGAbsolutely critical to continuous integration and delivery,

automated testing is what verifies your code is ok to deploy.

Unit testingIntegration testingSelenium, Ghost / CasperJS, etc.

Page 16: Achieving Continuous Delivery: An Automation Story

MONITORING (ALL THE THINGS!)Log and graph everything (Graphite and other popular projects

make this nearly trivial). This is how you diagnose problems withany given deployment later.

(source, https://codeascraft.com/2010/12/08/track-every-release/)

An excellent Digital Ocean blog on Graphite+statsd+collectd:http://bit.ly/1Gx4UM2

Page 17: Achieving Continuous Delivery: An Automation Story

CHATOPS

Page 18: Achieving Continuous Delivery: An Automation Story

BENEFITS OF CHATOPS:Everyone knows what everyone else is doing, leading to anincreased level of transparency across your teams.Because of this transparency, these actions also become self-documenting which helps new hires learn the ropes morequickly, especially if they're remote.Communication is instantaneous and more fluid, as Ops don'thave to flip between email or head off to a 'war room' forissues.Time to execute actions is reduced, as there is now a singleinterface to trigger actions on disparate pieces ofinfrastructure.

Page 19: Achieving Continuous Delivery: An Automation Story

CASE STUDIES

Page 20: Achieving Continuous Delivery: An Automation Story

ATLASSIAN

Page 21: Achieving Continuous Delivery: An Automation Story

Atlassian is a very well known software company, with productssuch as JIRA, HipChat and Confluence to name a few.

Uses Ansible to address what they call the 'last mile problem', orthe final step in continuous deployment.

From their blog:

Developers perform continous testing/integration againstfeature branchesAfter these feature branches are merged into the releasebranch, Bamboo (Atlassian's CI product) is used to create abuild artifact (binary)Ansible is used to deploy this same artifact to each of thestaging, QA and production environments in turn

Page 22: Achieving Continuous Delivery: An Automation Story

ATLASSIAN (CONT.)Advantages:

1. Promoting the same build artifact through each environmentensures consistency.

2. Despite using in-house products, their approach is verytechnology agnostic and could easily be adapted to other tools.

Disadvantages: Internal teams are very segregated, with strictseparation of duties (silos) for deployments.

Page 23: Achieving Continuous Delivery: An Automation Story

RISINGSTACK

Page 24: Achieving Continuous Delivery: An Automation Story

RisingStack is a JavaScript consultancy group, focusing onNodeJS delivery.

Using CodeShip (a 3rd party service) and a custom web hookservice to trigger Docker builds and Ansible deployments to

automate their container-based approach to immutableinfrastructure.

(source: http://blog.risingstack.com/shipping-node-js-applications-with-docker-and-codeship/)

Page 25: Achieving Continuous Delivery: An Automation Story

RISINGSTACK (CONT.)From their blog:

Commits to the master branch trigger trigger builds in theCodeShip serviceIf all tests pass, a new docker image is created and uploaded toDocker HubAfter the upload is complete, another web hook is triggered ontheir (custom, in-house) service which executes AnsibleAnsible downloads and deploys the new docker image on eachapplication server

Page 26: Achieving Continuous Delivery: An Automation Story

RISINGSTACK (CONT.)Advantages: Completely automated with no intervention

required to deploy.

Disadvantages: Custom service, when an off-the-shelf CI systemcould be used to simplify things.

Page 27: Achieving Continuous Delivery: An Automation Story

BIGPANDA

Page 28: Achieving Continuous Delivery: An Automation Story

BigPanda is a company centered around automating incidentmanagement, and use ChatOps and Ansible heavily in their day

to day operations

5 Reasons We Love Using Ansible for Continuous Delivery -http://bit.ly/1EkbqEi

Their motto is: 'Make the scariest part of the build the easiest'.

Page 29: Achieving Continuous Delivery: An Automation Story

BIGPANDA (CONT.)Use a combination of HipChat and Hubot (called BeanBotinternally) to automate ops tasks (a one-person ops team).

Page 30: Achieving Continuous Delivery: An Automation Story

GRASSWIRE

Page 31: Achieving Continuous Delivery: An Automation Story

GrassWire is a recent startup built around crowd-sourcing factverification in news reports.

Another ChatOps follower, GrassWire deploys their software viaSlack, which natively supports executing webhooks remotely and

does not require a chat bot.

Use Packer to build new AMIs via Jenkins, and use Ansible todeploy those new images to production along with their

application.

Using Terraform to build initial AWS environments, rather thanCloudFormation or other tools.

Page 32: Achieving Continuous Delivery: An Automation Story

GRASSWIRE (CONT.)Their Packer integration also uses Tower, to take advantage of

the provisioning callback feature.

"provisioners": [{ "type": "file", "source": "./{{user ̀gw_env̀}}/setup_callback.sh", "destination": "/home/ec2-user/setup_callback.sh" }, {"type": "shell", "inline": [ "sudo chmod +x /home/ec2-user/setup_callback.sh", "echo sh /home/ec2-user/setup_callback.sh | sudo tee --append /etc/rc.local ]}}]

Since they also use Tower for other tasks, they are able to use thetower-cli command directly in Jenkins to simplify their Jenkins

tasks.

Page 33: Achieving Continuous Delivery: An Automation Story

TIPS AND TRICKS

Page 34: Achieving Continuous Delivery: An Automation Story

USE ANSIBLE TO BUILD YOUR CONTINUOUS DELIVERYENVIRONMENT

Roles exist (on Galaxy and generally on Github) to build all ofthese components for you now. Use them to get up and running

quickly.

Page 35: Achieving Continuous Delivery: An Automation Story

USE ANSIBLE FROM DAY 1If you do anything, do it from Ansible. Don't SSH to a server, just

put whatever it is you need to do in a playbook and run thatinstead.

Page 36: Achieving Continuous Delivery: An Automation Story

QUESTIONS?

Page 37: Achieving Continuous Delivery: An Automation Story

ATTRIBUTIONS:LEGO Great Ball Contraption (GBC) Layout 2012.9https://www.youtube.com/watch?v=sUtS52lqL5w

DevOps Reactions: Continuous Deliveryhttp://bit.ly/1NkG1ax

Code as Craft Blog: Tracking Every Releasehttps://codeascraft.com/2010/12/08/track-every-release/

Digital Ocean Blog: An Introduction to Tracking Statistics withGraphite, StatsD, and CollectD

http://bit.ly/1Gx4UM2

Atlassian Blog: Practical Continuous Deployment:http://www.slideshare.net/tarkasteve/london-atlassian-user-

group-february-2014

Page 38: Achieving Continuous Delivery: An Automation Story

ATTRIBUTIONS (CONT.):RisingStack: Shipping Node.js Applications with Docker and

Codeshiphttp://blog.risingstack.com/shipping-node-js-applications-with-

docker-and-codeship/

BigPanda:#ChatOpsFTW: http://www.slideshare.net/chuparkoff/chatops-

ftw5 Reasons We Love Using Ansible for Continuous Delivery:

http://bit.ly/1EkbqEi

Page 39: Achieving Continuous Delivery: An Automation Story

THANKS!twitter: jimi1283 github: jimi-c