Preparing a Codebase for Site Factory: Part 1
- Last updated
- 2 minute read
Goal
Use Cloud IDE to install a Drupal 10 and prepare a codebase for Acquia Site Factory (ACSF).
Overview
In this comprehensive, three-part guide, I will show how to set up Cloud IDE, install Drupal 10, and finally prepare your codebase for Site Factory by giving it a custom installation profile. We will leverage Acquia BLT helper scripts and recipes to standardize and accelerate what would otherwise be a lengthier sequence of manual steps.
The approach covered here will enable you to install fresh new Drupal sites on ACSF using the current configuration files in your codebase. Additionally, I hope you will gain valuable insights into the end-to-end ACSF deployment workflow, as we will make a few codebase modifications and then push them out to existing ACSF sites.
This guide has been divided into three parts so that you can pace yourself.
- 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
Let's get started.
-
Create your Cloud IDE instance
Login to your Acquia Cloud Platform account:
ImageClick the “Actions” button and select “Create Cloud IDE”. Give a name to your new Cloud IDE instance and click the “Submit” button:
ImageWe want to install Drupal 10, so we need to make sure that the PHP version of our environments is set to PHP 8.1:
Image -
Cloud IDE Configuration
Open your Cloud IDE instance:
ImageImageMake sure the PHP version of your Cloud IDE is also set to PHP 8.1:
If your Cloud IDE instance is using an older version of PHP, you can change it.
On the “Get Started” page of your Cloud IDE, click the “Configure IDE” button to connect your IDE to your Cloud Platform account:
Image -
Create a new Drupal project
The Acquia Drupal Recommended Project is a project template providing a great out-of-the-box experience for new Drupal 10 projects hosted on Acquia. It is based on the Drupal Recommended Project, with the principal difference being the addition of several modules and packages that provide the best possible out-of-the-box experience for Acquia customers.
For this tutorial, We will use the 2.0.63 release of the Acquia Drupal Recommended Project:
https://github.com/acquia/drupal-recommended-project/releases/tag/2.0.63Open a new Terminal window in your Cloud IDE and execute the following composer command:
Once the process has finished, you can check the current status of your Drupal project by typing "drush status":
-
Install Drupal 10
Open your local Cloud IDE website to continue the Drupal 10 installation. On the Menu, navigate to “Manage Drupal Application” -> “Open Drupal Application”
ImageChoose the language for your new site and click the “Save and continue” button:
ImageFor the installation profile, select “Standard”. Click the “Save and continue” button to continue:
ImageLeave the default Database type and enter “drupal” as the database, username, and password. Click the “Save and continue” button:
ImageWait until the installation process has been completed. To complete the Drupal Installation Wizard, you will need to configure your new site and create credentials for the super admin user (uid1). Click the “Save and continue” button to proceed.
ImageYou should see your new Drupal 10 site:
ImageCheck the status of your new site using drush:
-
Install BLT
https://docs.acquia.com/blt/install/adding-to-project/
At the command prompt, change to your existing project directory with the cd command.
To configure Composer’s minimum-stability and prefer-stable values, run:Install BLT with the following Composer command:
Image -
Preparing your codebase for Acquia Cloud Site Factory
Install Acquia BLT ACSF
https://github.com/acquia/blt-acsf
Install the ACSF Connector module
https://docs.acquia.com/site-factory/module/
https://www.drupal.org/project/acsfActivate the ACSF module:
Configure the Site Factory Connector module in your codebase using BLT:
Download and extract the updated Acquia Cloud Site Factory Connector:
(Run each time there is a core update)
ImageInstall the Config Ignore and Config Split modules
https://www.drupal.org/project/config_ignore
Enable the Config Ignore module:
Install the Config Split module:
Enable the Config Ignore module:
-
Add my custom Drush Alias Generator bash script
I wrote a custom bash script that simplifies the process of adding Drush aliases to your codebase. This will allow you to run Drush commands against your ACSF sites from your Cloud IDE instance with ease.
Inside the project folder, next to the blt, config, and docroot folders, create the following new folders:
Using nano or vim, create the new aliasgenerator.sh bash script:
Copy the following code and paste it inside your new aliasgenerator.sh script. Follow the instructions inside to configure your bash script so it works with your ACSF account:
Save your changes.
Make this bash script executable with the following command:
Use the following command to execute this script:
-
Edit your blt/blt.yml file
To edit your blt/blt.yml file, you will need to find out the ID of your application and the URL of your Acquia repository.
Go to your Acquia Platform account and click the “Product Keys” option from the left menu, your Application ID is listed under Username and Application UUID:
ImageTo find out the URL of your Acquia repository, go to your Acquia Platform account and click the “Actions” to reveal the dropdown and select “View Git information”:
ImageImageEdit your blt/blt.yml file and replace its content with the following code:
Replace the following three keys: machine_name, appId, Acquia SVN git remote url:
- machine_name: YOUR_MACHINE_NAME (Example: d10acsf)
- cloud:
- appId: YOUR_APP_ID (Example: 48efba74-75af-43ef-8455-32e6f043c375)
- git:
- remotes:
- cloud: YOUR_ACQUIA_GIT_URL (Example: 'acquiatam2@svn-2398.enterprise-g1.hosting.acquia.com:acquiatam2.git')
- remotes:
-
Push your codebase to your remote repository
Create a new repository on GitHub.com (https://github.com/new). To avoid errors, do not initialize the new repository with README, license, or gitignore files.
I named my repository “d10acsf”:
ImageClick the “Create Repository” button.
To enable your IDE to push code to GitHub.com, add the public key to your GitHub.com account profile.(Visit https://github.com/settings/profile and select "SSH and GPG Keys"
You can locate the public key within your IDE by navigating to ~/.ssh
Once you add the public key to GitHub.com, you can test whether the connection between your Cloud IDE and GitHub.com is working as follows:
Finally, go back to your Cloud IDE instance and execute the following git commands to push your new codebase to your repository:
Make sure to replace https://github.com/astralmemories/d10acsf.git with your own remote repository URL.
Export the current Drupal configuration:
Push your codebase changes to your repository:
Image
Congratulations on completing the initial phase of this three-step guide! You have navigated through the process of creating a new Drupal 10 codebase that is configured for ACSF. Now, let's head to the next phase where you will learn how to craft a custom Drupal installation profile.
Next phase: Create a Custom Profile and test New Site Creation with Site Factory