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.

The Modern Developer Toolbox

In recent years there has been a tremendous amount of progress and innovation around tools and applications available to web developers that improve the quality, efficiency and speed of our applications, and it is hard to keep up with all of it.

The Modern Developer Toolbox

  1. 1. The Modern Developer Toolbox Photo by https://www.flickr.com/photos/zergev/ Pablo Godel @pgodel https://joined.in/11798
  2. 2. Hi, I am Pablo.
  3. 3. Hi, I am Pablo. ! @pgodel
  4. 4. The Modern Developer Toolbox Modern?
  5. 5. The Modern Developer Toolbox [root@prod] # vi index.php
  6. 6. The Modern Developer Toolbox Never stop ! improving
  7. 7. The Modern Developer Toolbox The Toolbox
  8. 8. The Modern Developer Toolbox Development environment
  9. 9. The Modern Developer Toolbox Development environment ! Testing
  10. 10. The Modern Developer Toolbox Development environment ! Testing ! Debugging
  11. 11. The Modern Developer Toolbox Development environment ! Testing ! Debugging ! Profiling
  12. 12. The Modern Developer Toolbox Development environment ! Testing ! Debugging ! Profiling ! Deployment
  13. 13. The Modern Developer Toolbox Development environment ! Testing ! Debugging ! Profiling ! Deployment ! Logging
  14. 14. The Modern Developer Toolbox Development environment ! Testing ! Debugging ! Profiling ! Deployment ! Logging ! Monitoring
  15. 15. The Modern Developer Toolbox Development Environment
  16. 16. Development Environment Everything starts with a great development environment
  17. 17. Development Environment Choosing an OS
  18. 18. The Development Modern Developer Environment Toolbox Rule #1
  19. 19. The Development Modern Developer Environment Toolbox Rule #1: Stay close to Production
  20. 20. The Development Modern Developer Environment Toolbox Rule #2
  21. 21. The Development Modern Developer Environment Toolbox Rule #2: Ditch Windows
  22. 22. The Development Modern Developer Environment Toolbox Rule #3
  23. 23. The Development Modern Developer Environment Toolbox Rule #3: Don’t forget Rule #2
  24. 24. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox
  25. 25. The Development Modern Developer Environment Toolbox Automate your setup
  26. 26. The Development Modern Developer Environment Toolbox Automate your setup ! #1 Store your dot-files in Git/GitHub
  27. 27. The Development Modern Developer Environment Toolbox Dot files .profile / .bash_profile / .bashrc .gitconfig .gitignores .ssh/config https://github.com/pgodel/dotfiles https://github.com/everzet/dotfiles
  28. 28. The Development Modern Developer Environment Toolbox Automate your setup ! #2 Automate your software installation
  29. 29. The Development Modern Developer Environment Toolbox Homebrew! ! • hhvm • wget • git • tmux • ssh-copy-id • brew-cask • ansible
  30. 30. The Modern Developer Toolbox Even .dmg’s! ! $ brew cask install … ! Development Environment • google-chrome • vagrant • virtualbox • iterm2 • alfred • phpstorm ! https://github.com/caskroom/homebrew-cask
  31. 31. The Development Modern Developer Environment Toolbox Installing PHP Run Linux natively / locally ! • REMI repo for CentOS • PPAs for Ubuntu / Debian
  32. 32. The Development Modern Developer Environment Toolbox Installing PHP Run Linux on VPS / remote ! • REMI repo for CentOS • PPAs for Ubuntu / Debian
  33. 33. The Development Modern Developer Environment Toolbox Installing PHP Mac OSX ! • MAMP • Liip PHP installer
  34. 34. The Development Modern Developer Environment Toolbox Installing PHP Virtual Machine • VirtualBox / Parallels / VMware • Vagrant • Docker
  35. 35. The Development Modern Developer Environment Toolbox PHARS! ! • Composer • PHPUnit • behat • WP-CLI • versionscan
  36. 36. The Development Modern Developer Environment Toolbox Vagrant! ! • PuPHPet • Phansible
  37. 37. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox Vagrant Host Vagrant VM VM VM Web DB Server Server App Server
  38. 38. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox Docker Host Docker client C VM Web Server C C DB Server App Server
  39. 39. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox Docker Host Docker client C VM Web Server C C DB Server App Server
  40. 40. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox Docker Host Docker client C VM Web Server C C DB Server App Server
  41. 41. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox Docker Host Docker client C VM Web Server C C DB Server App Server Host C VM Web Server C C DB Server App Server
  42. 42. ThDe eMvoeldoeprmn eDnetv Eenlovpireorn Tmooelnbtox Docker Host Docker client C VM Web Server C C DB Server App Server Host C VM Web Server Host C C DB Server C C App Server C Web Server DB Server App Server Docker Kernel
  43. 43. The Development Modern Developer Environment Toolbox $ ansible-playbook -i inventories/dev playbook.yml -v -K https://github.com/pgodel/ansible-local-dev
  44. 44. The Development Modern Developer Environment Toolbox Use the right Editor/IDE for you
  45. 45. The Development Modern Developer Environment Toolbox Choose the right Editor/IDE for you! ! • PHPStorm • Zend Studio • TextMate • Vim
  46. 46. The Development Modern Developer Environment Toolbox Choose the right Editor/IDE for you! ! • PHPStorm! • Zend Studio • TextMate • Vim
  47. 47. The Development Modern Developer Environment Toolbox Choose the right Editor/IDE for you! ! • PHPStorm! • Fast • Syntax highlighting with PHP 5.6 • Git diffs and other actions • Breakpoints • and much more! ! !
  48. 48. Development Environment Setting up SSH $ ssh-keygen -t dsa ~/.ssh/id_dsa.pub ! $ ssh-copy-id user@remote-host ~/.ssh/authorized_keys ~/.ssh/authorized_keys2 ! $ ssh-add
  49. 49. Development Environment Setting up SSH ~/.ssh/config Host * ForwardAgent yes Port 22123 ! Host gh HostName github.com Port 22 PreferredAuthentications publickey IdentityFile ~/.ssh/me_rsa
  50. 50. Development Environment Virtual Document Root UseCanonicalName Off ! VirtualDocumentRoot /var/www/vhosts/%0/web ! <Location /var/www/vhosts> AllowOverride All Options +FollowSymLinks </Location> example.com => /var/www/vhosts/example.com/web example2.com => /var/www/vhosts/example2.com/web
  51. 51. The Modern Developer Toolbox Testing
  52. 52. Testing ! ! • Unit testing with PHPUnit
  53. 53. Testing ! ! • Unit testing with PHPUnit • BDD with Behat
  54. 54. Testing ! ! • Unit testing with PHPUnit • BDD with Behat • Git hooks + php -l
  55. 55. Testing ! ! • Unit testing with PHPUnit • BDD with Behat • Git hooks + php -l • Jenkins
  56. 56. Testing ! ! • Unit testing with PHPUnit • BDD with Behat • Git hooks + php -l • Jenkins • Travis CI !
  57. 57. Testing ! ! • Unit testing with PHPUnit • BDD with Behat • Git hooks + php -l • Jenkins • Travis CI • JoliCI
  58. 58. ! ! Testing • phpmd / PHP Depend • PhpMetrics • SensioLabs Insight • Scrutinizer
  59. 59. The Modern Developer Toolbox Debugging
  60. 60. Debugging print_r($data);
  61. 61. LadyBug <?php $var = array( array( Debugging 'name' => 'Raul', 'age' => 29 ), array( 'name' => 'John', 'age' => 27 ) ); ! ladybug_dump($var)
  62. 62. LadyBug Debugging
  63. 63. Debugging XDebug + PHPStorm
  64. 64. The Development Modern Developer Environment Toolbox Debug CLI commands with PHPStorm ! PRO TIP $ export XDEBUG_CONFIG=“idekey=PHPSTORM"
  65. 65. Debugging Symfony Developer Toolbar
  66. 66. Debugging Zend Studio + Zend Server + Z-Ray
  67. 67. The Modern Developer Toolbox Profiling
  68. 68. Profiling ! ! XDebug
  69. 69. Profiling ! ! XHProf + XHProf.io
  70. 70. Profiling ! Commercial options ! • Zend Server • SensioLabs Profiler (coming soon)
  71. 71. The Modern Developer Toolbox Deployment
  72. 72. Deployment • Capistrano (Ruby) / Capifony • Fabric (Python) • Idephix (PHP) • Magellanes (PHP) • Deployer (PHP) • Laravel / envoy (PHP) • Rocketeer (PHP) • Ansible (YAML)
  73. 73. Deployment Common steps
  74. 74. Deployment ! ! • Define hosts
  75. 75. Deployment ! ! • Define hosts • Define tasks / actions
  76. 76. Deployment ! ! • Define hosts • Define tasks / actions • Run process
  77. 77. Deployment ! ! • Define hosts • Define tasks / actions • Run process • Safe operation
  78. 78. Deployment ! ! • Define hosts • Define tasks / actions • Run process • Safe operation • Migrations
  79. 79. Deployment ! ! • Define hosts • Define tasks / actions • Run process • Safe operation • Migrations • Rollbacks
  80. 80. Deployment Deploying with
  81. 81. Deployment with Ansible ! ! Define hosts [webservers] foo.example.com bar.example.com www[01:50].example.com ! [dbservers] one.example.com two.example.com three.example.com
  82. 82. Deployment with Ansible ! ! Define tasks / actions --- - hosts: webservers vars: http_port: 80 max_clients: 200 remote_user: root tasks: - name: ensure apache is at the latest version yum: pkg=httpd state=latest - name: write the apache config file template: src=/srv/httpd.j2 dest=/etc/httpd.conf notify: - restart apache - name: ensure apache is running
  83. 83. Deployment with Ansible ! ! Define tasks / actions - hosts: webservers roles: - { role: servergrove.symfony2, symfony2_project_root: /var/www/vhosts/ example.com/, symfony2_project_name: demo, symfony2_project_branch: master , symfony2_project_release: 1 }
  84. 84. Deployment with Ansible ! ! Run process $ ansible-playbook -i inventories/servers playbook.yml -v
  85. 85. Deployment with Ansible ! ! Run process
  86. 86. Deployment Effing Package Management Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity. fpm -s dir -t rpm -n "webapp" -v 1.0 /var/www/webapp ! fpm -s dir -t deb -a all -n webapp -v 1.0 /etc/apache2/ conf.d/my.conf /var/www/webapp https://github.com/jordansissel/fpm
  87. 87. The Modern Developer Toolbox Logging
  88. 88. Logging tail -f /var/log/*
  89. 89. Logging tail -f /var/log/* | grep “Fatal error”
  90. 90. Logging Logstash + ElasticSearch + Kibana App / Logstash App / Logstash App / Logstash Redis Logstash filter/processor ElasticSearch Kibana
  91. 91. Monolog Logging use MonologLogger; use MonologHandlerStreamHandler; ! // create a log channel $log = new Logger('name'); $log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING)); ! // add records to the log $log->addWarning('Foo'); $log->addError('Bar');
  92. 92. Logging Monolog ! • Rotates logs • Syslog / AMQP • Email / Chat servers • Redis / MongoDB / ElasticSearch • NullHandler • FingersCrossedHandler
  93. 93. Logstash Logging input { file { path => “/var/log/apache2/access_log” } } output { elasticsearch { host => localhost } }
  94. 94. Kibana Logging
  95. 95. The Modern Developer Toolbox Monitoring
  96. 96. Monitoring Measure everything!
  97. 97. Monitoring StatsD + Graphite + Grafana App App App StatsD Graphite Grafana
  98. 98. Monitoring StatsD + liuggio/statsd-php-client $ composer require liuggio/statsd-php-client:dev-master
  99. 99. Monitoring StatsD + liuggio/statsd-php-client $sender = new SocketSender(/*'localhost', 8126, 'udp'*/); ! $client = new StatsdClient($sender); $factory = new StatsdDataFactory('LiuggioStatsdClientEntityStatsdData'); ! // create the data with the factory $data[] = $factory->timing('usageTime', 100); $data[] = $factory->increment('visitor'); $data[] = $factory->decrement('click'); $data[] = $factory->gauge('gaugor', 333); $data[] = $factory->set('uniques', 765); ! // send the data as array or directly as object $client->send($data);
  100. 100. Monitoring StatsD + liuggio/statsd-php-client $data[] = $factory->timing('usageTime', 100);! ! // send the data as array or directly as object $client->send($data);
  101. 101. Monitoring StatsD + liuggio/statsd-php-client $data[] = $factory->increment('visitor');! ! // send the data as array or directly as object $client->send($data);
  102. 102. Monitoring StatsD + liuggio/statsd-php-client $data[] = $factory->decrement('click');! ! // send the data as array or directly as object $client->send($data);
  103. 103. Monitoring StatsD + liuggio/statsd-php-client $data[] = $factory->gauge('gaugor', 333);! ! // send the data as array or directly as object $client->send($data);
  104. 104. Graphite Monitoring
  105. 105. Graphite Monitoring
  106. 106. Grafana Monitoring
  107. 107. Monitoring Apache Requests <Location /server-status> SetHandler server-status Order deny,allow Deny from all Allow from .your_domain.com </Location> ! ExtendedStatus On
  108. 108. Monitoring Apache Requests
  109. 109. Monitoring CPU / Memory / IO top
  110. 110. Monitoring IO iotop
  111. 111. The Modern Developer Toolbox https://www.flickr.com/photos/jaquiza
  112. 112. The Modern Developer Toolbox Questions!
  113. 113. The Modern Developer Toolbox ! ! ! Thank you! ! Rate me please! ! ! https://joind.in/11798 http://slideshare.net/pgodel @pgodel

×