Skip to content

Target environments with VIP-CLI commands

An application on VIP can include one or more environments, and users may have access to more than one application hosted on VIP. A VIP-CLI command can only be run against one environment at a time, so both an application and an environment type must be specified in a VIP-CLI command.

Prerequisite

A user can determine which applications are available to them with the vip app list command. For example:

$ vip app list
┌──────┬─────────────────┬─────────────────────────────────┐
│ id   │ name            │ repo                            │
├──────┼─────────────────┼─────────────────────────────────┤
│ 8886 │ example-app     │ wpcomvip/my-org-example-app     │
├──────┼─────────────────┼─────────────────────────────────┤
│ 4325 │ mytestmultisite │ wpcomvip/my-org-mytestmultisite │
└──────┴─────────────────┴─────────────────────────────────┘

The output returned by the vip app list command includes the application ID (id), the application name (name), and the GitHub repository (repo).

An application can include one or more platform environments; typically Production, Preprod, and Develop. A user can list the environments that are available for an application with the vip app [ID] command. Using the application ID 8886 from the example output above, the command vip app 8886 reports that the application includes a production and a develop environment:

$ vip app 8886
===================================
+ id: 8886
+ name: example-app
+ repo: wpcomvip/my-org-example-app
===================================
┌──────┬────────┬────────────┬────────────┬────────────┬────────────────┬────────────────────────────────┬──────────┐
│ id   │ app id │ name       │ type       │ branch     │ current commit │ primary domain                 │ launched │
├──────┼────────┼────────────┼────────────┼────────────┼────────────────┼────────────────────────────────┼──────────┤
│ 8886 │ 8886   │ production │ production │ production │ 39c3133        │ example-app.go-vip.net         │ false    │
├──────┼────────┼────────────┼────────────┼────────────┼────────────────┼────────────────────────────────┼──────────┤
│ 8887 │ 8886   │ develop    │ develop    │ develop    │ 39c3133        │ example-app-develop.go-vip.net │ false    │
└──────┴────────┴────────────┴────────────┴────────────┴────────────────┴────────────────────────────────┴──────────┘

Target by application name

A VIP-CLI command can be run with only the application’s name specified: @<app-name>

When a VIP-CLI command is run with this structure, a prompt will appear in the command line to select the environment type.

To target the preprod environment for an application with the name example-app:

$ vip @example-app -- wp option get home
? Which environment? … 
  production
❯ develop

Application alias by name

The environment type can be specified within the VIP-CLI command by including the application’s name, a dot separator, and the target environment type. For example: @<app-name>.<env>

To target the develop environment of an application with the name example-app:

$ vip @example-app.develop -- wp option get blog_public
1

Target by application ID

A VIP-CLI command can be run with only the application’s ID specified: @<app-ID>

When a VIP-CLI command is run with the @<app-ID> structure, a prompt will appear in the command line for the environment type to be specified.

For example, to target the develop environment for an application with the ID 8886:

$ vip @8886 -- wp option get blog_public
? Which environment? … 
  production
❯ develop

Application alias by ID

The environment type can be specified within the VIP-CLI command by including the application’s ID, a dot separator, and the target environment. For example: @<app-ID>.<env>

To target the develop environment for an application with the ID 8886:

$ vip @8886.develop -- wp option get blog_public
1

Last updated: June 19, 2024

Relevant to

  • Node.js
  • WordPress