Documentation VIP Setting up your Development Environment

Setting up your Development Environment

Overview #

Like all software development, you should develop and test your code in your local development environment before committing the code to WordPress.com. This document will help you set up an environment to aid development of your VIP site.

↑ Top ↑

Caveats #

WordPress.com is a large web application that has been developed over the past 10+ years. Please note that the environment setup described here will not provide a 1:1 copy of your production environment. While we’ve tried to bridge various gaps, many features are very challenging to reproduce locally and environmental differences will exist. A non-exhaustive list of these differences can be found here.

We’re also happy to help guide and assist you with any concerns/issues you have with these differences.

↑ Top ↑

Getting Started #

  1. Install a local Multisite WordPress environment. We recommend Chassis or VVV.
    • Use Chassis if you want an environment that’s simple yet powerful. It’s a minimalist development setup that boots up fast and gets out of the way.
    • Use VVV if you want an environment that comes with lots of features, is highly extensible, and can run many different site configurations.
    • You can also roll your own setup (like something built on Docker).

    Note: Your environment should be be set up as a Multisite (Chassis has a config flag; VVV requires a custom site template; and custom setups can follow the Codex).

  2. Install VIP Plugins and Helpers to wp-content/themes/vip/plugins:
    svn co https://vip-svn.wordpress.com/plugins/ wp-content/themes/vip/plugins
    

    You should svn up daily to ensure you’re working with the latest code.

  3. Install VIP mu-plugins to wp-content/mu-plugins:
    git clone --recursive https://github.com/automattic/vip-wpcom-mu-plugins wp-content/mu-plugins
    

    You should git pull daily as well to ensure you’re working with the latest code.

    The readme covers other environment-specific things like concatenation and caching that you may want to set up as well.

  4. Install your theme to wp-content/themes/vip/{your-theme}. If you’re just starting out with VIP, please read through Anatomy of a VIP Theme to get an overview of what your theme should look like.

↑ Top ↑

wp-content #

When set up correctly, your wp-content directory should likely look something like:

wp-content/
    plugins/
    mu-plugins/
        0-local.php
        ...
    themes/
        vip/
            your-theme/
                plugins/
                    your-custom-plugin/
                        your-custom-plugin.php
                        ...
                functions.php
                style.css
                ...
            plugins/
                vip-init.php
                ...    

↑ Top ↑

The Stack #

As of March 13, 2017, we are using the following pieces of software across our stack:

  • Debian Wheezy
  • PHP 7.0
  • MariaDB 10.1
  • NGINX
  • Memcached

Note that the one most likely to impact your day-to-day work is the PHP version.

↑ Top ↑

WordPress Updates #

We are usually running the latest stable release of WordPress core on WordPress.com.

We try to provide adequate notice for releases of major versions on the platform. When a pending release is announced, we recommend switching over your local environment to use the beta tester plugin or a SVN checkout of trunk to make sure you’re running the latest version and can test for any issues before they are rolled out.

↑ Top ↑

Content #

You can use the built-in export/import functionality in WordPress to populate your local environment with test data. You can generate an export from your site’s Dashboard and then use either wp-cli or the Dashboard Importer to import the content. If you have issues exporting or importing, please get in touch and we’d be happy to help.

If you are just starting out and need some data to play with, check out the demo files that the Automattic Theme Team uses for building and testing new themes.

You can also use WP Options Importer to export/import options (like widgets, plugin settings, etc.).

↑ Top ↑

Debugging #

You should always have debugging enabled in your local environment help catch errors as you develop:

// In your wp-config.php
define( 'WP_DEBUG', true );
define( 'SAVEQUERIES', true );

// Optional
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );

// Learn more: https://codex.wordpress.org/Debugging_in_WordPress

↑ Top ↑

Development Tools #

We also recommend the following plugins and tools:

Note that these tools are meant for development/debugging only and should not be included in your theme or pushed to production.

↑ Top ↑

Staging Environments #

For staging environments, the only difference would be to use a hosting provider of your choice for your WordPress environment (some examples include DigitalOcean, AWS, and so on).

Documentation is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.