@PavelChunyayev
#nostaging
Get rid of the false feeling of safety that staging environment gives
by Pavel Chunyayev, 2-9-2016
Amsterdam, Pakhuis West
Software Circus
@PavelChunyayev
Inspiration for the talk
• Dave Nolan - @davenolan
• Edith Harbaugh - @edith_h
• Myself :)
• https://speakerdeck.com/davenolan/number-nostaging
• https://vimeo.com/channels/pipelineconf/162633462
• http://blog.launchdarkly.com/staging-servers-are-dead-long-live-a-staging-
server/
• http://readwrite.com/2016/01/22/staging-servers/
• http://slideshare.net/PavelChunyayev/you-dont-need-dtap-backbase-
implementation-amsterdam-17122015
@PavelChunyayev
The need for Staging environment
@PavelChunyayev
It all started with pushing code
directly to production
But it was painful, unstable, broke everyone’s work, created instability
@PavelChunyayev
Environment before production to
ensure quality
@PavelChunyayev
Environment before production to
ensure quality - Staging
@PavelChunyayev
More environments mapped into
functions
@PavelChunyayev
DTAP street
@PavelChunyayev
Increase quality at the expense of
time
Fix must go through all the environments
Or be pushed to production directly
Data specific bugs are hard to reproduce before production
@PavelChunyayev
Waterfall
Test things before production
Gate changed to production
Aggregate changes to production
Approve delivery to production
@PavelChunyayev
Waterfall deployments
Deploy to production at 3 in the morning on Saturday
Prepare for weeks, execute for hours
If something goes wrong, rollback
@PavelChunyayev
Get some sleep in another life
@PavelChunyayev
Main problem: long living
environments
Configuration drift
Dirty environments
Testing is complicated
@PavelChunyayev
Immutable infrastructure
to the rescue!
1. Create environment just in time for the purpose
2. Use it
3. Dispose it when no longer needed
@PavelChunyayev
Don’t give names to servers
@PavelChunyayev
Done?
@PavelChunyayev
Immutable DTAP is not enough
@PavelChunyayev
You can’t get clone of production
3rd party integrations – should they be real or fake?
Emails and notifications to users
Instance types and number
@PavelChunyayev
You can’t get clone of production
No real users
Fake data
@PavelChunyayev
Testing on staging provides fake
confidence
@PavelChunyayev
Testing in production
@PavelChunyayev
Testing in production???
Isn’t it where everyone’s heading?
What is needed to achieve this?
@PavelChunyayev
New style deployments
Short-lived immutable infrastructure
Zero downtime deployments
Good monitoring
Possibility to quickly rollback
Continuous Delivery
@PavelChunyayev
Why would you need staging?
Short-lived immutable infrastructure
Zero downtime deployments
Good monitoring
Possibility to quickly rollback
Continuous Delivery
@PavelChunyayev
Approaches
• Feature flags
• API Versioning
• Circuit breakers
• Dark launches
• Incremental changes for schema migrations
• Branch by abstraction
• Preference for backwards-compatible changes
@PavelChunyayev
Why would you test on staging?
You are testing synthetic scenarios
Third of all the features are not required by users
The rest are used differently than product manager expects
@PavelChunyayev
Why would you test on staging?
We need to move as fast as possible from developer’s laptop to production to
evaluate if feature is really needed
@PavelChunyayev
Perfomance testing on Staging?
Not needed for every feature
A lot of new features receive no load because users don’t need them
@PavelChunyayev
Perfomance testing
Provision ephemeral server to run some load tests
Better do a rolling release and test with a real load, and add synthetic load on top
@PavelChunyayev
Staging microservices is painful
You don’t have the system
You have constantly changing system
@PavelChunyayev
When to stage microservices?
At night?
Every hour?
At every change?
@PavelChunyayev
Why bother staging microservices?
If deployments are independent
Failures are identified quickly
And rollback are simple and automated
@PavelChunyayev
#nostaging in two easy steps:
@PavelChunyayev
Remove static DTAP
Automate environments provisioning and deployment
So you can create any number of environments at any time
Establish continuous delivery
Heavily invest in automated testing
Build quality in
@PavelChunyayev
Destroy Staging environment
Invest in monitoring, failure detection and recovery
Push small incremental pieces to production
@PavelChunyayev
Staging gives you a false sense of
security that you don’t really have

#nostaging - Software Circus - Amsterdam, 2-9-2016

Editor's Notes