the road to continuous deployment: a case study (dpc16)
TRANSCRIPT
![Page 1: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/1.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
MICHIEL ROOK
![Page 2: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/2.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
ABOUT ME
▸ Java, PHP & Scala contractor
▸ PHP since ’99
▸ Maintainer of Phing
▸ Dutch Web Alliance
▸ http://www.linkedin.com/in/michieltcs
▸ @michieltcs
![Page 3: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/3.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
THIS TALK
▸ Background
▸ The approach
▸ Process / standards
▸ Build pipelines
▸ Results & lessons learned
![Page 4: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/4.jpg)
![Page 5: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/5.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
THE SYSTEM - SAN DIEGO
▸ ... or the Big Ball Of Mud
▸ Large legacy monolith
▸ Generates significant income
▸ Slow
▸ Complex, lots of moving parts
▸ Technical debt
![Page 6: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/6.jpg)
SAN DIEGO FRONTEND
MYSQL DB
SAN DIEGO BACKEND
LOAD BALANCERS / VARNISH
ITBANEN INTERMEDIAIR NATIONALEVACATUREBANK
SAN DIEGO FRONTEND
SAN DIEGO FRONTEND
SAN DIEGO FRONTEND
SAN DIEGO BACKEND
SAN DIEGO BACKEND
SAN DIEGO BACKEND
MEMCACHE FTP EXT. SERVICES
SOLR
![Page 7: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/7.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
THE SYSTEM - SAN DIEGO
▸ 2.5% code coverage
▸ Fragile tests
▸ Low velocity
▸ Frequent outages / bugs / issues
▸ Frustrated team
▸ Low confidence modifying existing code
![Page 8: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/8.jpg)
REFACTOR? REBUILD?
![Page 9: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/9.jpg)
A NEW STACK
![Page 10: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/10.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
THE STACK
![Page 11: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/11.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
APPROACH
▸ Strangler pattern
▸ Proxy to switch between old/new
▸ Migrate individual pages
![Page 12: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/12.jpg)
ORIGINAL MONOLITH
PROXY
SERVICEORIGINAL MONOLITH
ORIGINAL MONOLITH
SERVICE SERVICE
SERVICE
PROXY
DB
DBDB
DB
DB DB
![Page 13: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/13.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
APPROACH
▸ Services per domain object (job, jobseeker, ...)
▸ Services behind load balancers
▸ Access legacy db’s
▸ Continuous deployment
▸ Containers
▸ Frontends are services
![Page 14: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/14.jpg)
SAN DIEGO
ELASTIC SEARCHLEGACY
DB
JOB SERVICE
RMQ
ITBANEN INTERMEDIAIR NATIONALEVACATUREBANK
MONGO DB
ITBANEN
JOBSEEKER SERVICE
NVBINTERMEDIAI
![Page 15: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/15.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
PROXY
# Serve job detail page from new codeRewriteRule ^/vacature/.* /app.php [L,PT]# Proxy php files to php5-fpm ProxyPassMatch ^/(app.php(/.*)?)$ fcgi://127.0.0.1:9000/opt/webapp/web/$1# Proxy everything else to SanDiegoProxyPass / ${SAN_DIEGO__URL} nocanonProxyPassReverse / ${SAN_DIEGO__URL}ProxyPreserveHost On
![Page 16: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/16.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
FEATURE TOGGLES, A/B TESTS
![Page 17: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/17.jpg)
PROCESS
![Page 18: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/18.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
PROCESS
▸ Scrum, 1 week sprints
▸ TDD / BDD
▸ Definition of Done
▸ Team mindset / experience
▸ Focus on value
▸ Replace old features with new (legacy becomes obsolete)
![Page 19: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/19.jpg)
CONTINUOUS EVERYTHING
![Page 20: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/20.jpg)
DEV TEST ACCEPTANCE PRODUCTION
DEV TEST ACCEPTANCE PRODUCTION
CONTINUOUS DELIVERY
CONTINUOUS DEPLOYMENT
![Page 21: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/21.jpg)
ONLY COMMIT TO MASTER
![Page 22: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/22.jpg)
PAIR PROGRAMMING
![Page 23: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/23.jpg)
BOY SCOUT RULE
![Page 24: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/24.jpg)
QUALITY GATES
![Page 25: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/25.jpg)
100% CODE COVERAGE
![Page 26: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/26.jpg)
DASHBOARDS
![Page 27: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/27.jpg)
BUILD PIPELINES
![Page 28: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/28.jpg)
AUTOMATE REPEATABLE THINGS
![Page 29: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/29.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
AUTOMATION
▸ Builds
▸ Testing
▸ Deployments
▸ Orchestration
▸ Config management
![Page 30: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/30.jpg)
EVERY COMMIT GOES TO PRODUCTION
![Page 31: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/31.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
DEFENSE IN DEPTH
UNIT TESTS
SCENARIOS
INTEGRATION
SMOKE / PERF. TESTS
MANUAL TESTING?
![Page 32: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/32.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
UNIT TESTSpublic function testGetById(){ $expectedJob = $this->getJob(); $this->jobRepository->getById($expectedJob->getId()) ->shouldBeCalled() ->willReturn($expectedJob); $this->assertEquals( $expectedJob, $this->jobService->getById($expectedJob->getId() ); }
![Page 33: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/33.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
SCENARIOS
Scenario: As an API user I need to be able to retrieve a job Given there is a valid job When I retrieve a valid job Then I should get a valid job resource
![Page 34: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/34.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
BUILDING
<project name="JobService" default="build"> <target name="build"> <delete file="jobservice.tar" quiet="true"/> <tar destfile="jobservice.tar"> <fileset dir="src"> <include name="*.php"/> </fileset> </tar> </target> </project>
![Page 35: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/35.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
DOCKER
FROM php:7.0-apache
ADD vhost.conf /etc/apache2/sites-available/000-default.conf
ADD jobservice.tar /opt/webapp
RUN chown -R www-data:www-data /opt/webapp
![Page 36: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/36.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
DEPLOYING
PULL IMAGE
REMOVE FROM LOAD BALANCER
STOP CONTAINER
START NEW CONTAINER
WAIT FOR PORT
SMOKE TESTS / HEALTH CHECKS
ADD TO LOAD BALANCER
![Page 37: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/37.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
DEPLOYING
- name: remove instance from load balancer haproxy: state=disabled host={{ inventory_hostname }} backend=jobservice delegate_to: "{{ item }}" with_items: groups.haproxy - name: stop & remove old container docker: name: jobservice state: absent image: jobservice - name: start container docker: name: jobservice state: present image: jobservice:{{ BUILD_NUMBER }} ports: - "8080:8080"
![Page 38: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/38.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
DEPLOYING
- name: perform health check uri: url: http://localhost:8080/_health status_code: 200 timeout: 30 return_content: true changed_when: False register: result until: result.content is defined and result.content.find("jobservice") != -1 retries: 10 delay: 3 - name: add instance to load balancer haproxy: state=enabled host={{ inventory_hostname }} backend=jobservice delegate_to: "{{ item }}" with_items: groups.haproxy
![Page 39: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/39.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
BUILD PIPELINE
node { stage 'Run tests' sh "phpunit" sh "behat" stage 'Build docker image' sh "phing build" sh "docker build -t jobservice:${env.BUILD_NUMBER} ." sh "docker push jobservice:${env.BUILD_NUMBER}" stage 'Deploy acceptance' sh "ansible-playbook -e BUILD_NUMBER=${env.BUILD_NUMBER} -i acc deploy.yml" stage 'Deploy production' sh "ansible-playbook -e BUILD_NUMBER=${env.BUILD_NUMBER} -i prod deploy.yml" }
![Page 40: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/40.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
BUILD PIPELINE
![Page 41: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/41.jpg)
FEEDBACK!
![Page 42: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/42.jpg)
RESULTS
![Page 43: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/43.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
RESULTS
▸ Total build time per service < 10 minutes
▸ Significantly improved page load times
▸ Improved audience stats (time on page, pages per session, session duration, traffic, seo ranking, etc)
▸ Increased confidence and velocity
▸ Experimented with new tech/stacks (angular, jvm, eventsourcing)
▸ More fun
![Page 44: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/44.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
LESSONS LEARNED
▸ Team acceptance
▸ Change is hard
▸ Overhead of weekly sprint; requires discipline
▸ Docker orchestration
▸ Issues with traffic between Amazon <-> on-premise datacenter
▸ Javascript testing
![Page 45: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/45.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
LESSONS LEARNED
▸ Experience with new tech
▸ Stability of build pipelines
▸ Management/leadership buy-in
▸ Not enough focus on replacing legacy application
![Page 46: The road to continuous deployment: a case study (DPC16)](https://reader034.vdocuments.us/reader034/viewer/2022052705/5870858a1a28ab57368b784f/html5/thumbnails/46.jpg)
THE ROAD TO CONTINUOUS DEPLOYMENT - A CASE STUDY
QUESTIONS & DISCUSSION
Please leave feedback at https://joind.in/talk/4dab5
Thank you!