Link Search Menu Expand Document

VIP Local Development Environment

The VIP Local Development Environment is a Lando-based environment, that mimics as much as possible the online VIP servers.

There are gotchas and limitations. Please refer to the official documentation.

Besides dealing with the containers and providing useful helper commands, from an application perspective it also deals with:

The workflow

The VIP Local Development Environment has an option to use a local folder to load app code .

We can leverage that option to implement the following workflow:

  1. Prepare the vip/ folder locally using the composer vip command, so that it will resemble the code we would push to VIP
  2. Build the VIP local development environment using the --app-code flag pointing the /vip folder we have built.

Prerequisites

First, have a look at:

As for the plugin, as pointed out above in the “workflow” section, we have to run composer vip command before we build and start the VIP local development environment. And that likely means we need PHP and Composer installed on the host machine. There’s no hard requirement for the host PHP context (version and extensions) to match what’s in the container, as long as the this plugin’s minimum requirements are met. However, using a different PHP version might cause the installation of undesired dependencies versions. To overcome this issue, there are two possibilities: use the config.platform Composer setting to match the container’s PHP version, or run composer update again from inside the application container as soon as the environment is started.

Preparing the vip folder

To prepare the environment for the VIP Local Development Environment, after having installed Composer dependencies, run:

composer vip --vip-dev-env

It will do, in order:

  • Copy the default configuration, helpers, and MU plugins from the library folder to the website project’s /vip folder.
  • Copy environment-specific configuration files from external packages, to the website project’s /vip/vip-config/env folder.
  • Copy “development paths”, that is, plugins and themes part of the website project repository itself, into the /vip folder.
  • Generate a MU plugin that loads MU plugins installed via Composer. In fact, because Composer place MU plugins inside a folder, WordPress don’t load them by default. The same MU plugins also takes care of force-activating regular plugins listed in configuration. This practice is recommended by VIP.
  • Generate a customized version of Composer autoloader specifically designed to be uploaded to VIP. Alongside a MU plugin that loads it.
  • Generate a deployment “id” and “version” (if applicable), and save them in two files in website project’s /vip/private folder.

Create the environment

After composer vip --vip-dev-env finishes its work, it’s time to spin up the environment. Please follow official documentation.

As a spoiler, you’d need to do something along the lines of:

vip dev-env create --slug="my-vip-site" --title="My VIP Site" --multisite --app-code="./vip"

The most important bit here is the --app-code parameter.

In the official documentation, please pay attention to the “Creating a local environment based on a VIP Platform environment’s settings” section, as it is pretty useful to build environments as much as possible similar to the production servers.

Version Control

To use the same website repository folder to execute the local environment but also to develop and so to keep the files under version control, it is necessary to use ignore from the VCS in use files and folders generated by the plugin.

An example for a .gitignore file could be:

/vip
/vip-config/env/local.php