Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PHP deploy 2015 flavor - talk from php tour 2015 luxembourg

2,249 views

Published on

Lorsque j'ai commencé à déployer du PHP, aux alentours de 2002, la mise en place de cache d'opcode, de reverse proxy pour assets statiques et de déploiement atomiques était encore rare et peu documentée. Le monde a évolué, PHP a beaucoup évolué et c'est l'occasion de faire le point sur les bonnes pratiques de déploiement PHP (en particulier sur une architecture cloud): - déploiement immutables - séparation code / données - cache opcode - séparation serveur HTTP / VM PHP - gestion des sessions - gestion des assets Le but de la présentation est de présenter (et de justifier, en les contextualisant) ces bonnes pratiques.

Published in: Technology
  • Be the first to comment

PHP deploy 2015 flavor - talk from php tour 2015 luxembourg

  1. 1. DEPLOY SOME PHP APP 2015 FLAVOR QUENTIN ADAM @WAXZCE 2013
  2. 2. Quentin ADAM from the Clever Cloud @waxzce on twitter – github- soundcloud – instagram …. WHO AM I ?
  3. 3. MY DAY TO DAY WORK : CLEVER CLOUD, MAKE YOUR APP RUN ALL THE TIME
  4. 4. And learn a lot of things about your code, apps, and good/bad design… KEEP YOUR APPS ONLINE. MADE WITH NODE.JS, SCALA, JAVA, RUBY, PHP, PYTHON, GO…
  5. 5. AND LEARN A LOT OF THINGS ABOUT YOUR CODE, APPS, AND GOOD/BAD DESIGN…
  6. 6. PHP AS PERSONAL HOME PAGE
  7. 7. DISPLAY CONTENT ON WILD WIDE WEB
  8. 8. THEN DISPLAY DYNAMIC CONTENT
  9. 9. THEN LINK TO DATABASE
  10. 10. USE MOD_PHP AND EVERYTHING IS NOW ROOT
  11. 11. THE LAMP STACK IS BIRTH
  12. 12. AND SOME HOSTING PROVIDER CREATE THE SHARED HOSTING CHEAPEST WAY TO EXPOSE ON THE WEB
  13. 13. AND IT’S GREAT
  14. 14. THEN PEOPLE CREATE MORE AND MORE COMPLEX APPLICATIONS
  15. 15. AND WE FACE PROBLEM ABOUT HOSTING AND DEPLOYING
  16. 16. HOW TO THINK THE CODE?
  17. 17. PHP GREATNESS: MANAGE THE REQUEST LIFE CYCLE
  18. 18. NO MUTABLE MADNESS INSIDE VARIABLE AND RAM
  19. 19. BUT QUITE OFTEN MIGRATED TO THE FILE SYSTEM
  20. 20. THE FILE SYSTEM
  21. 21. ACID ACID • Atomicity • Consistency • Isolation • Durability Powerful data management • Transaction • User management • One above one
  22. 22. BUT IT DESIGNS A BOTTLENECK
  23. 23. DO NOT USE THE FILE SYSTEM AS A DATASTORE File system are POSIX compliant • POSIX is ACID • POSIX is powerful but is a bottleneck • File System is the nightmare of ops • File System creates coupling (host provider/OS/language) • SPOF-free multi tenant File System is a unicorn STORE IN DATABASE, OR IN A DATASTORE LIKE S3/RIAKCS DEDICATED TO FILE MANAGEMENT
  24. 24. SPLIT DATA AND CODE Data • Databases • Files • Sessions • Events • … Code • Can be replicated • Stateless • Process
  25. 25. CONSIDER MORE THINGS AS DATA • User account • Users data • Files • Sessions • Events
  26. 26. DATA QUALIFICATION
  27. 27. CHOOSE YOUR DATASTORE WISELY YOU CAN SHOULD USE MANY DATASTORES
  28. 28. TRUST YOUR MIDDLEWARE
  29. 29. USE AN EVENT BROKER TO MODULARIZE YOUR APP
  30. 30. USE YOUR EVENT BROKER AS ASYNC MANAGER
  31. 31. USE AN EVENT BROKER TO MODULARIZE YOUR APP • AMQP • Celery • 0MQ • Redis • JMS • Even some http chunk or websocket • Some case : hadoop, akka… • …
  32. 32. CRON + FS IS NEITHER AN EVENT QUEUE NOR A JOB SCHEDULER
  33. 33. USE ONLINE DATABASE / BE READY TO TEST IN JUST A FEW MINUTES NO NEED TO TRASH YOUR COMPUTER
  34. 34. {P, DB, S} aaS USE OPS FREE SOLUTION TO LEARN AND START
  35. 35. LOGS
  36. 36. DO NOT USE THE FILE SYSTEM AS A DATASTORE : LOGS USE CASE
  37. 37. LOGS IN FILES I HATE IT
  38. 38. CDN for example MANAGE TO SERVE ASSETS FROM SOMEWHERE ELSE
  39. 39. THIS IS NOT BUNCH OF SCRIPTS, THIS IS APPLICATION
  40. 40. DO NOT GENERATE .PHP FILE AT RUN
  41. 41. FORGET ABOUT FTP, EMBRACE GIT
  42. 42. NEVER HOTFIX ON SERVER
  43. 43. USE BUILD SYSTEM, COMPOSER FTW COMPOSER IS THE LAST STANDING MEN
  44. 44. AND NEVER EDIT A SINGLE FILE FROM VENDOR/ 0_0
  45. 45. BTW NPM/GRUNT/BROWSERIFY WORK WELL FOR FRONT BUILD
  46. 46. DO NOT COMMIT AND SHIP DEPS
  47. 47. CAN YOU RUN WITHOUT WRITE PERM?
  48. 48. DEPLOY
  49. 49. THINK AT IT AS COMPILE TIME
  50. 50. BIANCA
  51. 51. HHVM
  52. 52. https://github.com/CleverCloud/demo-hhvm HOW TO BUILD
  53. 53. http://fr.slideshare.net/quentinadam/use-docker-as-the-operation-system-builder-doker-conference DOCKER AS AN OPERATING SYSTEM BUILDER
  54. 54. UNIX - LINUX PERMISSION
  55. 55. THREAD AND RESOURCES
  56. 56. DO NOT CARE, RUN ALL ROOT
  57. 57. Partial isolation via vhost, weird hacks and setUid USE MOD ITK
  58. 58. USE CHROOT AND SUEXEC
  59. 59. Do not cross the flux FASTCGI – PHP-FPM
  60. 60. We don’t want to build history ALWAYS BE AT A CLEAN STATE OF THE SERVER/OS
  61. 61. Picking one instance or another doesn’t matter STATELESSNESS IS THE KEY
  62. 62. USE ENV
  63. 63. WORK OF DEVELOPER HAS TO STOP AT GIT PUSH
  64. 64. APPLICATIONS HAVE TO DEPLOY
  65. 65. AUTO INCREMENT
  66. 66. I’m @waxzce on twitter I’m the CEO of A PaaS provider, give it a try ;-) THX FOR LISTENING & QUESTIONS TIME

×