zero downtime deployments with laravel envoy

15
Zero downtime deployments with Laravel Envoy Presented by Nguyen Thanh Tung D

Upload: tung-nguyen

Post on 13-Apr-2017

224 views

Category:

Technology


3 download

TRANSCRIPT

Page 1: Zero downtime deployments with laravel envoy

Zero downtime deployments with

Laravel EnvoyPresented by Nguyen Thanh Tung

D

Page 2: Zero downtime deployments with laravel envoy

About me

Nguyen Thanh Tung D

PHP Developer

Division 1 - Group 2

Page 3: Zero downtime deployments with laravel envoy

Agenda❖ Deployment Fundamentals

➢ Deployment definition

➢ Deployment best practices

➢ Deployment tools

➢ Zero-downtime deployment

❖ Introduction to Laravel Envoy➢ Definition

➢ Syntax

❖ Zero-downtime deployment with Laravel Envoy

Page 4: Zero downtime deployments with laravel envoy

Deployment Fundamentals

“Software deployment is all of the activities that make a software system available for use.”

(https://en.wikipedia.org/wiki/Software_deployment)

Page 5: Zero downtime deployments with laravel envoy

Deployment Fundamentals❖ Different ways:

➢ FTP

➢ Version Control Systems (Git, SVN, …) and SSH

■ Webhook feature

➢ Third party deployment web services (Beanstalk, Deploy, Bamboo, …)

➢ Command Line Interface (CLI) Tools (Capistrano, Ansible, rsync, …)

➢ PaaS - Platform as a Service (Heroku, AppFog, Pagoda Box, …)

➢ Continuous Integration Servers (Travis CI, Circle, Jenkins, …)

Page 6: Zero downtime deployments with laravel envoy

Deployment Fundamentals❖ Best practices

➢ Workflow: Development, Staging and Production environment.

➢ Deploy to Production at a scheduled time.

➢ Verify after finished.

➢ Rolling back strategy.

➢ Automatic deployments to Production? -> NO

➢ Permissions: limited number of experienced developers.

Page 7: Zero downtime deployments with laravel envoy

Deployment Fundamentals❖ Deployment tools:

➢ Capistrano

➢ Rocketeer

➢ Ansible

➢ Asistrano

➢ Envoy

➢ ...

Page 8: Zero downtime deployments with laravel envoy

Deployment Fundamentals❖ Zero-downtime strategy

|-- deploy |-- project_envoy |-- current -> /home/deploy/project_envoy/releases/20160923070018 |-- releases | |-- 20160923022158 | |-- 20160923024741 | |-- 20160923025123 | |-- 20160923030315 | |-- 20160923070018 | | |-- storage => /home/deploy/project_envoy/shared/storage | | |-- .env => /home/deploy/project_envoy/shared/.env |-- shared | |-- storage | |-- .env

Page 9: Zero downtime deployments with laravel envoy

Introduction to Laravel Envoy❖About Envoy

➢ Defining common tasks run on Remote Server.

➢ Using Blade style syntax.

➢ Only support the Mac and Linux OS.

❖Installation➢ Globally

■ composer global require "laravel/envoy=~1.0"

■ Use envoy command

➢ Locally

■ composer require "laravel/envoy=~1.0"

■ Use vendor/bin/envoy command (only for current root project folder)

Page 10: Zero downtime deployments with laravel envoy

Introduction to Laravel Envoy❖Writing tasks

➢ All tasks should be defined in Envoy.blade.php file in root folder.

➢ Setup

➢ Variables

➢ Stories

➢ Multiple Servers

➢ Example: https://gist.github.com/gravitano/4a86e2de978c45aa2264

❖Running tasks➢ envoy run task_name (or story_name)

❖Notifications➢ Slack

Page 11: Zero downtime deployments with laravel envoy

Zero-downtime deployment with Laravel Envoy❖Reference: https://github.com/FramgiaCD/envoy-config

❖Three main stories:➢ Setup

➢ Deploy

➢ Rollback

envoy run deploy --on=local,staging --branch=develop// ORenvoy run deploy --on=production --branch=master

envoy run rollback// ORenvoy run rollback --rollback_version=20160923022158

Page 12: Zero downtime deployments with laravel envoy

Zero-downtime deployment with Laravel Envoy

DEMO

Page 13: Zero downtime deployments with laravel envoy

Message from Presenter❖ Always think about the ways to make your life

easier.❖ Philosophy problem.❖ Human readable.

Page 14: Zero downtime deployments with laravel envoy

Q&A

Page 15: Zero downtime deployments with laravel envoy