Deploying your website
Install Acquia Cohesion sync
Install the Acquia Cohesion sync module; you can do this through the UI by navigating to: /admin/modules or running the following drush command in your terminal:
drush pm-enable cohesion_sync -y
Deployment steps (UI):
For a guide to using Acquia Cohesion sync through the UI, see Package export and import.
Deployment steps (Drush):
Acquia Cohesion Sync allows you to export all of your Acquia Cohesion configuration including styles, templates and components along with all file entity asset dependencies as a single package. You export this package to the
sync directory and commit to your repository for later deployment in a similar way to performing a core config export/import.
It is designed to be used alongside core config export/import. A typical workflow would involve using core config export/import to move all configuration except for Acquia Cohesion entities and using Acquia Cohesion sync to move the rest.
Configuring your sync directory
This is the location of your site configuration files.
settings.php you will need to enable the block of code as shown below. If you're using Drupal core config import/export, you will need to add
CONFIG_SYNC_DIRECTORY => '/directory/outside/webroot', as an entry to the
$config_directories array below.
$config_directories = [ 'dx8_sync' => 'sites/default/files', ];
It's possible to set the
dx8_sync directory to the same sync directory as core (which is
/sync by default), or you could export to the filesystem in
sites/default/files for example.
Configuring entity types to include in the export
With Acquia Cohesion and the Acquia Cohesion sync modules installed, navigate to: /admin/cohesion/sync/export_settings from here you can select which entity types will be scanned for the export.
To export all Acquia Cohesion packages and dependencies to your sync directory, use the following drush command:
This will create a file called:
[your-site--name].package.yml_ in your sync directory. The file has an underscore after the file extension so that Drupal core config import/export doesn't detect and process it.
To export your Acquia Cohesion configuration using a custom filename, use the following drush command:
drush sync:export --filename-prefix=myfilenamehere
This will create a file called:
myfilenamehere.package.yml_ in your sync directory.
To import all previously exported
*.package.yml_ files from your
sync directory into the current site, use the following drush command:
Note that you will need to use one of the following options to tell Drupal what to do when it finds differences between the entities in the
*.package.yml_ files and your site.
drush sync:import --overwrite-all drush sync:import --keep-all
While the import is running, your site will be placed into maintenance mode.
To deploy a specific
*.package.yml file via drush, you can specify a local or remote file path like this:
drush sync:import --path=/path/to/local.package.yml drush sync:import --path=http://domain.com/remote.package.yml
Acquia Cohesion Sync will detect if the path you provided is a local or remote file and handle streaming automatically. You can also use the
--keep-all options when specifying a path.
Deploying a list of packages on module install
Module developers can export Acquia Cohesion Sync packages and include as part of their module. When set-up correctly, the packages will automatically deploy when the module is enabled.
To set this up, create a new Yaml reference file inside your module:
This file should only contain a simple array which references paths to local or remote files. For example:
# This is my package reference file. - config/dx8/my.package.yml - http://mydomain.com/my.package.yml
Note that when including local files, the path should be relative to the module root directory.
Exporting Drupal configuration can be done using the drush command drush cex. This command exports all your website configuration into your sync directory including Acquia Cohesion configuration, although this wouldn't include any file/image assets used within Acquia Cohesion. Using Acquia Cohesion sync to export Acquia Cohesion configuration, makes sure all file/image assets are also exported.
You could export all configuration and then import all your website configuration and then Acquia Cohesion configuration over the top using Acquia Cohesion sync as it will bring dependencies with it. This approach works though is not ideal.
Using a module such as configuration split you can then split out specific configuration by Drupal module.
For example, you could create a 'split' which includes all configuration except Acquia Cohesion, as you would then use Acquia Cohesion sync to export Acquia Cohesion configuration including any file/image asset used.
Find out more about configuration split module on their online documentation.