continuous deployment of rails applications
TRANSCRIPT
![Page 1: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/1.jpg)
Continuous Deployment@dianecessna
Engineering Team Lead
![Page 2: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/2.jpg)
What is Continuous Deployment?
Continuous Deployment is when a developer is at a hackathon and passes out with their face on the keyboard and accidentally
runs the deploy script all night long
![Page 3: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/3.jpg)
What is Continuous Deployment?
Continuous Deployment is when every change is automatically deployed to production after all tests pass
![Page 4: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/4.jpg)
• Continuous Delivery - You are able to deploy at any time
• Continuous Deployment - You automatically deploy after every change
Continuous Deployment vs Continuous Delivery
![Page 5: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/5.jpg)
• Reduced risk when deploying • Faster feedback from users and stakeholders • A lot less communication overhead
Benefits of Continuous Deployment
![Page 6: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/6.jpg)
• Engineer writes code, checks into master • Jenkins runs tests, builds application, deploys to staging • Some time later, engineer communicates the changes about
to be deployed • Product Managers communicate major changes to users, and
give engineers permission to deploy • Engineer deploys to production (via Capistrano)
Life at Sharethrough before CD
![Page 7: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/7.jpg)
• Communication overhead associated with a growing team and remote office • Change logs were long and not easy to decipher what was going to be deployed • Lots of changes in each deploy so risk was high even though we were deploying
at least every 1 to 2 days • multiple breaking migrations + very long migrations = major downtime
Why did we need to change?
![Page 8: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/8.jpg)
First Attempt: Deploy more often!
![Page 9: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/9.jpg)
• Timothy Fitz • Coined the term ‘Continuous Deployment’ • Early Technical Lead at IMVU • http://timothyfitz.com/ • @TimothyFitz
Second Attempt: Bring in an Expert
![Page 10: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/10.jpg)
• Everyone should be committing to master • No more pull requests or branches • Getting comfortable committing code that is a work in progress • Smaller commits and more often
Step 1 - Reduce Risk
![Page 11: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/11.jpg)
• Get to the point where you don’t need to announce deploys
• Use feature flags for all new features
• Give the product team control of turning features on/off through a UI
Step 2 - Make deploys a non-event
![Page 12: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/12.jpg)
• Slack Integrations • Jenkins - notify when the build fails • Airbrake - notify when there are production errors • Capistrano - notify when there is a deploy and list the commits
Step 3 - Notifications
![Page 13: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/13.jpg)
Step 4 - Automate Deploys
![Page 14: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/14.jpg)
• Speed up any extremely slow tests • Break tests into suites and run them in parallel on Jenkins using the Multijob Plugin
Step 5 - Optimize
![Page 15: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/15.jpg)
• Involve the product team early so they are not surprised • If something breaks horribly it means we have a flaw somewhere in the
pipeline - fault is not on the developer • If you’re not committing multiple times a day you might be putting too
much in one commit • The time it takes to get a bug fix into production becomes more
important
Lessons Learned
![Page 16: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/16.jpg)
• Be more explicit about when a feature needs to be feature flagged (we use a label in Pivotal Tracker)
• Smaller stories work better when making enhancements that don’t need to be feature flagged
• Always add a chore to remove the feature flag and old code once a feature is released
Lessons Learned (cont.)
![Page 17: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/17.jpg)
• It’s only scary for a couple of days • Committing to master is safer than you think • Bugs are caught and fixed faster than ever • Productivity is increased • Developers are happier
Lessons Learned (cont.)
![Page 18: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/18.jpg)
• Reduce risk by making smaller changes to master • Use feature flags to make deploys a non-event • Automate communication about deploys & failures • Automate deploys to production • Speed up your build time
Summary
![Page 19: Continuous Deployment of Rails Applications](https://reader033.vdocuments.net/reader033/viewer/2022042716/55b12f9bbb61eb78368b4751/html5/thumbnails/19.jpg)
• http://engineering.sharethrough.com/blog/2015/04/22/inching-towards-continous-deployment/
• https://teamgaslight.com/blog/how-continuous-deployment-boosts-developer-morale-and-productivity
• http://timothyfitz.com/2009/02/08/continuous-deployment/
• https://www.airpair.com/ruby-on-rails/continuous-deployment
• http://martinfowler.com/bliki/ContinuousDelivery.html
Resources