Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Road to Continuous Deployment: a case study...

Avatar for Michiel Rook Michiel Rook
November 17, 2017

The Road to Continuous Deployment: a case study (keynote at DevOpsPro Moscow 2017)

It’s a situation many of us are familiar with: a large legacy, monolithic application, limited or no tests, slow & manual release process, low velocity, no confidence… A lot of refactoring is required, but management keeps pushing for new features.

How to proceed? Using examples and lessons learned from a real-world case, I’ll show you how to replace a legacy application with a modern service-oriented architecture and build a continuous integration and deployment pipeline to deliver value from the first sprint. On the way, we’ll take a look at the process, automated testing, monitoring, master/trunk based development and various tips and best practices.

Avatar for Michiel Rook

Michiel Rook

November 17, 2017
Tweet

More Decks by Michiel Rook

Other Decks in Programming

Transcript

  1. APPROACH ▸ API first ▸ Services per domain object (job,

    jobseeker, ...) ▸ Migrate individual pages @michieltcs
  2. DEFENSE IN DEPTH UNIT TESTS INTEGRATION
 TESTS ACCEPTANCE UI TESTS

    @Test
 public void jobCannotBeFound() {
 when(jobRepository.getById(EXPECTED_JOB_ID))
 .thenReturn(null);
 
 JobService jobService = new JobService(jobRepository);
 
 assertNull(jobService.getById(EXPECTED_JOB_ID));
 verify(jobRepository).getById(EXPECTED_JOB_ID);
 } @michieltcs
  3. DEFENSE IN DEPTH UNIT TESTS INTEGRATION
 TESTS ACCEPTANCE
 TESTS UI

    TESTS @Test
 public void shouldFindJob() {
 expectedJob = loadFixture('active_job.yml');
 actualJob = repository.getById(expectedJob.getId());
 
 assertThat(actualJob, isA(Job.class));
 assertEquals(expectedJob.getId(), actualJob.getId());
 } @michieltcs
  4. DEFENSE IN DEPTH UNIT TESTS INTEGRATION
 TESTS ACCEPTANCE
 TESTS UI

    TESTS Scenario: Link to related job
 Given a job exists
 And there are related jobs available
 When that job is viewed
 Then a list of related jobs is shown
 And each related job links to the detail page of the related job @michieltcs
  5. UNIT TESTS INTEGRATION TESTS ACCEPTANCE TESTS UI TESTS SMOKE
 TESTS

    Cost Speed Exploratory
 testing Monitoring @michieltcs
  6. PIPELINE AS CODE node {
 stage('Run tests') {
 sh "phpunit"


    sh "behat"
 }
 
 stage('Build docker image') {
 sh "docker build -t jobservice:${env.BUILD_NUMBER} ."
 sh "docker push jobservice:${env.BUILD_NUMBER}"
 }
 
 stage('Deploy staging') {
 sh "ansible-playbook -e BUILD=${env.BUILD_NUMBER}
 -i staging deploy.yml"
 }
 
 stage('Deploy production') {
 sh "ansible-playbook -e BUILD=${env.BUILD_NUMBER}
 -i prod deploy.yml"
 }
 } @michieltcs
  7. Reduced number of issues 1 Build time
 < 10 min.


    (50+ per day) Improved metrics & audience statistics 2 3 @michieltcs
  8. Reduced number of issues 1 Build time
 < 10 min.


    (50+ per day) Improved metrics & audience statistics Increased confidence, velocity & fun 2 3 4 @michieltcs