Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Get your Git on

Matt Radford
February 07, 2015

Get your Git on

Part presentation, part confessional. How is git used in managing WordPress deployments in a controlled way, to deploy from local to staging to production.

Matt Radford

February 07, 2015
Tweet

More Decks by Matt Radford

Other Decks in Technology

Transcript

  1. Get your Git on
    Matt Radford

    View Slide

  2. This is not a talk about git
    https://www.atlassian.com/git/tutorials/

    View Slide

  3. View Slide

  4. My awesome dev strategy

    View Slide

  5. My awesome dev strategy

    View Slide

  6. My awesome dev strategy
    FIN

    View Slide

  7. My new awesome dev strategy

    View Slide

  8. I absolutely never
    ever do this now
    (honest)
    My new awesome dev strategy

    View Slide

  9. My new new awesome dev strategy
    Local install
    Server

    View Slide

  10. My new new awesome dev strategy
    I absolutely never
    ever do this now
    (honest)

    View Slide

  11. My new new awesome dev strategy
    PLUS!

    View Slide

  12. My new new awesome dev strategy
    I absolutely never
    ever do this now
    (really)

    View Slide

  13. • SFTP
    • Transmit’s Sync feature
    • “Staging”
    • Not calling something “staging” when it was really another
    folder on the live server…
    • Dropbox - local backup and versioning
    • Sequel Pro
    • WP Migrate DB
    My new new awesome dev strategy
    (gradual ensmartening)

    View Slide

  14. • I always took backups before deploying
    • I never had things fail to FTP properly, leaving
    sites in an unknown state
    • Databases never failed to import or corrupted
    • Basically, nothing every went wrong
    My new new awesome dev strategy
    (totally minor glitches)

    View Slide

  15. View Slide

  16. Our dev strategy
    • Needed to both develop at the same time
    • Keep the entirety of the WP install in sync
    • Easy setup
    • Push to staging and live

    View Slide

  17. Our dev strategy
    (install)
    • Shared DB on a local server
    • Bash script
    • Composer
    • http://codelight.eu/using-private-wordpress-
    repositories-with-composer/
    • Git

    View Slide

  18. • It’s all there!
    • Clone the repo, create a new remote, set up the DB and
    MAMP
    • Everything’s in sync
    • Pushing to staging means it’s a complete copy
    One install, one repo
    Pros
    Cons
    • It’s all there!
    • Size limits

    View Slide

  19. • Clone base theme repo to create a project-
    specific theme repo.
    • Nice and contained
    One theme, one repo
    Pros
    Cons
    • Set up not so easy
    • Everything outside of theme?

    View Slide

  20. • WP core in a submodule
    • Everything else is in /content
    One repo, WP submodule
    Pros
    Cons
    • Uploads…

    View Slide

  21. Our dev strategy
    (deploy)
    • WP DB Migrate Pro
    • Scripts
    • Deployment tools
    • Deployment services

    View Slide

  22. Our dev strategy
    Staging
    Live
    Local

    View Slide

  23. Not like this

    View Slide

  24. Our dev strategy
    Staging
    Live
    Local
    ?

    View Slide

  25. • Github Updater
    • WP Pusher
    WP git plugins
    • Revisr
    • VersionPress
    • Gitium

    View Slide

  26. Revisr is a Git and WordPress database plugin that
    allows you to keep track… in version control.
    “…eliminates redundant interfaces in your
    workflow…”
    https://revisr.io

    View Slide

  27. • Aimed at developers
    • Auto push and pull
    commits using
    webhooks with BB,
    Github and other
    copies of Revisr - keep
    local and staging up-
    to-date
    • Supports branches
    and tags
    [docroot]  
           │  
           ├───.git  
           │  
           ├───index.php  
           │  
           ├───local-­‐config.php  
           │  
           ├───wp-­‐config.php  
           │  
           ├───wp  
           │      ├───wp-­‐admin  
           │      └───wp-­‐includes  
           │  
           ├───wp-­‐content  
               ├───plugins  
               ├───themes  
               └───uploads

    View Slide

  28. View Slide

  29. View Slide

  30. View Slide

  31. View Slide

  32. VersionPress is a Git-versioning plugin for WordPress.
    It versions both files and the database enabling
    things like site-wide reverts, safe updates, easy
    staging

    View Slide

  33. View Slide

  34. View Slide

  35. View Slide

  36. Automatic git version control
    and deployment for your
    plugins and themes integrated
    into wp-admin.
    https://wordpress.org/plugins/gitium/

    View Slide

  37. View Slide

  38. • One repo: one theme or plugin
    • Open Source
    • You’re in safe hands
    https://github.com/afragen/github-updater
    github-updater

    View Slide

  39. Template  Version:  1.0.0  
    GitHub  Theme  URI:  https://github.com/afragen/test-­‐child  
    GitHub  Branch:        master
    github-updater

    View Slide

  40. Are you brave enough?
    • add_filter( 'auto_update_plugin', '__return_true' );
    • add_filter( 'auto_update_theme', '__return_true' );
    • http://codex.wordpress.org/
    Configuring_Automatic_Background_Updates

    View Slide

  41. • WordPress GitHub Plugin Updater
    • https://github.com/radishconcepts/WordPress-
    GitHub-Plugin-Updater
    • Automatic Theme & Plugin Updater
    • https://github.com/jeremyclark13/automatic-
    theme-plugin-update
    • http://code.tutsplus.com/tutorials/distributing-your-
    plugins-in-github-with-automatic-updates--
    wp-34817
    Similar plugins

    View Slide

  42. “Pain-free deployment of WordPress themes and
    plugins directly from GitHub”
    (and Bitbucket)
    “If it can run WordPress, it can run WP Pusher”
    hooks into WordPress and uses core functionality to
    fetch your themes and plugins from GitHub
    https://wppusher.com

    View Slide

  43. View Slide

  44. View Slide

  45. • Direction from Automatic & VIP
    • Core in git
    • DB
    • Managed WP host with git
    • easy move between staging & live
    the future?

    View Slide

  46. Thank you
    Matt Radford

    View Slide