lightweight continuous delivery for small schools

41
Lightweight continuous delivery for small schools Charles Fulton (Lafayette College) Kevin Wiliarty (Hampshire College) #ne12

Upload: charles-fulton

Post on 18-Jan-2017

295 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: Lightweight continuous delivery for small schools

Lightweight continuous delivery for small schoolsCharles Fulton (Lafayette College)

Kevin Wiliarty (Hampshire College)

#ne12

Page 2: Lightweight continuous delivery for small schools

...or, “Script and version all the things!”

Page 3: Lightweight continuous delivery for small schools

Who we are● Charles Fulton (@mackensen), Senior Web Applications Developer, Lafayette

College

● Kevin Wiliarty, Senior Web Programmer, Hampshire College

Page 4: Lightweight continuous delivery for small schools

What we’re doing here● A free and open source self-hosted continuous delivery stack

● We’re going to give you all the nouns

● Yes, all of them

Page 5: Lightweight continuous delivery for small schools

Continuous deliveryContinuous Delivery is a software development discipline where you build software in

such a way that the software can be released to production at any time.

You achieve continuous delivery by continuously integrating the software done by the

development team, building executables, and running automated tests on those

executables to detect problems.

-- Martin Fowler

http://martinfowler.com/bliki/ContinuousDelivery.html

Page 6: Lightweight continuous delivery for small schools

ChallengesVersion control

Collaboration

Quality assurance

Integration

Delivery

SolutionsGit

GitLab

Behat

Docker

Capistrano

Page 7: Lightweight continuous delivery for small schools

Version control

Page 8: Lightweight continuous delivery for small schools

Benefits of using git

http://guides.beanstalkapp.com/version-control/intro-to-version-control.html

● It helps you master complexity

● It permits you to disperse development

● It’s both free and open source

● It’s inevitable

Page 9: Lightweight continuous delivery for small schools

Complexity

http://gource.io/

● Track changes, but for an entire project

● Visualize the progression of your project over time

● Maintain versioned branches

● Manage local customizations

● Have the confidence to make major changes

Page 10: Lightweight continuous delivery for small schools

Dispersal● No “central” repository with git

● Cheap branching and merging

● Concurrent development across teams

Publish

WorkDev #1

Dev #2http://marklodato.github.io/visual-git-guide/index-en.html

Page 11: Lightweight continuous delivery for small schools

Free and open source● No artificial limitations

● Total ownership of the tools and the resulting product

http://choosealicense.com/

Page 12: Lightweight continuous delivery for small schools

Inevitability“In 2010, SVN was still the top version control system, used in 60% of software projects,

while Git was used in just 11%. But today, Git has nearly matched SVN’s market share.”

-- Nadia Eghbal

https://medium.com/@nayafia/we-re-in-a-brave-new-post-open-source-world-56ef46d152a3

Page 13: Lightweight continuous delivery for small schools

Collaboration

Page 14: Lightweight continuous delivery for small schools

Social coding: Github● Store

● Distribute

● Expose

● Report

● Follow

● Document

● Visualize

● Test

● Fork

● Contribute

Page 15: Lightweight continuous delivery for small schools

Fork and Contribute

Page 16: Lightweight continuous delivery for small schools

Institutional coding: GitLab

● Identity management

● Institutional continuity

● Audience control

● Price

● Openness and freedom

https://about.gitlab.com/

Page 17: Lightweight continuous delivery for small schools

Quality assurance

Page 18: Lightweight continuous delivery for small schools

Testing your assumptions● Manual testing is time-intensive and boring every time you do it

● Automated testing is time-intensive and boring once, and then never again

● Manual testing makes you hesitant to make major changes

● Automated testing gives you the confidence to destroy everything at once

https://docs.moodle.org/dev/Testing

Page 19: Lightweight continuous delivery for small schools

Behat● Automated

● Behavior-driven

● User stories

http://docs.behat.org/en/v3.0/

Page 21: Lightweight continuous delivery for small schools

Telling your code a story before bed

Page 23: Lightweight continuous delivery for small schools

Look, Ma, no head!

http://tenon.io/

● Computers don't need to look at a

browser

● Headless testing can expose

accessibility issues

Page 24: Lightweight continuous delivery for small schools

Integration

Page 25: Lightweight continuous delivery for small schools

Continuous integration, continuously● Establish a sane process

● Test every commit

● Stay out of the gears

Page 26: Lightweight continuous delivery for small schools

Look, Ma, no nothin'!

Page 27: Lightweight continuous delivery for small schools

Containers: Docker

● Software containers

● Scriptable

● Available on demand

● Disposable

● Repeatable

https://medium.freecodecamp.com/a-beginner-friendly-introduction-to-containers-vms-and-docker-79a9e3e119b

Page 28: Lightweight continuous delivery for small schools

.gitlab-ci.yml

● GitLab launches Docker containers

● Installs latest version of project

● Runs your tests

● Reports your results

https://about.gitlab.com/gitlab-ci/

Page 29: Lightweight continuous delivery for small schools

Test results

Page 30: Lightweight continuous delivery for small schools

Fork, Test, Contribute, Test

Page 31: Lightweight continuous delivery for small schools

Delivery

Page 32: Lightweight continuous delivery for small schools

Last-mile problem● All this talk of projects, it’s exhausting

● How do I make my project useful?

● Manual solution: climb pole maintain clone of

repository on production server

Page 33: Lightweight continuous delivery for small schools

Downsides to climbing utility pole● Introduces scope for error

● Requires “physical” access to the server

● Maintains the full history of the project on the server

Page 34: Lightweight continuous delivery for small schools

A pipeline, not a utility pole1. Commit your change

2. Tests pass

3. ???

4. Profit!

Page 35: Lightweight continuous delivery for small schools

Capistrano● Ruby application

● Manages the deployed state of your project, in addition to code

● Deployments can be executed locally, or from another system

http://capistranorb.com/

Page 36: Lightweight continuous delivery for small schools

Extended metaphor about the American cliff swallow● Swallows always return to Capistrano...something something...delivery!

● Swallows may or may not take trains to Capistrano.

Page 37: Lightweight continuous delivery for small schools

Capistrano in a container● Provision one more docker container with ruby and SSH

● Add a job to .gitlab-ci.yml to run the deploy task in a ruby container

http://sites.lafayette.edu/fultonc/2015/11/12/quick-note-on-agent-forwarding-with-docker/

Page 38: Lightweight continuous delivery for small schools

Script and version all the things!● Everything is in git and attached to your project:

○ Code changes

○ Acceptance tests

○ Testing environment configuration

○ Deployment configuration

Page 39: Lightweight continuous delivery for small schools

Building your pipeline1. Commit my changes in git

2. Push them to GitLab

3. GitLab spins up a Docker container to run QA tests

4. The tests pass

5. GitLab spins up another Docker container to deploy the project

6. Profit!

Page 40: Lightweight continuous delivery for small schools

Questions?

Page 41: Lightweight continuous delivery for small schools

Image credits● Git logo by Jason Long [CC BY 3.0], via Wikimedia Commons

● GitHub logo https://github.com/logos

● GitHub octocat https://github.com/logos

● GitLab wordmark https://about.gitlab.com/press/

● Docker logo https://www.docker.com/brand-guidelines

● User icon (modified) by WMF User Experience Design Group [MIT License], via

Wikimedia Commons

● Man on telephone pole by Unknown or not provided (U.S. National Archives and

Records Administration) [Public domain], via Wikimedia Commons

● Second Los Angeles Aqueduct Cascades, Sylmar by Los Angeles [CC BY-SA 3.0]

via Wikimedia Commons

● Cliff swallow in flight by Don DeBold, [CC BY 2.0], via Flickr