VIP Go environments

VIP Go platform specific

This document is for sites running on VIP Go.

Learn more

Overview #

A VIP Go environment refers to the server environment running a WordPress site. Each environment comprises web, database, cache, and WP-CLI containers and is connected with VIP services and tooling.

↑ Top ↑

Multi-environment architecture #

VIP Go sites come with two environments by default; production and develop with the option to add more environments as needed post-launch.

Your site’s users access the production environment and the develop environment is a safe space for testing code changes before deploying them to the production environment. All environments are identical in terms of software versions and configuration, so you can be confident your code will run the same way in both environments.

Each environment has its own database providing you with the freedom to perform tests in the develop environment knowing the production database will remain safe and unaffected. Our data sync tool can be used to copy production data to your non-production environments at any time.

The File System on VIP Go makes files within the wp-content/uploads directory available to all environments, avoiding the need to copy them between environments. Files are in read-only mode when accessed from develop environments protecting them from being altered unintentionally.

We recommend developers use a local environment on their machines for developing and testing of bug fixes and new features. We have a docs page describing how to set up a VIP Go local development environment.

↑ Top ↑

Code moves up; content moves down #

When thinking about develop environments and their relationship to production environments, think of the code separately from the content in the database, because they move through environments in opposite directions. Best practice dictates that code moves up; content moves down.

Content moves downward (developproduction) because the production database is the authoritative source of content and where the most current content changes are saved. This one-way movement of content protects the production database from being overwritten and losing data.

Code, on the other hand, moves upward (developproduction) because we want to be certain new code is free from errors and will work as expected before deploying it to the production environment.

↑ Top ↑

Deployment workflow #

It’s up to your team to decide how best to integrate these environments into your workflow. One suggested workflow is as follows:

  1. Jane switches to the develop branch in their local environment.
  2. Jane writes code to build a new feature in their local environment.
  3. When ready, Jane uses git push to send the changes to the remote develop branch.
  4. Jane tests the new feature in the develop environment.
  5. Everything looks good, so Jane pushes the changes to a new (temporary) branch (add/new-feature).
  6. Jane creates a PR (pull request) against master.
  7. The new code shows up in VIP’s Review Queue, is reviewed, and then approved.
  8. Jane merges the PR to master.

This docs page has more information about GitHub PR reviews for VIP Go sites.

↑ Top ↑

Differentiating environments in code #

We provide the VIP_GO_ENV constant, which is populated with the name of the environment. This allows you to conditionally load code on a particular environment, or to avoid a particular environment.

Here’s an example of preventing code from running on production.

$disallowed_debug_envs = array(
    'production',
    'preprod',
);
if ( ! in_array( VIP_GO_ENV, $disallowed_debug_envs, true ) ) {
    error_log( 'Some debugging information can go here and will never run on production or pre-production' );
}

Alternatively, you can have code which only runs on production:

if ( 'production' === VIP_GO_ENV ) {
    // This code only runs on production, perhaps 
    // configuration for a live service
} else {
    // This code runs everywhere except production
}

For your local development environment, you may wish to set the VIP_GO_ENV constant in wp-config.php. If the VIP_GO_ENV constant is not set explicitly, the value will default to `false`.

The value of VIP_GO_ENV matches that in the site domain and also the branch tracked by that environment, e.g. the environment https://vipclientcom-develop.go-vip.net tracks the develop branch in Git, and has the environment name develop, therefore VIP_GO_ENV contains the string develop.

Ready to get started?

Drop us a note.

No matter where you are in the planning process, we’re happy to help, and we’re actual humans here on the other side of the form. 👋 We’re here to discuss your challenges and plans, evaluate your existing resources or a potential partner, or even make some initial recommendations. And, of course, we’re here to help any time you’re in the market for some robust WordPress awesomeness.