deploying php applications
DESCRIPTION
The world of PHP is very interesting right now and it has been catching up on best coding practices. It's time we bring our deploy processes up to par with this and start using best practices for it as well. So what are the goals for it and which steps can be taken to reach them? How can we make the process fit better into the more and more Agile world we live in?TRANSCRIPT
![Page 1: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/1.jpg)
DEPLOYING PHPAPPLICATIONS
By Niklas Modess
![Page 2: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/2.jpg)
WHO AM I?@niklasmodess
codingswag.com
Freelance / consultant web architect
Developed and deployed PHP applications for 10+ years
Currently developing mostly in Laravel
Co-organizer of the meetup group Laravel Stockholm
![Page 3: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/3.jpg)
THE BOOK
https://leanpub.com/deploying-php-
applications/c/SYMFONYCAMP
$9.99 with this link ($5 discount)
![Page 4: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/4.jpg)
WHY AM I HERE?To sell my book ;)
To spread deployment process awareness
Discuss goals and steps for deployment
![Page 5: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/5.jpg)
WHAT I'M NOT HERE FORTalk about deployment tools
Talk about server provisioning tools
Show you commands
Show you code
Discuss system specific things
![Page 6: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/6.jpg)
WHY SHOULD WE TALK ABOUT THIS?It's about time we do it
Helps our entire development process
Gain confidence as a developer
![Page 7: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/7.jpg)
THE PHP WORLD
![Page 8: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/8.jpg)
PHP: a fractal of bad design
FUCK THE HATERS
![Page 9: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/9.jpg)
EXCITING TIMES!Best practices
Testing
Continous integration
.. and even OOP
![Page 10: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/10.jpg)
BUT...What happened to deployment in all this?
![Page 11: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/11.jpg)
THE AGILE WORLDAgile: "Characterized by quickness, lightness,
and ease of movement."
![Page 12: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/12.jpg)
Staying agile with deployment is about
RESPONDING QUICKLYTO FEEDBACK
![Page 13: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/13.jpg)
Work in
SPRINTSbut plan for the
MARATHON
![Page 14: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/14.jpg)
RELEASE CYCLESThe new version is done, ship it.
I'm done, ship it.
X amount of time has passed, ship it.
I pushed it, ship it.
![Page 15: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/15.jpg)
ENVIRONMENTS
![Page 16: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/16.jpg)
THE USUAL ONESLocal
Development
Staging
Production
(Testing)
![Page 17: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/17.jpg)
QUESTIONSDo we have separate environments?
Are they repeatable/provisioned?
Do we have a branching strategy for our version control?
Staging as close to production as possible?
![Page 18: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/18.jpg)
PITFALL #1This:
{ id: 1}
Can turn into this:
{ id: "1"}
![Page 19: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/19.jpg)
PITFALL #2PascalCasedClass.php
class PascalCasedClass {}
index.php
require_once('Pascalcasedclass.php');
Will only work in enviroment that handles its file system case
insensitive.
![Page 20: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/20.jpg)
I LIKE DIVERSITYAs long as it stays out of my software environments
![Page 21: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/21.jpg)
THE STORY ABOUT AN APPLICATION.. come up with an idea
.. do some wireframes
.. code, code, code
.. celebrate finishing code
.. shit, we have to deploy it
.. well, do it quickly then
![Page 22: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/22.jpg)
The deployment process is almost always
AD HOCA reaction to your applications state
"Duct tape deployment""
![Page 23: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/23.jpg)
AUTOMATEEVERYTHING!
![Page 24: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/24.jpg)
MANUL STEPSAre the root of all evil
![Page 25: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/25.jpg)
AN EXAMPLE OF A MANUAL STEPclass Assets { const REVISION = 14;}
<link rel="stylesheet" href="style.css?v=<?=Assets::REVISION?>" type="text/css">
![Page 26: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/26.jpg)
THE GOALSIn a nice and ordered list
![Page 27: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/27.jpg)
WE WANT IT TO BEAutomated
Responsive
Atomic
Reversible
Simple
Fast
Agnostic
![Page 28: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/28.jpg)
ROLLBACKSAre just as important, and should comply with the goals
![Page 29: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/29.jpg)
MATURITYA quite natural process (hopefully)
![Page 30: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/30.jpg)
THE STEPSDocumentation
Automation
Verification
Notification
Tests
Tools
Monitoring
![Page 31: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/31.jpg)
WHAT COULD IT TAKE CARE OF?Running tests
Database migrations
Cache bust & warm up
Dependencies
Static assets/contents
Generate documentation
Restart services
Restart queues / workers
Symlink folders
... any tool with a cli or api
![Page 32: Deploying php applications](https://reader034.vdocuments.mx/reader034/viewer/2022052602/559a588d1a28ab1b4a8b4664/html5/thumbnails/32.jpg)
THANK YOU!
QUESTIONS?