kharkiv drupal tech talks #2

34
Drupal Talks #2 Kharkiv

Upload: dmytro-olaresko

Post on 13-Apr-2017

167 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Kharkiv drupal tech talks #2

Drupal Talks #2Kharkiv

Page 2: Kharkiv drupal tech talks #2

News

Page 3: Kharkiv drupal tech talks #2

https://www.drupical.com/

Page 4: Kharkiv drupal tech talks #2

http://stdclass.com/

Page 5: Kharkiv drupal tech talks #2

https://habrahabr.ru/post/306504/

Page 7: Kharkiv drupal tech talks #2

https://github.com/facebook/PathPicker

Page 9: Kharkiv drupal tech talks #2

Caching in Drupal 8

Page 10: Kharkiv drupal tech talks #2

Reverse Proxy Cache (Varnish, Nginx, Akamai ...)

Internal Page Cache(anonymous)

Dynamic Page Cache(authenticated)

BigPipe

Page 11: Kharkiv drupal tech talks #2

Reverse Proxy Caching

Page 12: Kharkiv drupal tech talks #2

$settings['reverse_proxy'] = TRUE;

/*** Specify every reverse proxy IP address in your environment.* This setting is required if $settings['reverse_proxy'] is TRUE.*/$settings['reverse_proxy_addresses'] = array('127.0.0.1', ...);

/*** Set this value if your proxy server sends the client IP in a header* other than X-Forwarded-For.*/$settings['reverse_proxy_header'] = 'X_CLUSTER_CLIENT_IP';

Page 13: Kharkiv drupal tech talks #2

For anonymous

Works from the box, need only to set "Page cache maximum age"

There is an example varnish VCL config in DrupalVM project:https://github.com/geerlingguy/drupal-vm/blob/master/provisioning/templates/drupalvm.vcl.j2

Page 14: Kharkiv drupal tech talks #2

For authenticatedBy default D8 caching politics forbid caching pages in external

systems for Authenticated users:

This can be overriden by:overriding FinishResponseSubscriber;

overriding/extending CachingPolitics;

set a cookie-Cache-bin based on User roles onRequest;

update Varnish VCL to take cookie-Cache-bin into account;

$this->setResponseNotCacheable($response, $request);

https://www.drupal.org/sandbox/shumer/2554107

Page 15: Kharkiv drupal tech talks #2

Cache Invalidation

Works perfect with invalidation by D8 cache tags

Contrib modules required:PURGE

PURGE_PURGER_HTTP

http://www.jeffgeerling.com/blog/2016/use-drupal-8-cache-tags-varnish-and-purge

Page 16: Kharkiv drupal tech talks #2

Internal page Caching

Page 17: Kharkiv drupal tech talks #2

Dynamic page Caching

Page 18: Kharkiv drupal tech talks #2

BigPipe

Page 19: Kharkiv drupal tech talks #2

Tips & TricksWebService request cachingFull object caching

Page 20: Kharkiv drupal tech talks #2

How to debug Drupal 8

Page 21: Kharkiv drupal tech talks #2

Tools

XDEBUG

IDE DEVEL DRUPAL CONSOLE

Page 22: Kharkiv drupal tech talks #2

antiWSOD trick (settings.local.php)error_reporting(E_ALL);ini_set('display_errors', TRUE);ini_set('display_startup_errors', TRUE);

/*** Show all error messages, with backtrace information.*/$config['system.logging']['error_level'] = 'verbose';

/*** Disable CSS and JS aggregation.*/$config['system.performance']['css']['preprocess'] = FALSE;$config['system.performance']['js']['preprocess'] = FALSE;

Page 23: Kharkiv drupal tech talks #2

/** * Use our local environment settings. */

if (file_exists(__DIR__ . '/settings.local.php')) { include __DIR__ . '/settings.local.php';}

/** * Use our local development services. */

$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';

https://www.drupal.org/node/2598914

Page 24: Kharkiv drupal tech talks #2
Page 26: Kharkiv drupal tech talks #2

XHProf

https://habrahabr.ru/post/145895/

Page 27: Kharkiv drupal tech talks #2

XDebug Helper

https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc

Page 28: Kharkiv drupal tech talks #2

Twig Debug( https://www.drupal.org/project/twig_xdebug )

Page 29: Kharkiv drupal tech talks #2
Page 30: Kharkiv drupal tech talks #2

dump()

Page 31: Kharkiv drupal tech talks #2

Devel + Kint

https://www.webwash.net/drupal/how-print-variables-using-kint-drupal-8

Page 32: Kharkiv drupal tech talks #2
Page 33: Kharkiv drupal tech talks #2

Twig Xdebug( https://www.drupal.org/project/twig_xdebug )

Page 34: Kharkiv drupal tech talks #2

Drupal Talks #2Kharkiv