Create a Custom Profile for use with Site Factory: Part 2
- Last updated
- 1 minute read
Goal
Create a Custom Profile and install your first site on ACSF.
Overview
This is Part 2 of a comprehensive tutorial covering the set up of a new Drupal 10 codebase for Acquia Cloud Site Factory (ACSF). In this segment, you will set up a custom Drupal installation profile. Additionally, you will gain valuable insights into the ACSF deployment workflow (including configuration management, which is essential if you want to create operational efficiencies, launch websites faster, and scale your platform with confidence. We will be working with Acquia Cloud IDE to simplify the development and deployment process.
This guide has been divided into three parts:
- Set up Cloud IDE, Install Drupal 10, and Prepare your Codebase for Site Factory
- Create a Custom Profile and test New Site Creation with Site Factory
- Implementing Configuration Management and Proving out the Site Factory Deployment Workflow
In the following steps, I will guide you through the process of creating a custom Drupal installation profile.
-
Create a new Custom Profile
We will create a new custom profile named acsfprofile. This custom profile will be used to create new sites on ACSF:
Set the new profile as default in your codebase
Modify the following files to add the new profile (acsfprofile):
- config/default/core.extension.yml
Go to the end of your core.extension file and make the following changes (Changes are shown using a left arrow <-- ):
- /home/ide/project/blt/blt.yml
Generate the tamprofile.info.yml file
Using the /home/ide/project/config/default/core.extension.yml file, we will generate the acsfprofile.info.yml file.
/home/ide/project/docroot/profiles/custom/tamprofile/acsfprofile.info.yml
This new file will inform Drupal about the required modules and themes that should get installed when the acsfprofile custom profile is used to create a fresh Drupal install.
To create your acsfprofile.info.yml file do the following:
Add the following 6 lines of code to the beginning of the acsfprofile.info.yml file:
Copy all the values from the “module” section of your core.extension.yml file to your acsfprofile.info.yml file:
Now, in your acsfprofile.info.yml file, replace “module:” with “install:” and modify all the modules inside the “install:” section by adding a dash ( - ) to the beginning of each module and removing the leading number after each module ( : 0 ):
Copy all the values from the “theme” section of your core.extension.yml file to your acsfprofile.info.yml file:
In your acsfprofile.info.yml file, modify all the themes inside the “theme:” section by adding a dash ( - ) to the beginning of each theme and removing the leading number after each theme ( : 0 ):
The resulting acsfprofile.info.yml file should look similar to the following example:
-
Install a local site from existing configuration with BLT
Make sure you are located inside the project folder:
Install a new Drupal site using the existing configuration on disk:
You should get a successful installation with no configuration differences.
ImageUse the following drush command to make sure there are no configuration differences between the new site’s database and the existing configuration on disk:
If they are different, you will have to run "drush cex" again to resolve the differences, then run "blt install" again.
Check the newly installed site using “drush uli” and make sure everything looks fine:
-
Test the installation profile simulating Site Factory’s site creation
To make sure everything is working fine, we will reinstall a new site simulating the commands used in Site Factory:
Execute the following BLT command to update the database and perform post site install configuration tasks to the new site:
Check the newly installed site with dush uli:
-
Push all the changes to your repository
If everything looks good, we should now be able to push the new codebase to ACSF.
Execute the following composer command to generate a new hash in your lock file so that your composer.json and composer.lock files are in sync:
Push your new codebase to your repository:
-
Deploy your codebase to ACSF
Use the following BLT command to deploy your codebase to ACSF:
This command gives you the ability to add a tag to your new codebase that will be available to choose from on any of your ACSF environments.
When prompted, enter “y” to create a new tag:
Press Enter to use the same commit message:
I named my new deployed code: 1.0.0-d10acsf
-
Update your ACSF code
Go to the ACSF Console UI of one of your lower environments. For this tutorial, I will use the test environment.
Go to Administration -> Update code:
ImageIn the Site Update page, use the dropdown to select your new codebase (1.0.0-d10acsf):
ImageClick the Update button and wait until the update process finishes:
Image -
Add the new profile to ACSF
Go to Administration -> Installation profile management, enable the acsfprofile profile and make it REST API Default:
ImageClick the “Save settings” button.
-
Create a new Site Group in your ACSF account
Login to your ACSF Console UI and click the “New Group” button:
ImageAssign a name to your new Site Group and save your changes:
ImageImage -
Create your first ACSF site
Create a new ACSF site using your new codebase. Go to Sites and select your group:
ImageClick the “Create a new Site” button.
Give a name to your new site (Example: site1), and click the “Create Site” button:
ImageImage -
Login to your new ACSF site
In your Cloud IDE instance, create a new drush alias for your new ACSF site using the aliasgenerator.sh bash script. Execute the aliasgenerator.sh bash script and follow the instructions:
Now you can execute drush commands from your Cloud IDE instance against your ACSF site following this structure:
Because we created site1 in the test environment, the drush commands should look like this:
Check your new site for configuration differences:
Access your new ACSF site using drush uli:
Congratulations on completing the second phase of the three-step guide! You have navigated through the process of creating a custom Drupal installation profile. Now, let's head to the last phase where you will learn about configuration management and deployment workflow on Site Factory.
Next phase: Implementing Configuration Management and Proving out the Site Factory Deployment Workflow