Standardize development and automate deployment with Acquia Developer Studio

In today’s digital landscape, developers have a huge toolbox to help them build spectacular digital experiences, but the trick is getting these tools to fit together. Tools can improve the way developers work, and the quality, reliability and overall success of an application. As Drupal matures, new tools are created, and old tools become familiar again. Most Drupal 8 projects should use Git, Drush and Composer, and continuous integration and delivery to test, build and deploy code.

Standardization is the key to reducing errors and automating common tasks, but it can be difficult to harmonize so many technologies. We recently published Standardizing Your Development Workflow for Drupal 8 and Beyond to describe the value, benefits, and recommendations for common tools and processes, which will simplify common tasks, enforce best practices, and build team knowledge and morale.

Using the new Acquia Developer Studio CLI, a single command can be used to create a new Drupal 8 project in a couple minutes, leveraging all the tools Acquia recommends, including Lightning, BLT and LandoAcquia Pipelines makes it easy to implement automated deployment workflows. Developer Studio is built on two core principles -- an out-of-the-box, developer toolchain that allows for immediate productivity and the ability to swap out or configure all our products to best fit users needs.  These principles are the framework in which we can provide quick, opinionated pathways to build, test, deploy and monitor digital experiences.

Follow the steps outlined below to standardize development and automate deployments using the ADS CLI, BLT, Pipelines, Lando, Composer and Drupal configuration management and the Configuration Split module.

Getting ready

Satisfy the system requirements for the Acquia Developer Studio CLI, BLT, Lando and Acquia Pipelines, and create a development repository on GitHub or BitBucket and configure Acquia Pipelines to connect to it.

Use a single Acquia Developer Studio CLI command to create a new Drupal 8 project, leveraging all the tools Acquia recommends, including BLT, Lightning, and Lando:

ads new

Add the Acquia Git repository as the value for git.remotes in blt/blt.yml:

git:
  default_branch: master
  remotes:
    - 'ACQUIA_REPO_URL'

Use Acquia Pipelines to build, test, and deploy your application by running:

blt recipes:ci:pipelines:init

Edit blt/blt.yml to remove all modules in modules.*.enable and modules.*.disable to use configuration management instead:

modules:
  local:
    enable: {}
    uninstall: {}
  ci:
    enable: {}
    uninstall: {}
  dev:
    enable: {}
    uninstall: {}
  test:
    enable: {}
    uninstall: {}
  prod:
    enable: {}
    uninstall: {}

Enable Drupal configuration management by running the following commands:

lando drush cex
lando ssh
blt setup
drush cex
blt recipes:cloud-hooks:init

Add the GitHub repository as a remote, then commit everything and push the master branch to GitHub. Acquia Pipelines will detect the branch, run tests, and push the pipelines-build-master branch to the Acquia repository:

git remote add origin GITHUB_REPO_URL
git add -A
git commit
git push origin master

Deploy the pipelines-build-master branch to the Staging environment, which should always track the HEAD of the build-master branch.

Move the code from Stage the Prod via the Cloud UI to create and deploy a tag. Alternatively, manage tags with GitHub by creating releases to kickoff the build and deploy processes.

Finally, install Drupal with with the following commands:

 lando drush @SITENAME.prod ssh
/var/www/html/SITENAME/vendor/bin/blt artifact:install:drupal

Bonus: initialize config_split

The Configuration Split module grants the ability to override specific settings in different environments and BLT offers native support to initialize them:

lando drush en config_split
lando drush cex
blt recipes:config:init:splits
lando drush cim

Set cache times to a day and run:

lando drush cex

Update the local config split to graylist system.performance and run:

lando drush cex

Disable caching and run:

lando drush cex
lando drush csex ci

Push the master branch to GitHub to trigger the build process. When finished, changes will be reflected in the Stage environment!

There are some jobs to be done that developers shouldn’t have to do, such as security patching or end of life software upgrades. The Acquia Developer Studio automates many of these tasks so that developers can focus on building features and things that drive business value. Acquia Developer Studio empowers developers to focus on tasks that matter without sacrificing flexibility or speed. For a company, this means a huge return on value by allowing for a lower total cost of ownership for development efforts, a faster time to value and flexible product offerings that help companies integrate all of their tools in a well-connected ecosystem.