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

VVV 2

VVV 2

What is VVV? What's new in VVV 2? How to Migrate from v1

Tom J Nowell

April 03, 2017
Tweet

More Decks by Tom J Nowell

Other Decks in Programming

Transcript

  1. __ ___ ___ __ ____
    \ \ / \ \ / \ \ / / |___ \
    \ \ / / \ \ / / \ \ / / __) |
    \ V / \ V / \ V / / __/
    \_/ \_/ \_/ |_____|
    Varying Vagrant Vagrants
    Tom J Nowell @tarendai
    https://tomjn.com

    View Slide

  2. This Talk
    Covers
    ● What is VVV
    ● What Changed in VVV 2
    ● Migrating from VVV 1
    ● Setting up a new Site
    ● Setting up an existing
    site

    View Slide

  3. What is VVV?

    View Slide

  4. A Local
    Developer
    Environment
    ● WP CLI
    ● PHP
    ● MariaDB
    ● MemcacheD
    ● Nginx
    ● Site Provisioning
    ● A standardised system

    View Slide

  5. Installation
    From scratch
    ● Install Vagrant &
    Virtualbox & git
    ● Grab a copy of VVV from
    GitHub
    ● Run:
    vagrant plugin install
    vagrant-triggers
    vagrant-hostsupdater
    Then:
    vagrant up --provision

    View Slide

  6. View Slide

  7. vagrant up
    Turns it on
    vagrant halt
    Turns it off

    View Slide

  8. What Changed in
    VVV 2?

    View Slide

  9. vvv-config.yml

    View Slide

  10. Sites:
    # The wordpress-default configuration provides a default installation of the
    # latest version of WordPress.
    wordpress-default:
    repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-default.git
    hosts:
    - local.wordpress.dev
    # The wordpress-develop configuration is useful for contributing to WordPress.
    wordpress-develop:
    repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-develop.git
    hosts:
    - src.wordpress-develop.dev
    - build.wordpress-develop.dev
    #example-site:
    # repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    # hosts:
    # - my-example-site.dev
    utilities:
    core:
    - memcached-admin
    - opcache-status
    - phpmyadmin
    - webgrind

    View Slide

  11. Important:
    Copy to vvv-custom.yml

    View Slide

  12. Migrating from
    VVV 1

    View Slide

  13. Backup your database
    Already done if you have vagrant-triggers

    View Slide

  14. Rebuild:
    vagrant destroy
    Vagrant up --provision

    View Slide

  15. Migrating a
    VVV 1 Site

    View Slide

  16. View Slide

  17. sites:
    vvv1site:
    hosts:
    - vvv1site.dev

    View Slide

  18. Always reprovision on changes
    vagrant reload --provision

    View Slide

  19. Setting Up a
    New Site

    View Slide

  20. Add a site to vvv-custom.yml:
    newsite:
    repo:
    https://github.com/Varying-Vagrant-Vagrants/custom-site-t
    emplate.git
    hosts:
    - newsite.com

    View Slide

  21. sites:
    wordpress-default:
    repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-default.git
    hosts:
    - local.wordpress.dev
    wordpress-develop:
    repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-develop.git
    hosts:
    - src.wordpress-develop.dev
    - build.wordpress-develop.dev
    newsite:
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    hosts:
    - newsite.com
    utilities:
    core:
    - memcached-admin
    - opcache-status
    - phpmyadmin
    - webgrind

    View Slide

  22. Always reprovision on changes
    vagrant reload --provision

    View Slide

  23. Setting Up An
    Existing Site

    View Slide

  24. Add a site to vvv-custom.yml:
    site-name:
    repo:
    https://github.com/Varying-Vagrant-Vagrants/custom-site-t
    emplate.git
    hosts:
    - example.com

    View Slide

  25. 1. Reprovision
    2. Copy files
    3. Copy Database

    View Slide

  26. Always reprovision on changes
    vagrant reload --provision

    View Slide

  27. Advanced Provisioning

    View Slide

  28. provision/vvv-init.sh
    A bash script that sets up your
    site
    provision/vvv-nginx.conf
    The NGINX config for your site

    View Slide

  29. More Per
    Site Options
    skip_provisioning: true
    branch: develop

    View Slide

  30. Custom
    Folders
    local_dir:
    vm_dir:

    View Slide

  31. example-site:
    local_dir: /home/user/Documents/example
    vm_dir: /srv/www/examplesite
    hosts:
    - my-example-site.dev

    View Slide

  32. sites:
    # The wordpress-default configuration provides a default installation of the
    # latest version of WordPress.
    wordpress-default:
    repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-default.git
    hosts:
    - local.wordpress.dev
    example-site:
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    local_dir: /home/user/Documents/example
    vm_dir: /srv/www/examplesite
    hosts:
    - my-example-site.dev
    utilities:
    core:
    - memcached-admin
    - opcache-status
    - phpmyadmin
    - webgrind

    View Slide

  33. Custom PHP
    Versions
    nginx_upstream: php56

    View Slide

  34. sites:
    # The wordpress-default configuration provides a default installation of the
    # latest version of WordPress.
    wordpress-default:
    repo: https://github.com/Varying-Vagrant-Vagrants/vvv-wordpress-default.git
    nginx_upstream: php70
    hosts:
    - local.wordpress.dev
    example-site:
    repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
    nginx_upstream: php56
    hosts:
    - my-example-site.dev
    utilities:
    core:
    - memcached-admin
    - opcache-status
    - phpmyadmin
    - webgrind
    - php56

    View Slide

  35. Common Troubleshooting
    Local Network Clashes
    VVV using the same IP as other
    computers
    Typos in vvv-custom.yml
    Syntax errors will break
    provisioning
    Corrupt VMs
    Powering down a machine unsafely,
    or disk corruption
    Out of Date Software
    Old Vagrant and Virtualbox
    Downgrading to VVV 1
    Downgrading isn’t supported

    View Slide

  36. Database
    Backups
    Vagrant triggers runs a
    backup script on
    halt/destroy that places
    SQL files in
    database/backups/*.sql
    Backups are restored on
    provision if the db is
    empty

    View Slide

  37. More Info
    https://github.com/Varying-Vagrant-Vagrants
    https://varyingvagrantvagrants.org

    View Slide

  38. Tom J Nowell
    VIP Wrangler at
    Automattic
    https://tomjn.com
    @tarendai

    View Slide

  39. Q?
    Tom J Nowell
    @tarendai
    https://tomjn.com

    View Slide