Skip to content

Advanced usage

The VIP Local Development Environment is built to be as identical to a VIP Platform environment as possible, and designed to allow for a wide variety of options needed in local development. Once a user gains familiarity with dev-env commands and options, more advanced techniques and customizations can be explored when working with a local environment.

Add a trusted CA certificate

By default, VIP Local Development Environment URLs resolve with HTTP rather than HTTPS, the secure browsing protocol. When developing locally, some users may have a need for URLs to resolve at HTTPS (e.g. applications with payment integrations). For HTTPS to work as expected, a trusted digital certificate issued by a certificate authority (CA certificate) for the local environment must be added to the user’s machine.

1. Identify the absolute local path of the CA certificate

Once a VIP Local Development Environment has been created, a CA certificate will be located on the user’s local machine.

Example local paths for the CA certificate lndo.site.pem for a current user named “example-user”:

macOS: /Users/example-user/.local/share/vip/lando/certs/lndo.site.pem
Windows: C:\Users\example-user\.local\share\vip/lando\certs\lndo.site.pem
Ubuntu: /home/example-user\.local\share\vip\lando\certs\lndo.site.pem

2. Configure the local machine to trust the CA certificate

The exact commands needed to trust the CA certificate will differ depending on the local machine’s operating system. Refer to Lando’s documentation for trusting the CA certificate for for macOS, Windows, and Debian command examples. When using the command examples in Lando’s documentation, substitute the path of the Lando certificate with the absolute local path of the CA certificate identified in Step 1.

Using the macOS path example from Step 1, and the command examples in Lando’s documentation, the command to trust the CA certificate would be:

sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /Users/example-user/.local/share/vip/lando/certs/lndo.site.pem

If the command is successful, the CA certificate will apply to a running local environment immediately without needing to restart. The trusted CA certificate will persist and can be used by all other VIP Local Development Environments that are created on that machine.

Executing dev-env commands non-interactively

In some cases, there may be a need to execute one or more dev-env commands in a non-interactive mode. For example, executing a series of dev-env commands in a script to create and start a VIP Local Development Environment, and to run a WP-CLI command that generates dummy content.

Several dev-env subcommands such as create require user interaction to confirm option setting values. This can prevent a subcommand from completing as expected if it is executed non-interactively.

To successfully execute dev-env subcommands non-interactively, pass dev-env subcommands with < /dev/null. This will close the standard input and assign default values to any options that have not been explicitly defined in the executed command.

For example:

vip dev-env create --slug=example-site --multisite=y --php=8.0 < /dev/null

< /dev/null can also be passed when running a script that executes dev-env subcommands:

./example-script-that-creates-environment < /dev/null

On a machine running Windows OS, use < NUL instead. NUL is equivalent to /dev/null in Linux and macOS.

Global Lando config

The VIP Local Development Environment is powered by Lando, an open source software that abstracts some aspects of the Docker Compose application. VIP Local Development Environment is built to be as identical to a VIP Platform environment as possible, while still allowing for customization by developers.

If customization of the global Lando config is needed, users can add their own config.yml to ~/.local/share/vip/lando. Restart the local environment with vip dev-env start in order for the settings in the Lando config.yml to be applied.

Last updated: March 06, 2023