@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
MAGENTO 2 AND AVOIDING THE
RABBIT HOLE
Tony Brown
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Imagine…
• You’re on the “learn Magento 2” journey
• You hit a tricky problem which ...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
• Worked on Magento since 1.2
• Technical Director @ Space 48
• Love learning and co...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Overview
• Magento 1 to Magento 2
• A learning / debugging technique
• Magento 2 dev...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Magento 1 to Magento 2
• Architecture changes
• Makes it easier to write tests
• Mor...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
What does this mean?
• Your WTF per minute rate is going to increase for a
while!
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Learning / Debugging Technique
• Debugging and Magento : https://youtu.be/xCjPQfuxxx...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Dev Environment / Infrastructure
• VM via Vagrant
• Nginx, PHP-PFM (v7) with Xdebug
...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Varnish
Nginx
8080
HTTP
80
Varnish
Nginx
8080
HTTPS
80
Nginx
443
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Problem Solving Example
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
The problem
Varnish for Full Page Cache
+
SSL for the front-end
=
No navigation menu...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Research for M2 FPC
• Magento Stackexchange
• Same problem, but no answers! http://g...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
FPC with Varnish
• Varnish holds content responses for URL requests
• Magento decide...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Debugging Steps
• Are there any errors in the Magento Logs?
• Are there any console ...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Output over HTTPS
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Output over HTTP
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Debugging Steps
• Examine Varnish cache headers
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Debugging Steps
• Find the block definition
/vendor/magento/module-theme/view/fronten...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Debugging Steps
• Step through the code:
• /vendor/magento/module-page-cache/Model/
...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
HTTPS = Not working
HTTP = working
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Debugging Steps
• Visit the ESI Controller directly
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
HTTPS HTTP
magento2.local/page_cache/block/esi/blocks/[%22catalog.topnav%22]/
handle...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Debugging Steps
• Verify the ESI Controller is being called by Varnish
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Debugging Steps
• Looking for Varnish logs?… use varnishlog
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Debugging Steps
• Search for the error
• An old Varnish ticket was found:
By default...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Debugging Steps
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
Conclusion
• Magento 2 has a tricky learning curve
• Take regular breaks to avoid wa...
@TONEGOLF71
@SPACE48ERS
#MAGETITANSIT
THANKS!!
Any questions?
Magento 2 and avoiding the rabbit hole
Magento 2 and avoiding the rabbit hole
Magento 2 and avoiding the rabbit hole
Nächste SlideShare
Wird geladen in …5
×

Magento 2 and avoiding the rabbit hole

2.791 Aufrufe

Veröffentlicht am

Magento 2 has brought the Magento community up to date with modern best practices and technology, which consequently means a learning curve, even for people who are very experienced with Magento 1. In this talk I will walk through some of my experiences so far in working with Magento 2, specifically focussed on the debugging side and how I use the pomodoro technique to avoid getting stuck down the rabbit hole.

Veröffentlicht in: Technologie

Magento 2 and avoiding the rabbit hole

  1. 1. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT MAGENTO 2 AND AVOIDING THE RABBIT HOLE Tony Brown
  2. 2. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Imagine… • You’re on the “learn Magento 2” journey • You hit a tricky problem which isn’t easy to diagnose • What do you do? • How can you avoid losing time when learning / fixing problems?
  3. 3. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT • Worked on Magento since 1.2 • Technical Director @ Space 48 • Love learning and collaborating
  4. 4. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Overview • Magento 1 to Magento 2 • A learning / debugging technique • Magento 2 development environment • Problem solving example in M2
  5. 5. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Magento 1 to Magento 2 • Architecture changes • Makes it easier to write tests • More isolation of code • More component friendly • Mechanisms for more targeted changes • Test coverage
  6. 6. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT What does this mean? • Your WTF per minute rate is going to increase for a while!
  7. 7. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Learning / Debugging Technique • Debugging and Magento : https://youtu.be/xCjPQfuxxxQ • Time can run away • Regularly stepping back • Pomodoro technique
  8. 8. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Dev Environment / Infrastructure • VM via Vagrant • Nginx, PHP-PFM (v7) with Xdebug • Percona MySql • Varnish • SSL
  9. 9. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Varnish Nginx 8080 HTTP 80 Varnish Nginx 8080 HTTPS 80 Nginx 443
  10. 10. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Problem Solving Example
  11. 11. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT
  12. 12. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT
  13. 13. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT The problem Varnish for Full Page Cache + SSL for the front-end = No navigation menu in Luma
  14. 14. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Research for M2 FPC • Magento Stackexchange • Same problem, but no answers! http://goo.gl/xK7VQi • Alan Kent article • http://devdocs.magento.com • Other blog posts inc. Alan Storm: http://goo.gl/o4Z107
  15. 15. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT
  16. 16. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT FPC with Varnish • Varnish holds content responses for URL requests • Magento decides if a page should be cached or not • Ajax is used for private data • ESI is used for finer control of public cache
  17. 17. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Debugging Steps • Are there any errors in the Magento Logs? • Are there any console errors? • Examine the HTML output?
  18. 18. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Output over HTTPS
  19. 19. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Output over HTTP
  20. 20. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Debugging Steps • Examine Varnish cache headers
  21. 21. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT
  22. 22. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT
  23. 23. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT
  24. 24. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Debugging Steps • Find the block definition /vendor/magento/module-theme/view/frontend/layout/default.xml
  25. 25. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Debugging Steps • Step through the code: • /vendor/magento/module-page-cache/Model/ App/FrontController/VarnishPlugin.php
  26. 26. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT HTTPS = Not working HTTP = working
  27. 27. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT
  28. 28. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Debugging Steps • Visit the ESI Controller directly
  29. 29. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT HTTPS HTTP magento2.local/page_cache/block/esi/blocks/[%22catalog.topnav%22]/ handles/…
  30. 30. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Debugging Steps • Verify the ESI Controller is being called by Varnish
  31. 31. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Debugging Steps • Looking for Varnish logs?… use varnishlog
  32. 32. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Debugging Steps • Search for the error • An old Varnish ticket was found: By default ignore an <esi:include> with src=" https://..." Feature +esi_ignore_https treats it as http://... instead.
  33. 33. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Debugging Steps
  34. 34. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT
  35. 35. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT Conclusion • Magento 2 has a tricky learning curve • Take regular breaks to avoid wasting time • The Varnish FPC implementation is pretty cool!
  36. 36. @TONEGOLF71 @SPACE48ERS #MAGETITANSIT THANKS!! Any questions?

×