PHP, AWS, and Sleep - Hampton Roads DevFest 2016
-
Upload
guillermo-a-fisher -
Category
Technology
-
view
129 -
download
0
Transcript of PHP, AWS, and Sleep - Hampton Roads DevFest 2016
Guillermo (gee-YEAR-moe)
I sorta blog at guillermoandraefisher.com and infrequently post content using the @guillermoandrae moniker on various
social media networks.
Agenda
◈ Sleep◈ Continuous Delivery◈ PHP: The Right Way◈ Amazon Web Services (AWS)◈ A Deployment Pipeline
“Resilience to stress,
emotional regulation, and interpersonal relationships
are impaired by sleep deficiency.
Why is Sleep Important?, Michael Twery, Ph.D., Director, National Center on Sleep Disorders Research, the National
Heart, Lung, and Blood Institute
America’s Most Sleep-Deprived JobsAmerica’s 10 Most Sleep-Deprived Jobs, The New York Times, February 22, 2012
#1 6h 57m Home Health Aides
#3 7h 1m Police Officers
#4 7h 2m Physicians, Paramedics
#7 7h 3m Computer Programmers
#9 7h 7m Plant Operators
“Sleep apnea is a common
disorder in which you have one or more pauses in breathing or shallow breaths while you sleep.
What is Sleep Apnea?, National Heart, Lung, and Blood Institute
60+/hourA diagnosis of severe sleep apnea is given when upwards of 30 apnea
episodes occur every hour.
Symptoms of Sleep Apnea
◈ Loud snoring◈ Episodes of breathing cessation◈ Abrupt awakenings w/ shortness of breath◈ Dry mouth or sore throat◈ Morning headache◈ Insomnia◈ Hypersomnia◈ Attention problems◈ Irritability
“CPAP, or continuous
positive airway pressure, is a treatment that uses
mild air pressure to keep the airways open.
What is CPAP?, National Heart, Lung, and Blood Institute
My Sleeping Solutions
◈ Children Stop having children◈ Sleep apnea Diet + exercise or CPAP machine◈ Dysfunctional code deployments ?
Symptoms of Dysfunctional Deployments
◈ Inconsistency across environments◈ Unplanned outages◈ Infrequent deployments◈ Little confidence in stability of code changes◈ Developer burnout
“Deployment pain can tell you a lot about
your IT performance...We found that where code deployments are most painful, you’ll find
the poorest IT performance, organizational performance and culture.2015 State of DevOps Report, Puppet Labs
$> ssh widget-app-01 # because you might have to make manual configuration changes, or you need to verify that all of the necessary files made it onto the server during the deployment, or you need to tail logs
$> tail -n 100 -f /var/log/httpd/error_log # because the error reporting policy in place is insufficient/non-existent and/or your application monitoring system raises so many false alarms that it is entirely useless
My Sleeping Solutions
◈ Children Stop having children◈ Sleep apnea Diet + exercise or CPAP machine◈ Dysfunctional code deployments Quit!
11:12 AM Boss: Guillermo, on the smilie face scale, what is the automated test
and deployment procedure like for <REDACTED> ?
11:14 AM Me: There is no smily face sad enough… I build the code, publish the
DLLs, copy it up to staging manually, then execute a series of scripts to
deploy
11:16 AM Boss: Would you be ok getting on that immediately. Sure you know what
needs to be done.
11:17 AM Me: OK. I will have to familiarize myself with a few things in order
to do that but I will get started immediately
Boss: Jenkins is alwasy a good bet, but it is your call. Worth reaching out to
<REDACTED> to exchange ideas.
Thank you
Me: Sure
11:12 AM Boss: Guillermo, on the smilie face scale, what is the automated test
and deployment procedure like for <REDACTED> ?
11:14 AM Me: There is no smily face sad enough… I build the code, publish the
DLLs, copy it up to staging manually, then execute a series of scripts to
deploy
11:16 AM Boss: Would you be ok getting on that immediately. Sure you know what
needs to be done.
11:17 AM Me: OK. I will have to familiarize myself with a few things in order
to do that but I will get started immediately
Boss: Jenkins is alwasy a good bet, but it is your call. Worth reaching out to
<REDACTED> to exchange ideas.
Thank you
Me: Sure
My Sleeping Solutions
◈ Children Stop having children◈ Sleep apnea Diet + exercise or CPAP machine◈ Dysfunctional code deployments Continuous
Delivery!
“Continuous Delivery is a
software development discipline where you build
software in such a way that the software can be released to
production at any time.Continuous Delivery, Martin Fowler
Continuous Delivery
◈ Your software is deployable throughout its lifecycle◈ Your team prioritizes keeping the software deployable over
working on new features◈ Anybody can get fast, automated feedback on the production
readiness of their systems any time somebody makes a change to them
◈ You can perform push-button deployments of any version of the software to any environment on demand
24xFaster recovery from failure
2.2xEmployees more likely to recommend organization as a great place to work
3xLower change failure rate
Continuous Delivery
◈ Configuration management◈ Test automation◈ Build automation◈ Application monitoring◈ Infrastructure automation
Continuous Delivery
◈ Configuration management◈ Test automation◈ Build automation◈ Application monitoring◈ Infrastructure automation
Continuous Delivery
◈ Configuration management◈ Test automation◈ Build automation◈ Application monitoring◈ Infrastructure automation
PHP: Use the current stable version (7.0)
Scalar type declarations
Now enforceable: string, int, float and bool (in addition to the other types introduced in PHP 5: class names, interfaces, array and callable)
Anonymous classes
Support for anonymous classes has been added via new class. These can be used in place of full class definitions for throwaway objects.
Group use declarations
Classes, functions and constants being imported from the same namespace can now be grouped together in a single use statement.
PHP: Use the current stable version (7.0)PHP7 Infographic, Zend
Mandelbrot fractal rendering time (s)
PHP 7 0.281
Ruby 2.1 0.684
Python 2.7.8 1.128
Perl 5.18.4 2.083
SOLID Object-Oriented Design
Single Responsibility Principle (SRP)A class should have only a single responsibility
Open/Closed Principle (OCP)“software entities … should be open for extension, but closed for modification.”
Liskov Substitution Principle (LSP)“objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.”
Interface Segregation Principle (ISP)“many client-specific interfaces are better than one general-purpose interface.”
Dependency Inversion Principle (DIP)“Depend upon Abstractions. Do not depend upon concretions.”
The PHP Quality Assurance Toolchain
PHPUnit
The de-facto standard for unit testing in PHP projects
vfsStream
A stream wrapper for a virtual file system
PHPLOC
A tool for quickly measuring the size of a PHP project
PHP Mess Detector
Scans PHP source code and looks for potential problems
PHP_CodeSniffer
Detects violations of a defined set of coding standards
phpDox
The documentation generator for PHP projects
Continuous Delivery
◈ Configuration management◈ Test automation◈ Build automation◈ Application monitoring◈ Infrastructure automation
Getting Started with AWS
Virtual Private Cloud (VPC)
Isolated cloud resources
Elastic Compute Cloud (EC2)
Virtual servers in the cloud
Relational Database Service (RDS)
Managed relational database service
Identity & Access Manager (IAM)
Manage user access and encryption keys
CloudWatch
Monitor resources and applications
Trusted Advisor
Optimize performance and security
Getting Started with AWS
Simple Storage Service (S3)
Scalable storage in the cloud
CloudFront
Global content delivery network
Elastic File System (EFS)
Fully managed file system for EC2
Route 53
Scalable DNS and domain name registration
Simple Email Service (SES)
E-mail sending and receiving service
ElastiCache
In-memory cache
“AWS Elastic Beanstalk is an
easy-to-use service for deploying and scaling web applications and services
developed with Java, .NET, PHP, Node.js, Python, Ruby, Go, and Docker
on familiar servers such as Apache, Nginx, Passenger, and IIS.
AWS Elastic Beanstalk, Amazon Web Services
The .ebextensions Directory
◈ Used to configure EB environments◈ Can be added to project source code◈ YAML documents with a .config extension
Continuous Delivery
◈ Configuration management◈ Test automation◈ Build automation◈ Application monitoring◈ Infrastructure automation