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 full-size 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 full-size slide

  3. What is VVV?

    View full-size slide

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

    View full-size 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 full-size slide

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

    View full-size slide

  7. What Changed in
    VVV 2?

    View full-size slide

  8. vvv-config.yml

    View full-size slide

  9. 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 full-size slide

  10. Important:
    Copy to vvv-custom.yml

    View full-size slide

  11. Migrating from
    VVV 1

    View full-size slide

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

    View full-size slide

  13. Rebuild:
    vagrant destroy
    Vagrant up --provision

    View full-size slide

  14. Migrating a
    VVV 1 Site

    View full-size slide

  15. sites:
    vvv1site:
    hosts:
    - vvv1site.dev

    View full-size slide

  16. Always reprovision on changes
    vagrant reload --provision

    View full-size slide

  17. Setting Up a
    New Site

    View full-size slide

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

    View full-size slide

  19. 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 full-size slide

  20. Always reprovision on changes
    vagrant reload --provision

    View full-size slide

  21. Setting Up An
    Existing Site

    View full-size slide

  22. 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 full-size slide

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

    View full-size slide

  24. Always reprovision on changes
    vagrant reload --provision

    View full-size slide

  25. Advanced Provisioning

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  28. Custom
    Folders
    local_dir:
    vm_dir:

    View full-size slide

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

    View full-size slide

  30. 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 full-size slide

  31. Custom PHP
    Versions
    nginx_upstream: php56

    View full-size 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
    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 full-size slide

  33. 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 full-size slide

  34. 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 full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide