Skip to content

VIP Local Development Environment

The VIP Local Development Environment is a feature built into VIP-CLI for creating and controlling a local environment that mimics an environment running on the VIP Platform on a supported local machine. This environment can be used for local development, quick testing, tutorials, or other activities where a local stack is more convenient than a pre-production environment.

To get started, follow the guide for creating a VIP Local Development Environment.

Database backups from a VIP Platform environment can be imported to a running local environment.

Limitations

Though the VIP Local Development Environment is designed to be as identical to a VIP Platform environment as possible, these services are not built-in:

When developing features for an application that rely on these services, it is strongly recommended to stage changes and perform tests on a non-production VIP Platform environment instead of the VIP Local Development Environment.

Stack services

Just like VIP Platform environments, the VIP Local Development Environment has container-based services. Some service containers may expose ports on the local machine.

A list of running services and their accessible URLs can be retrieved with the dev-env info command.

In addition to the web stack (NGINX, PHP, WordPress) and VIP’s vip-go-mu-plugins codebase, the WordPress VIP Local Development Environment provides the following services:

WordPress

WordPress core files are accessible for each local environment in a wordpress directory. For example, for a local environment named example-site, this directory can be found in:
~/.local/share/vip/dev-environment/example-site/wordpress/

Modifications made to WordPress core files, mapped mu-plugins files, or to custom code that was git cloned to the local machine will take immediate effect. The modifications will only affect the local environment associated with the wordpress directory, and will persist if the environment is stopped and restarted using the vip dev-env stop and vip dev-env start commands.

To revert changes made to the WordPress core code, run vip dev-env destroy --soft. This command will also remove all volumes including the database state.

Database

A newly created VIP Local Development Environment is provisioned with an empty MySQL (MariaDB) database. SQL database files can be imported with the import sql command.

Changes made to the database will persist if the local environment or the host machine is restarted, but will disappear if the environment is destroyed with vip dev-env destroy.

By default, PHPMyAdmin is not running in the stack. To make PHPMyAdmin available, a local environment must be created with the --phpmyadmin argument (with no attribute) included in the vip dev-env create command.

The dev-env info command will return the exposed port for the SQL database and a web URL for PHPMyAdmin to access the database.

PHP error logs

PHP error logs can be referenced in Query Monitor in the browser, and raw logs can be tailed from the directory where the site configuration is stored.

Each slug (environment name) has a separate subdirectory in ~/.local/share/vip/dev-environment containing a config and log directory and a .lando.yml YAML file.

For example, to tail the PHP logs for an environment named example-site:

tail -f ~/.local/share/vip/dev-environment/example-site/log/debug.log

Object cache

The same memcached object cache used in production is running in the VIP Local Development Environment. Some database queries are automatically cached and will not appear in Query Monitor.

The local environment’s object cache can be flushed by running the WP-CLI command wp cache flush. The local object cache for specific subsites on a WordPress multisite can be flushed by passing the subsite’s URL with the --url argument. exec -- must be utilized for the command to run against the local environment and not the host machine.

vip --slug=example-site dev-env exec -- wp cache flush

Elasticsearch

The same Elasticsearch service that supports Enterprise Search is running in a created local environment, making it possible to use Enterprise Search on a VIP Local Development Environment.

Last updated: June 21, 2022