This is Lesson 4 of Deploying an Application in Drupal 8.
In this lesson we will:
- Update production database to reflect code changes
Perform application updates after new code has been deployed.
In order to complete this lesson you will need:
- Command line access to an Acquia Cloud Platform subscription
- Drupal 8 application that is deployed to Acquia Cloud Platform
The following tools are not required, but recommended:
Config and database updates
At this point, the code for your new release is on your production server(s). However, your database has not been updated in any way.
A typical code release will require the following database-related actions to be performed:
- Update hooks provided by contributed modules should be executed. This is easily accomplished with
- Changes to exported configuration files should be imported. Depending on your configuration management strategy, this may require
Depending on the changes that your release contains, these commands may need to be run in a specific order or even multiple times. The consequences of running these commands incorrectly can be subtle and complex.
If you are using Acquia BLT, this is handled for you via the
blt deploy:update command, which will run all aforementioned commands in the correct order.
Acquia Cloud Hooks
Acquia Cloud Hooks provide a mechanism for executing a script when a particular action is performed. For releases, the post-code-update and post-code-deploy cloud hooks are relevant. These will allow a custom script to be executed each time that a new tag is deployed to your production environment.
To implement a cloud hook, you must create an executable bash script and place it in a specific location in your codebase.
If you are using Acquia BLT, you can generate a set of default cloud hooks by executing
blt setup:cloud-hooks. This will place default bash scripts into the appropriate directories and set the correct permissions on them. These scripts will implement the aforementioned
blt deploy:update command to execute the suggested database updates each time that you make a deployment.