Deploying your website
Install Acquia Site Studio sync
Install the Acquia Site Studio 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 Site Studio sync through the UI, see Package export and import.
Deployment steps (Drush):
Acquia Site Studio Sync allows you to export all of your Acquia Site Studio configuration including styles, templates and components along with all file entity asset dependencies as a package. You export this package to the
sync directory and commit to your repository for later deployment in a similar way to performing a Drupal 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 Site Studio entities and using Acquia Site Studio sync to move the rest.
Configuring, Exporting and Importing configuration
For a guide to using Drush command to manage packages see Package management via Drush
Deploying a list of packages on module install
Module developers can export Acquia Site Studio 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 contain an array following the specific format. Each package in array can have "type", "source" and "options":
- type - required property that decides how metadata in source property will be handled. For the default implementation of package handling where package files located in local filesystem, use default_module_package.
- source - required property, that provides metadata required to import the package. For example, if type is set to default_module_package, then source needs to contain properties module_name (which refers to machine name of the module that contains the package files) and path (which refers to path from the module directory to the package files directory)
- options - optional property, which allows for extra settings to be passed. Currently only extra-validation option is supported. If options property is omitted, extra-validation is set to false by default.
Here's an example of
site_studio.packages.yml containing two packages, both using default_module_package type:
- type: default_module_package source: module_name: test_module path: /config/blog_feature_package options: extra-validation: false - type: default_module_package source: module_name: test_module path: /config/coh_component_hero_shallow options: extra-validation: true -
Customising package source types
In the examples above we use type of default_module_package. This type is handled by
modules/cohesion_sync/src/Services/DefaultModulePackage.php service. Package source type services are gathered by
PackageSourceManager service collector using
sitestudio_package_source tag. It is possible to add your own custom types that would handle default packages in a different manner, for example fetching package stored in a remote FTP or AWS S3 bucket. To do so, you would need to follow these steps:
- Write your own package source service that Implements
- Register your service using
sitestudio_package_sourcetag and appropriate priority, depending if you are registering a new source type or overriding an existing one.
- Define your
site_studio.packages.ymlcontaining your new (or overridden) type and relevant metadata in source property.
More information about service collection and service tags is available here.
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 Site Studio configuration, although this wouldn't include any file/image assets used within Acquia Site Studio. Using Acquia Site Studio sync to export Acquia Site Studio 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 Site Studio configuration over the top using Acquia Site Studio 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 Site Studio, as you would then use Acquia Site Studio sync to export Acquia Site Studio configuration including any file/image asset used.
Find out more about configuration split module on their online documentation.