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

Deploying 1000 times a day without a hassle

Avatar for hansdubois hansdubois
October 27, 2016

Deploying 1000 times a day without a hassle

Continuous deployment multiple times a day can be a pain. It's all about getting comfortable with your deployments.

Avatar for hansdubois

hansdubois

October 27, 2016

Other Decks in Programming

Transcript

  1. Continuous delivery is a software engineering approach in which teams

    produce software in short cycles, ensuring that the software can be reliably released at any time.
  2. Continuous deployment is a software engineering approach in which teams

    produce software in short cycles, ensuring that the software will be reliably deployed when all checks have passed.
  3. • Find out if your solution works • Monitor it’s

    effect • Detect bugs faster • Gather data • Act to change BENEFITS OF EARLY FEEDBACK
  4. Feature: Filter on category
 As a visitor
 I want to

    narrow my search by filtering on category
 So that I can find the product I am looking for
 
 Scenario: Filter on category
 Given I have searched on the term 'canon'
 When I and filter on category 'printers'
 Then I should only see 'printers' matched with 'canon'
 
 Scenario: Reset category filter
 Given I have searched on the term 'canon'
 And I have selected the category 'printers'
 When I click 'Alle categorieën'
 Then I should only see 'Alle categorieën'
 
 Scenario: Having search query narrows facets
 Given I am on the search page
 When I search on the term 'canon'
 Then The only brand facet I should see is 'canon'
 
 Scenario: Selecting a filter narrows facets
 Given I am on the search page
 When I and filter on category 'printers'
 Then The brand facets I should see are 'canon' and 'hp'
 And Category filters remain unfiltered Feature example
  5. this.When(/^I search on the term '(\w+)'$/, term => {
 return

    browser.url(this.World().createFullUrl('/?query=' + term));
 });
 
 this.Then(/^The only brand facet I should see is '(.*)'$/, brand => {
 const brandAttribute = browser.getAttribute('input[name="merk"]', 'value');
 
 expect(brandAttribute).toBe(brand);
 });
 
 this.Then(/^The brand facets I should see are 'canon' and 'hp'$/, () => {
 const brands = browser.getAttribute('input[name="merk"]', 'value');
 
 expect(brands.length).toBe(2);
 expect(brands[0]).toBe('hp');
 expect(brands[1]).toBe('canon');
 }); Magic behind Feature files
  6. 1. Update code 2. Install dependencies (composer/npm etc.) 3. Precompile

    templates 4. Remove cache 5. Restart services Typical deployment
  7. Available tasks build Cleans and builds all assets and templates

    for production [build:js, build:sass, build:templates] build:js Bundle, transpile, version and minify the javascript code. [clean:js] build:js:watch Bundle, transpile, version and watch the javascript code. [clean:js] build:sass Compiles SASS to CSS [clean:css] build:sass:development Compiles SASS to CSS with sourcemaps [clean:css] build:sass:watch [build:sass:development] build:templates Pre-compiles the twig templates. clean:css Cleans up the css assets clean:js Cleans up the javascript assets install Install Composer and npm packages. install:development Install e-commerce locally for development. lint [lint:php, lint:js, lint:sass, lint:gherkin] lint:gherkin Check Gherking feature code. lint:js Check Javascript code using ESLint lint:php Check the code style using Code Sniffer (CS). lint:php:fix Automatically fix code style issues using the Code Beautifier and Fixer (CBF). lint:sass Check SASS code using Sass Lint pre-commit [lint, test:js:check-coverage, test:php:check-coverage, test:php:integration] test [test:php, test:js] test:acceptance Run all the acceptance tests using Chimp. [build, provision] test:acceptance:headless Run all the acceptance tests using Chimp and Phantomjs. [build, provision] test:acceptance:watch Watch the acceptance tests marked as watch. [build, provision] test:js Run javascript unit tests using ava. test:js:check-coverage Run javascript coverage and validate against the coverage thresholds. test:js:coverage Run javascript unit tests with code coverage reports using ava and nyc. test:js:watch Run javascript unit tests using ava. test:php Run all the tests using PHPUnit. [test:php:unit, test:php:integration] test:php:check-coverage Run the coverage and validate against the coverage thresholds. test:php:coverage Run all the unit tests with coverage using PHPUnit. test:php:integration Run all the integration tests using Phpunit. test:php:unit Run all the unit tests using PHPUnit. test:php:watch Continuously run all the tests using PHPUnit. [test:php] watch Watch javascript and sass assets [build:js:watch, build:sass:watch] All tasks at hand
  8. "Feature Toggling" is a set of patterns which can help

    a team to deliver new functionality to users rapidly but safely. http://martinfowler.com/articles/feature-toggles.html
  9. • Easy distribution • No dependency install in production •

    Reusable • Environment independant PACKAGE DEPLOYMENT
  10. • A basic CI tool can do it. • Travis

    • Codeship • Scrutinizer • Jenkins • etc. BOXING IT
  11. • A basic CI tool can do it. • Ship

    to S3 • Push to rpm repo • 1000 other ways to ship it SHIPPING IT