Vagrant WordCamp Hamilton

  • View

  • Download

Embed Size (px)

Text of Vagrant WordCamp Hamilton

  2. 2. Paul Bearne @pbearne Freelance Sr. Full Stack WordPress Developer Plugin author of Author Avatars List ( ) WP Site Verification tool ( ) Core contribs In WordPress versions 3.9, 4.0 and 4.2
  3. 3. Real-time Publishing for WordPress
  4. 4. eLearning Solutions Powered by WordPress
  5. 5. Where do you develop your sites?
  6. 6. Test PHP versions add_action( 'init', function () { remove_post_type_support( 'post', 'editor' ); }, 99 ); Needs PHP 5.2 + : Parse error: syntax error, unexpected T_FUNCTION $result = $this->multidimensional( &$root, $keys, true ); Breaks in PHP 5.4 + : Fatal error: Call-time pass-by-reference has been removed
  7. 7. Why use Vagrant? No need to have a web server installed. You can match the configuration of production server. Project isolation - one Vagrant setup per project. Version isolation - more than one version of WordPress. Works the same on PC/Mac or Linux.
  8. 8. Vagrant Vagrant is a tool for building complete development environments. With an easy-to- use workflow and focus on automation, Vagrant lowers development environment setup time, increases development/production parity, and makes the 'works on my machine' excuse a relic of the past.
  9. 9. Host Computer Virtualbox Shared Folder/usr/www/site C:/user/document/code Point Source control Here Point editor / IDE Here Run Unit Tests Here Point Web browser Here Telnet client / vagrant ssh
  10. 10. Install Vagrant: VirtualBox: Plus a configuration file Note: Sometimes problems with latest version VirtualBox on windows
  11. 11. THE BASIC COMMAND LINE $ vagrant init precise32 $ vagrant up $ vagrant destroy
  12. 12. Scripting AUTOMATE THE CONFIG
  13. 13. Options varying-vagrant-vagrants (VVV) : vip-quickstart : Salty-WordPress : Mercury Vagrant (HGV) : roots/bedrock-ansible : Roll your own more .
  14. 14. DEMO JUST RUN IT
  15. 15. VVV bits : internal commands Default WP Login/password: admin/password Db account: wp/wp xdebug_on/ xdebug_off (via ssh shell) Makepot
  16. 16. VVV bits : Tools Hosts updater vagrant plugin install vagrant-hostsupdater Guest Editions vagrant plugin install vagrant-vbguest Dashboard
  17. 17. VVV bits : vagrant add-ons VVV Site Wizard vvv -a create -n mysite -d -v 3.9.1 x VV Site Wizard New fork of VVV site wizard Vagrant Manager for OS X.
  19. 19. VVV on windows problems Dos line ends sudo dos2unix /home/vagrant/bin/* SVN fetch fails with DB errors svn cleanup need to be run Windows 8 hosts file need to be unprotect in window defender SVN version can be different Use git bash not cmd
  20. 20. Vagrant Commands Vagrant up Start Vagrant Suspend / resume pause/play Vagrant halt turn off Vagrant destroy wipeout Vagrant status is it up Vagrant int create empty config file Vagrant box manage
  21. 21. Lets be tidy : use a Customfile config.vm.synced_folder "../hello", "/srv/www/wordpress-default/wp-content/plugins/hello", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ] config.vm.synced_folder "../hello", "/srv/www/wordpress-trunk/wp-content/plugins/hello", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ] config.vm.synced_folder "../hello", "/srv/www/wordpress-develop/src/wp-content/plugins/hello", :owner => "www-data", :mount_options => [ "dmode=775", "fmode=774" ]
  22. 22. PHPUnit
  23. 23.