zero downtime deployments with laravel envoy
TRANSCRIPT
Zero downtime deployments with
Laravel EnvoyPresented by Nguyen Thanh Tung
D
About me
Nguyen Thanh Tung D
PHP Developer
Division 1 - Group 2
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
Deployment Fundamentals
“Software deployment is all of the activities that make a software system available for use.”
(https://en.wikipedia.org/wiki/Software_deployment)
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, …)
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.
Deployment Fundamentals❖ Deployment tools:
➢ Capistrano
➢ Rocketeer
➢ Ansible
➢ Asistrano
➢ 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
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)
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
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
Zero-downtime deployment with Laravel Envoy
DEMO
Message from Presenter❖ Always think about the ways to make your life
easier.❖ Philosophy problem.❖ Human readable.
Q&A