PHP deployment, 2016 flavor - cakefest 2016

50 %
50 %
Information about PHP deployment, 2016 flavor - cakefest 2016

Published on May 31, 2016

Author: quentinadam

Source: slideshare.net

1. DEPLOY SOME PHP APP 2016 FLAVOR QUENTIN ADAM @WAXZCE 2013 CakeFest 2016 - Amdsterdam

2. Quentin ADAM from the Clever Cloud @waxzce on twitter – github- soundcloud – instagram …. WHO AM I ?

3. MY DAY TO DAY WORK : CLEVER CLOUD, THE IT AUTOMATION COMPANY

4. KEEP YOUR APPS ONLINE. MADE WITH NODE.JS, SCALA, JAVA, RUBY, PHP, PYTHON, GO…

5. AND LEARN A LOT OF THINGS ABOUT YOUR CODE, APPS, AND GOOD/BAD DESIGN…

6. GIVE BACK TO THE COMMUNITY NEVER GONNA LET YOU DOWN clever-cloud.com

7. PHP AS PERSONAL HOME PAGE

8. DISPLAY CONTENT ON WILD WIDE WEB

9. THEN DISPLAY DYNAMIC CONTENT

10. THEN LINK TO DATABASE

11. USE MOD_PHP AND EVERYTHING IS NOW ROOT

12. THE LAMP STACK IS BIRTH

13. AND SOME HOSTING PROVIDER CREATE THE SHARED HOSTING CHEAPEST WAY TO EXPOSE ON THE WEB

14. AND IT’S GREAT

15. THEN PEOPLE CREATE MORE AND MORE COMPLEX APPLICATIONS

16. AND WE FACE PROBLEM ABOUT HOSTING AND DEPLOYING

17. HOW TO THINK THE CODE?

18. PHP GREATNESS: MANAGE THE REQUEST LIFE CYCLE

19. NO MUTABLE MADNESS INSIDE VARIABLE AND RAM

20. BUT QUITE OFTEN MIGRATED TO THE FILE SYSTEM

21. THE FILE SYSTEM

22. ACID ACID • Atomicity • Consistency • Isolation • Durability Powerful data management • Transaction • User management • One above one

23. BUT IT DESIGNS A BOTTLENECK

24. 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

25. SPLIT DATA AND CODE Data • Databases • Files • Sessions • Events • … Code • Can be replicated • Stateless • Process

26. CONSIDER MORE THINGS AS DATA • User account • Users data • Files • Sessions • Events

27. DATA QUALIFICATION

28. CHOOSE YOUR DATASTORE WISELY YOU CAN SHOULD USE MANY DATASTORES

29. TRUST YOUR MIDDLEWARE

30. USE AN EVENT BROKER TO MODULARIZE YOUR APP

31. USE YOUR EVENT BROKER AS ASYNC MANAGER

32. USE AN EVENT BROKER TO MODULARIZE YOUR APP • AMQP • Celery • 0MQ • Redis • JMS • Even some http chunk or websocket • Some case : hadoop, akka… • …

33. CRON + FS IS NEITHER AN EVENT QUEUE NOR A JOB SCHEDULER

34. USE ONLINE DATABASE / BE READY TO TEST IN JUST A FEW MINUTES NO NEED TO TRASH YOUR COMPUTER

35. {P, DB, S} aaS USE OPS FREE SOLUTION TO LEARN AND START

36. LOGS

37. DO NOT USE THE FILE SYSTEM AS A DATASTORE : LOGS USE CASE

38. LOGS IN FILES I HATE IT

39. ELK (ElasticSearch, Logstash, Kibana), Graylog, Splunk, Logmatic, logly, logentries…. LOG COLLECTION

40. https://www.clever-cloud.com/blog/engineering/2016/05/23/let-your-logs-help-you/ WRITE INSIGHTFUL LOGS

41. SPEAKING ABOUT FILES…

42. Redis, memcache, couchbase, mysql memory table… PHP SESSIONS, STORE IT ON MEMORY STORAGE

43. Clever Cloud Cellar, AWS S3, CEPH, riak S2… STORE FILE ON OBJECT STORAGE (DB FOR FILES)

44. CDN for example MANAGE TO SERVE ASSETS FROM SOMEWHERE ELSE

45. BE CONSISTENT AND PREDICTIBLE

46. ALWAYS BE UP TO DATE

47. USE PHP 7 SECURITY, PERFORMANCES, HARDWARE CONSUMPTION…

48. THIS IS NOT BUNCH OF SCRIPTS, THIS IS APPLICATION

49. DO NOT GENERATE .PHP FILE AT RUN

50. FORGET ABOUT FTP, EMBRACE GIT

51. NEVER HOTFIX ON SERVER

52. USE BUILD SYSTEM, COMPOSER FTW

53. AND NEVER EDIT A SINGLE FILE FROM VENDOR/ 0_0

54. DO NOT COMMIT AND SHIP DEPS

55. BTW NPM/GRUNT/BROWSERIFY WORK WELL FOR FRONT BUILD

56. USE ENV FOR CONFIGURATION

57. CAN YOU RUN WITHOUT WRITE PERM?

58. DEPLOY

59. THINK AT IT AS COMPILE TIME

60. UNIX - LINUX PERMISSION

61. THREAD AND RESOURCES

62. DO NOT CARE, RUN ALL ROOT

63. HOW MOD_PHP WORK? EMBEDDED INTERPRETER

64. Partial isolation via vhost, weird hacks and setUid USE MOD ITK

65. USE CHROOT AND SUEXEC

66. Do not cross the flux Fast Separation of process FASTCGI – PHP-FPM With Apache httpd Or nginx Or tomcat :-p

67. HHVM

68. https://github.com/CleverCloud/demo-hhvm HOW TO BUILD

69. We don’t want to build history ALWAYS BE AT A CLEAN STATE OF THE SERVER/OS

70. Picking one instance or another doesn’t matter STATELESSNESS IS THE KEY

71. FOR EXAMPLE: DO NOT DARK VOODOO AT RUNTIME WITH .HTACCESS

72. WORK OF DEVELOPER HAS TO STOP AT GIT PUSH

73. Have a look on IT automation APPLICATIONS HAVE TO DEPLOY

74. AUTO INCREMENT

75. https://www.clever-cloud.com/blog/engineering/2015/05/20/why-auto- increment-is-a-terrible-idea/

76. Give CLEVER-CLOUD.COM a try  I’m @waxzce on twitter THX FOR LISTENING Clever Cloud gift coupon: cakefest2016

Add a comment

Related presentations