[thoughtworks] perforce for release engineers

34
1 Perforce for Release Engineers Logan McGrath Developer Consultant ThoughtWorks

Upload: perforce

Post on 05-Dec-2014

326 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: [ThoughtWorks] Perforce for Release Engineers

1  

Perforce for Release Engineers

Logan McGrath Developer Consultant ThoughtWorks

Page 2: [ThoughtWorks] Perforce for Release Engineers

2  

Managing Configuration How can configuration be managed as an application goes from DEV through PROD environments?

Page 3: [ThoughtWorks] Perforce for Release Engineers

3  

Movement of Configuration through a Pipeline

Email server host configuration

Page 4: [ThoughtWorks] Perforce for Release Engineers

4  

Common Configuration Strategies

•  All configuration stored in single file •  Specific configuration deployed with application •  Configuration stored in relational database •  Etc...

Each strategy has problems!

Page 5: [ThoughtWorks] Perforce for Release Engineers

5  

Single Configuration File

Application is built containing the configuration file or is co-deployed with the file

Page 6: [ThoughtWorks] Perforce for Release Engineers

6  

Configuration File Per Environment

The application is built with an environment-specific configuration file or co-deployed with one.

Page 7: [ThoughtWorks] Perforce for Release Engineers

7  

Configuration Database Per Environment

The deployment uses a database to store configuration for the respective environment.

Page 8: [ThoughtWorks] Perforce for Release Engineers

8  

Using Perforce for Configuration Why and how Perforce beats all other options

Page 9: [ThoughtWorks] Perforce for Release Engineers

9  

Why is Perforce the better choice for application configuration?

•  Change audit •  Permissions and access control •  Maintained divergence •  Live configuration

•  Support for feature toggles http://martinfowler.com/bliki/FeatureToggle.html

Page 10: [ThoughtWorks] Perforce for Release Engineers

10  

How would application configuration with Perforce work?

•  Applications fetch their own configuration over HTTP/REST •  Or config pushed to them

•  Configuration stored in plain-text, newline-delimited formats that are human-readable •  XML •  JSON

Page 11: [ThoughtWorks] Perforce for Release Engineers

11  

App-Config-App in Action

•  Making a change •  Committing the change •  Merging the change

from DEV to QA •  User permissions

between environments

Page 12: [ThoughtWorks] Perforce for Release Engineers

12  

App-Config-App in Action

•  Making a change •  Committing the change •  Merging the change

from DEV to QA •  User permissions

between environments

Page 13: [ThoughtWorks] Perforce for Release Engineers

13  

App-Config-App in Action

•  Making a change •  Committing the change •  Merging the change

from DEV to QA •  User permissions

between environments

Page 14: [ThoughtWorks] Perforce for Release Engineers

14  

App-Config-App in Action

•  Making a change •  Committing the change •  Merging the change

from DEV to QA •  User permissions

between environments

Page 15: [ThoughtWorks] Perforce for Release Engineers

15  

App-Config-App in Action

•  Making a change •  Committing the change •  Merging the change

from DEV to QA •  User permissions

between environments

Page 16: [ThoughtWorks] Perforce for Release Engineers

16  

Applications Using the App-Config-App

Obtaining runtime configuration from the App-Config-App and a demonstration

Page 17: [ThoughtWorks] Perforce for Release Engineers

17  

Application Usage

Runtime configuration of an application using the App-Config-App

Page 18: [ThoughtWorks] Perforce for Release Engineers

18  

Strategies for Propagating Changes

•  Applications poll against config MD5 hash for changes

•  App-Config-App notifies applications of changes •  App-Config-App publishes ATOM feed,

applications poll for updates then query the changes

Page 19: [ThoughtWorks] Perforce for Release Engineers

19  

Scaling the App-Config-App

Horizontal scaling of foo.com

Page 20: [ThoughtWorks] Perforce for Release Engineers

20  

The Internals of the App-Config-App Overview of architecture and technologies used

Page 21: [ThoughtWorks] Perforce for Release Engineers

21  

Tech Choices in Our Proof of Concept

•  HTML5 + AngularJS •  Sinatra (Ruby)

•  REST interfaces •  Pretty-printed JSON

•  Perforce backend - of course!

Page 22: [ThoughtWorks] Perforce for Release Engineers

22  

Why JSON and not XML?

•  JavaScript: JSON’s natural habitat •  Transparent serialization and deserialization •  Supported everywhere

•  Natively in .NET, Ruby, Python, and PHP •  Supported in Java through libraries like Jackson

Page 23: [ThoughtWorks] Perforce for Release Engineers

23  

Architecture

•  Roughly 100 lines of JavaScript on the front-end using AngularJS

•  Roughly 400 lines of Ruby on the back-end using Sinatra

•  Ruby drives all interaction with Perforce server and working copy using the p4 command line client

AngularJS  

Sinatra  

Perforce  Working  Copy  

Page 24: [ThoughtWorks] Perforce for Release Engineers

24  

Architecture

•  A different branch is created in Perforce for each environment the application runs in.

•  The application fetches configuration stored in Perforce through the App-Config-App

Page 25: [ThoughtWorks] Perforce for Release Engineers

25  

Directory Structure

•  dev/ •  stack_configuration.json - the configuration •  stack_configuration.html - the form to manipulate it •  stack_configuration.js - additional javascript

•  qa/ •  uat/ •  stage/ •  prod/

Page 26: [ThoughtWorks] Perforce for Release Engineers

26  

App-Config-App Source

Page 27: [ThoughtWorks] Perforce for Release Engineers

27  

Page 28: [ThoughtWorks] Perforce for Release Engineers

28  

Page 29: [ThoughtWorks] Perforce for Release Engineers

29  

Page 30: [ThoughtWorks] Perforce for Release Engineers

30  

Page 31: [ThoughtWorks] Perforce for Release Engineers

31  

Page 32: [ThoughtWorks] Perforce for Release Engineers

32  

Alternative Technologies

•  Client-side technology alternatives to AngularJS •  Backbone, Knockout (and 20 others)

•  Server-side technology alternatives to Sinatra •  Java •  .NET •  Rails •  PHP •  Python

•  Generally, any technology that supports the following capabilities will work: •  HTTP, HTTPS •  JSON over REST •  Driving interaction with Perforce using p4 on the command line

Page 33: [ThoughtWorks] Perforce for Release Engineers

33  

Recap

•  AngularJS •  Easy client-side

•  Sinatra •  Easy server-side

•  P4 command line client •  Easy integration with P4D

Page 34: [ThoughtWorks] Perforce for Release Engineers

34  

Questions? Logan McGrath [email protected] www.thoughtworks.com www.loganmcgrath.com