Code Studio

Selecting the Drupal setup strategy

Enabling a Drupal site setup

You can enable a Drupal site setup in the Code Studio pipeline. If you enable it, Code Studio runs drush site:install after composer install, and you can:

  • Confirm successful completion of database updates and clean import of database configuration into a new database or an existing database copied from Cloud Platform
  • Run PHPUnit tests on a working site

To enable a Drupal site setup:

  1. Add the ACQUIA_TASKS_SETUP_DRUPAL environment variable in Code Studio.

    For information about how to add environment variables in Code Studio, see Adding environment variables.

  1. Set the value of the environment variable to true.

After enabling the site setup, you can:

  • Use the install strategy to install a new Drupal database based on a selected profile
  • Use the sync strategy to sync an existing database from Cloud Platform

For information about how the setup strategy affects your Code Studio pipeline, see AutoDevOps pipeline steps.

Using the install strategy

The following checklist lists the tasks for using the install strategy:

Setting up the install strategy

To set up the install strategy:

  1. Add the ACQUIA_TASKS_SETUP_DRUPAL_STRATEGY environment variable in Code Studio.
  2. Set the value of the environment variable to install
Note

If you leave ACQUIA_TASKS_SETUP_DRUPAL_STRATEGY unconfigured, Code Studio sets it to install by default.

Selecting a profile

The Code Studio pipeline creates a site with a new database based on the selected Drupal profile. If you do not select any profile, Code Studio uses the minimal profile by default.

To change the profile:

  1. Add the ACQUIA_TASKS_SETUP_DRUPAL_PROFILE environment variable in Code Studio.
  2. Set the value of the environment variable to the machine name of your preferred profile.

Importing database configuration

After the database is created, Code Studio imports your database configuration depending on the value you set for the ACQUIA_TASKS_SETUP_DRUPAL_CONFIG_IMPORT environment variable.

To import the database configuration:

  1. Add the ACQUIA_TASKS_SETUP_DRUPAL_CONFIG_IMPORT environment variable in Code Studio.
  2. Set the value of the environment variable to true.
Note

If you set ACQUIA_TASKS_SETUP_DRUPAL_CONFIG_IMPORT to false or leave it unconfigured, Code Studio does not import the configuration.

Using the sync strategy

The following checklist lists the tasks for using the sync strategy:

Setting up the sync strategy

To set up the sync strategy:

  1. Add the ACQUIA_TASKS_SETUP_DRUPAL_STRATEGY environment variable in Code Studio.
  2. Set the value of the environment variable to sync.

Selecting a database

The Code Studio pipeline copies an existing database from a Cloud Platform environment. By default, Code Studio copies the latest backup of the first database from your production environment into the pipeline.

To select a different Cloud Platform environment for copying the database:

  1. Add the ACQUIA_CLOUD_SOURCE_ENVIRONMENT_ID environment variable in Code Studio.

For example, myapp.dev, 14-0c7e79ab-1c4a-424e-8446-76ae8be7e851.

  1. Set the value of the environment variable to the environment alias or UUID of the environment from which you want to copy the database.

To select a different database to copy:

  1. Add the ACQUIA_CLOUD_SOURCE_DATABASE_NAME environment variable in Code Studio.
  2. Set the value of the environment variable to the name of the database you want to copy.

Importing database configuration

To import the database configuration:

  1. Add the ACQUIA_TASKS_SETUP_DRUPAL_CONFIG_IMPORT in Code Studio.
  2. Set the value of the environment variable to true.
Note

If you set ACQUIA_TASKS_SETUP_DRUPAL_CONFIG_IMPORT to false or leave it unconfigured, Code Studio does not import the configuration.