Service Offerings

Working with Drush

Drush is a command line (CLI) tool for interacting with a Drupal site locally or remotely. Drush is not globally available on China Managed Services and it should be deployed inside the Drupal codebase through composer.

Installation of Drush

To install Drush, Acquia recommends adding it as a composer dependency to your Drupal codebase.

composer require drush/drush:^10.0

This will install drush into the vendor/bin directory of your codebase root.

Important

This document assumes this is where your drush executable is found.

Drush aliases

Drush aliases help make it easier to access your sites on China Managed Services using drush. When your full provision is complete, you’ll receive an Acquia Support ticket with:

  • The IP addresses for your dev, test, and prod environments

  • Username for your unix/application user

Important

You’ll need to provide SSH public keys and originating IP addresses to the Support ticket so that your SSH access (and drush aliases) work correctly.

To configure remote access to your China Managed Services environments, create a <app>.site.yml drush alias file as shown in the following example:

prod:
  host: <prod_ip_address>
  user: <app_user>
  root: /var/www/<app_user>/html/source/docroot/
  uri: http://www.<app_domain>.com.cn
  ssh:
    options: '-o ProxyJump=<app_user>@<bastion_ip_address> -o ForwardAgent=yes'
  paths:
    drush-script: '/var/www/<app_user>/html/source/vendor/bin/drush'
 test:
  host: <test_ip_address>
  user: <app_user>
  root: /var/www/<app_user>/html/source/docroot/
  uri: http://test.<app_domain>.com.cn
  paths:
    drush-script: '/var/www/<app_user>/html/source/vendor/bin/drush'
 dev:
  host: <dev_ip_address>
  user: <app_user>
  root: /var/www/<app_user>/html/source/docroot/
  uri: http://dev.<app_domain>.com.cn
  paths:
    drush-script: '/var/www/<app_user>/html/source/vendor/bin/drush'

Important

The production environment routes through a bastion server and uses the ProxyJump command to seamlessly jump through it.

Internal Jump Server

If your organization requires you to proxy through a corporate jump server so that you can originate from an allowlisted IP, you can add this to your ssh config so that the above drush alias configuration still works.

Host corporate.proxy
ForwardAgent yes

Host <dev_ip_address>
ProxyJump corporate.proxy

Host <test_ip_address>
ProxyJump corporate.proxy

Host <prod_ip_address>
ProxyJump corporate.proxy