Creating a new Drupal website on Acquia Cloud Platform:
Before you begin, make sure you have Composer and Git installed in your development environment (e.g. your laptop or Cloud IDE)
1 - Clone your Acquia repository into a new folder like ProjectName and create a new branch:
git clone sitename@serverName.hosting.acquia.com:Sitename.git ProjectName
cd ProjectName
git checkout -b MyBranchName
2 - Creating a composer.json and composer.lock:
composer create-project --no-install drupal/recommended-project .
3 - Modify composer.json by replacing "web/" with "docroot/". You can use your preferred editor or run the following bash command:
sed -i'.original' 's/web\//docroot\//g' composer.json
4 - Add the asset-packagist.org as an additional repository to provide access to supplement packages.drupal.org and provide access to additional packages:
composer config repositories.1 composer https://asset-packagist.org
5 - Configure the location and name of the vendor directory:
composer config vendor-dir vendor
6 - Select your preferred installation type (options are source, dist or auto):
composer config preferred-install dist
7 - Add the following useful projects:
composer require drush/drush:^10.0 --no-update
composer require drupal/stage_file_proxy --no-update
composer require drupal/mysql56 --no-update
composer require cweagans/composer-patches --no-update
Note: The dependency drupal/mysql56
is currently required for Drupal 9.x and only for as long as MySQL 5.6 is the default version on Acquia Hosting.
8 - Add the following in the section labeled "extra” in your composer.json for future patches. You can read Patching with Composer for more details.
"enable-patching": true,
"patches": {
"drupal/[module_name]": {
"Note regarding the nature of the patch being applied": "https://www.drupal.org/files/issues/[patch_name].patch"
}
},
9 - Configure Composer to continue if a patch failed:
composer config extra.composer-exit-on-patch-failure false
10 - Add the following after the section labeled "extra” in your composer.json. These scripts will remove .git folders after each update to make sure git is tracking all files:
"scripts": {
"post-install-cmd": [
"find docroot vendor -name '.git' | xargs rm -rf",
"find docroot vendor -name '.github' | xargs rm -rf"
],
"post-update-cmd": [
"find docroot vendor -name '.git' | xargs rm -rf",
"find docroot vendor -name '.github' | xargs rm -rf"
]
}
11 - Now you need to add your database connection. Copy default.settings.php over to settings.php. Then modify the settings.php by following the instructions on the Acquia require line documentation page.
cp docroot/sites/default/default.settings.php docroot/sites/default/settings.php
12 - Add the following to your settings.php for configuration management:
$settings["config_sync_directory"] = $app_root . '/../config/' . basename($site_path);
13- Run the following composer command to install all dependencies.
composer install
14 - Add and commit your code:
git add .
git commit -m "Initial commit of new Drupal core site."
15 - Push your changes to the Acquia repo. Run the following command and it will create a new tracking branch on the remote repo:
git push --set-upstream origin MyBranchName
16- Go to your Acquia Cloud and switch the code to your branch on your preferred testing environment (e.g. test or dev).
17 - Now you need to go to the site page and follow Drupal installation steps.