The VIP Local Development Environment is a feature built into VIP-CLI for creating and controlling an environment on a supported local machine that mimics an environment running on the VIP Platform. This environment can be used for local development, quick testing, tutorials, or other activities where a local stack is more convenient than a non-production environment.
To get started, follow the guide for creating a VIP Local Development Environment.
Though the VIP Local Development Environment is designed to be as identical to a VIP Platform environment as possible, some features are not yet available in the local environment.
- Environment variables must be managed manually and cannot be managed with VIP-CLI.
- VIP File System, Cron control, and Page cache 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.
The VIP Local Development Environment utilizes Docker Engine and Docker Compose. For the VIP Local Development Environment to work as expected, both of these components must be installed on a local machine and maintained at their latest version.
Docker Engine and Docker Compose are commonly installed on a local machine by installing the Docker Desktop application. Depending on the size of an organization, installing Docker Desktop may require a paid subscription.
As an alternative, Docker Engine and Docker Compose can be installed separately.
- macOS and Linux: The Homebrew package manager can be used to install Docker Engine and install Docker Compose.
- Windows: The Chocolatey package manager can be used to install Docker Engine and install Docker Compose.
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 VIP-CLI command:
vip dev-env info.
- Logs for stack services on a running local environment can be retrieved with the VIP-CLI command:
vip dev-env logs.
In addition to the web stack (NGINX, PHP) and VIP’s VIP MU plugins codebase, the WordPress VIP Local Development Environment provides the following services:
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:
Modifications made to WordPress core files, mapped mu-plugins files, or 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.
A newly created VIP Local Development Environment is provisioned with an empty database. SQL database files can be imported to the local database with the VIP-CLI command
vip dev-env import sql.
Database backups downloaded from the VIP Dashboard for a VIP Platform environment are suitable for import to a VIP Local Development Environment.
Changes made to the local database will persist if the local environment or the host machine is restarted, but will disappear if the environment is destroyed with the VIP-CLI command
vip dev-env destroy.
The same Memcached object cache used in production runs 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 network sites on a WordPress multisite can be flushed by passing the site’s URL with the
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
Local environments can be created with versions of PHP that are currently eligible for security fixes ( 8.0, 8.1, 8.2). Users are encouraged to use the VIP Local Development environment as one of several tools for preparing application code for a PHP version upgrade.
PHP error logs for a local environment can be accessed in the terminal with the
vip dev-env logs command. In this example command, logs for PHP are specified with
--service=php, and they are configured to continually output by also passing the
vip dev-env logs --service=php --follow --slug=example-site
PHP error logs for a local environment can also be referenced in a browser with Query Monitor.
By default, these services are disabled. They can be enabled with the
vip dev-env create or the
vip dev-env update commands, by either passing their option into the command or by enabling them within the command’s setup wizard flow.
- Elasticsearch (Option:
--elasticsearch) The Elasticsearch service must be enabled in order to use Enterprise Search on a VIP Local Development Environment.
- phpMyAdmin (Option:
--phpmyadmin) To return the exposed port for the SQL database—and a web URL for phpMyAdmin to access the database—run
vip dev-env infoagainst a running environment.
- Xdebug (Option:
--xdebug) Xdebug can be enabled in the local environment with the setup wizard flow or by passing
vip dev-env createor
vip dev-env updatecommands. To work with Xdebug in Visual Studio Code (VS Code), pass the
--vscodeoption when starting the environment with
vip dev-env start. A
*.code-workspacefile will be generated, and a path to the file will be output in the terminal. Open the file with VS Code. The file contains path mappings for VS Code and Xdebug to interact with the local application code. If necessary,
--xdebug_configcan be used to override the default configuration settings for setting up Xdebug with a code editor application.
- Mailpit (Option:
--mailpit) Mailpit is an email testing tool for developers. A local application can be configured to use Mailpit for SMTP delivery, to view messages in the web UI, and to optionally release messages to real SMTP servers for delivery.
- Photon (Option:
--photon) Enable the built-in service used by the VIP File System that performs core image processing and transformation for local development.
Last updated: August 28, 2023