BLT and DDEV -- Together!

BLT (Build and Launch Tool) provides an automation layer for testing, building, and launching Drupal 8 applications. It is the default recommended tool used by Acquia Professional Services. We use BLT in Professional Services to sync databases, manage configurations, create artifacts for deployments, and tons of other things that -- most of the time -- save us time. If you have not tested it yet I’d recommend you to have a look: https://github.com/acquia/blt

DDEV, on the other hand, is a Docker-based, open source tool that helps you to quickly spin up a (local) environment in applications like Wordpress; Drupal 6, 7 and 8; Backdrop, and Typo3. Have a look at https://github.com/drud/ddev

DDEV is not the only Docker-based tool like this that exists right now, but what I love is the simplicity and speed on getting a local environment up and running.

If you want to see a “tutorial” have a look at this tweet (yes, I said tutorial in a tweet -- that's how simple and elegant DDEV is): https://twitter.com/morenodotnet/status/1034831985204781056

Actually two tweets :-)

And boom! A new Drupal site just like magic.

The only missing link in these tweets is Acquia's recommended Swiss Army knife, BLT, used with my preferred tool for spinning up quickly sites, DDEV.

Here's all you have to do to add BLT to my tweet tutorial:

1. export SITENAME=ddevlovesblt
2. composer create-project --no-interaction acquia/blt-project ddevloveblt
3. ddev config --docroot docroot --projectname $SITENAME --projecttype drupal8

Note that the assumption here is that you have Docker installed in your system and obviously ddev.

Now we need to update the .dev config file in order to have BLT available inside DDEV:

hooks:
  post-start:
  - exec: "ln -sf /var/www/html/vendor/acquia/blt/bin/blt /usr/bin/blt"

Now simply start DDEV and build the site, but instead of using DDEV, we’ll use BLT.

4. ddev start
5. ddev ssh
6. blt setup

After that you should see something like this:

[success] Installation complete.  User name: PXXpTXSeVQ  User password: UqAbRpXHCU

That’s it. Your site is available in the url that DDEV gave you earlier.

Some things that still need some polishing are the docroot path. I would change that to what BLT is using (/var/www/html), so we’ll avoid issues related to specifics in BLT itself. We’ll try to do a follow up post with our findings.

NOTE: BLT needs php bz2 package, which is added in this Pull Request https://github.com/drud/ddev/pull/1254

If your version of DDEV still doesn't have that patch you can install that dependency on your container adding this line to your .ddev/config.yml:

hooks:
  post-start:
  - exec: bash -c "sudo apt-get update && sudo apt-get install -y php7.1-bz2"

Again, this is necessary only until the PR I mentioned above is merged and released. And the guys in BLT are amazingly efficient, so expect that to happen very soon :-).

Special thanks to Sharique Ahmed Farooqui for his help and contribution on testing the steps on this article.

NOTE: This article is not an endorsement by Acquia, but a personal preference by myself (Alex Moreno) for some particular tasks or projects. Each project can be different, and the complexities, nature and problems to solve may require other solutions and or tools. Talk to our PS team in case of any questions.