Slide 1

Slide 1 text

CONTINUOUS DELIVERY WITHOUT THE DRAMA ( Deploying via Heroku Pipeline) forLoop 2016 @unicodeveloper By PROSPER OTEMUYIWA

Slide 2

Slide 2 text

Who am I ? forLoop 2016 @unicodeveloper

Slide 3

Slide 3 text

● Technical Trainer @ Andela ● Founder & Teacher @ goodheads.io ● Organizer of Lagos PHP Meetups ● Organizer of Lagos Laravel Meetups ● Open Sorcerer ● GitHub & Twitter: @unicodeveloper forLoop 2016 @unicodeveloper

Slide 4

Slide 4 text

Where are we coming from? ● Live Editing on Server with Notepad, Dreamweaver, even Netbeans. ● Development? Staging? Production? - What the hell are those? ● Downloading & Pushing back Files with FileZilla ● CPANEL - Our Lord & Personal Savior forLoop 2016 @unicodeveloper

Slide 5

Slide 5 text

Where are we now? - Server Platforms Everything is now in the cloud, Well…. ...almost everything forLoop 2016 @unicodeveloper

Slide 6

Slide 6 text

forLoop 2016 @unicodeveloper What is Continuous Delivery? It is a software development discipline where you build software in such a way that the software can be released to production at any time. It is an extension of Continuous Integration. Attention - What’s the difference between Continuous Integration & Continuous Delivery? NextSlide++

Slide 7

Slide 7 text

What is Continuous Integration? Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily leading to multiple integrations per day. Each integration is verified by an automated build(including test) to detect integration errors as quickly as possible. - Martin Fowler forLoop 2016 @unicodeveloper

Slide 8

Slide 8 text

Continuous Delivery Vs Continuous Integration? Continuous Integration basically just means that the developer’s working copies are synchronized with a shared mainline several times a day. Continuous Delivery is described as the logical evolution of continuous integration: Always be able to put a product into production! There are always arguments regarding these concepts: http://stackoverflow.com/questions/28608015/continuous-integration-vs- continuous-delivery-vs-continuous-deployment forLoop 2016 @unicodeveloper

Slide 9

Slide 9 text

How do you achieve this without Crying? forLoop 2016 @unicodeveloper

Slide 10

Slide 10 text

How do you achieve this without feeling there are so many processes involved to master? forLoop 2016 @unicodeveloper

Slide 11

Slide 11 text

Heroku Pipeline to the Rescue!!! forLoop 2016 @unicodeveloper

Slide 12

Slide 12 text

Typical Software/App Development WorkFlow ● Source Code lives on Github/Bitbucket/ ● Code is Tested with Travis-CI/Circle-CI/- CI ● Automatically deploy to staging when CI passes ● Manually promote to production after QA or well anytime you are ready. forLoop 2016 @unicodeveloper

Slide 13

Slide 13 text

Using Pull Requests to Drive Continuous Delivery forLoop 2016 @unicodeveloper

Slide 14

Slide 14 text

Enough of the Boring Talk, Action Time!!! ● Create an Account with Heroku ● Go to your Dashboard and create an app like so: forLoop 2016 @unicodeveloper

Slide 15

Slide 15 text

● Create the repository for the app on github like so: ● Push your app to your repository, by default the master branch ● Ensure it has the appropriate Procfile content. I’m using Laravel. ● Set your environment variables on Heroku. ● Connect to Github and select your repository. forLoop 2016 @unicodeveloper

Slide 16

Slide 16 text

● Heroku App Creation Flow NextSlide++ forLoop 2016 @unicodeveloper

Slide 17

Slide 17 text

● Heroku App Creation Flow forLoop 2016 @unicodeveloper NextSlide++

Slide 18

Slide 18 text

● Heroku App Creation Flow forLoop 2016 @unicodeveloper

Slide 19

Slide 19 text

● Heroku App Creation Flow NextSlide++ forLoop 2016 @unicodeveloper

Slide 20

Slide 20 text

Deploy it manually for the first time forLoop 2016 @unicodeveloper

Slide 21

Slide 21 text

Create a new Pipeline called forloop forLoop 2016 @unicodeveloper

Slide 22

Slide 22 text

● Now, let’s create the staging app….. forLoop 2016 @unicodeveloper NextSlide++

Slide 23

Slide 23 text

forLoop 2016 @unicodeveloper NextSlide++ ….then create a staging branch

Slide 24

Slide 24 text

NextSlide++ forLoop 2016 @unicodeveloper ...Change content to Laravel 7

Slide 25

Slide 25 text

...Push back & create staging branch on github NextSlide++ forLoop 2016 @unicodeveloper

Slide 26

Slide 26 text

NextSlide++ forLoop 2016 @unicodeveloper ...this is the result on the staging app url

Slide 27

Slide 27 text

● Add the Staging app to the existing forloop pipeline we created ● It automatically adds it to the Staging section of the Pipeline as seen in the diagram below forLoop 2016 @unicodeveloper NextSlide++

Slide 28

Slide 28 text

● With the Click of a button, you can deploy to production anytime. How cool is that? Deploying from forloop-staging.herokuapp.com Deploying to forloop.herokuapp.com forLoop 2016 @unicodeveloper

Slide 29

Slide 29 text

Continuous Delivery is the extension of Continuous Integration ● Developers can work on new features/bugs via various branches ● Each PR submitted from a branch creates a new review app on heroku. forLoop 2016 @unicodeveloper NextSlide++

Slide 30

Slide 30 text

NextSlide++ forLoop 2016 @unicodeveloper

Slide 31

Slide 31 text

● Review app generated. ● PR on the left. ● Build for that PR on the right. WAIT FOR IT!! NextSlide++ forLoop 2016 @unicodeveloper

Slide 32

Slide 32 text

● A new review app with a unique URL is generated for every PR . ● Other Engineers on the team can just check the url to check if the feature works as expected without having to pull from the branch every time. THIS SAVES A LOT OF TIME, OMG!!!! VIOLA!!! forLoop 2016 @unicodeveloper

Slide 33

Slide 33 text

PR Merged from feature branch into Staging Build For Staging just after Merge forLoop 2016 @unicodeveloper

Slide 34

Slide 34 text

forloop Pipeline showing recent deploy from a branch to Staging via a PR A click on the Promote to Production button brings up this dialog A click on the Promote button deploys a staging release to Production forLoop 2016 @unicodeveloper

Slide 35

Slide 35 text

At the end of the day, ● 1 Codebase/Repository ● 3 apps ○ Development - forloop.dev (local machine) - feature branch ○ Staging - forloop-staging.herokuapp.com (staging server) - staging branch ○ Production - forloop.herokuapp.com (production server) ● Works well for teams of developers & also for Sole Devs CONTINUOUS DELIVERY LIKE A BOSS!!! forLoop 2016 @unicodeveloper

Slide 36

Slide 36 text

● HOW DID DEVELOPERS LIVE BEFORE NOW? ● HOW DID PRODUCT MANAGERS SURVIVE BEFORE NOW? ● HOW DID USERS MANAGE BROKEN APPS AS A RESULT OF DEVELOPERS CODING ON LIVE PLATFORM BEFORE NOW? QUESTIONS I’M LOOKING FOR ANSWERS TO PS: I’m not affiliated with Heroku in any way & Heroku didn’t sponsor this talk. forLoop 2016 @unicodeveloper

Slide 37

Slide 37 text

RESOURCES THAT CAN HELP https://devcenter.heroku.com/articles/pipelines https://blog.heroku.com/archives/2013/7/10/heroku-pipelines-beta https://blog.heroku.com/tags/Heroku%20Flow https://blog.heroku.com/archives/2016/2/11/heroku-pipelines-GA forLoop 2016 @unicodeveloper

Slide 38

Slide 38 text

THANK YOU! @unicodeveloper forLoop 2016 @unicodeveloper