What are the challenges and strategies for managing multiple websites effectively, ensuring continuous integration and deployment?
Imagine if you could upgrade your Drupal upstream site to Drupal 10 seamlessly, without having to worry about the intricacies of the build and deployment process. That’s exactly what our agency faced: a pivotal challenge that required a complete overhaul of our workflow on Pantheon.
In this article, I’ll take you on a journey through our experience, sharing the obstacles we encountered with Pantheon’s Autopilot and the innovative solutions we devised to streamline the process. Get ready to learn how you can upgrade your Drupal site effortlessly and efficiently!
The Challenge with Pantheon’s Autopilot
Pantheon Autopilot offers a streamlined way to manage updates across multiple environments automatically. However, it poses limitations for projects that utilize continuous integration build tools like CircleCI. Autopilot does not support sites that require build tools for their deployment process. This was a significant roadblock for us because our project relied heavily on CI tools to manage complex builds and deployments.
Initially, we heard of people using a sandbox site on Pantheon to build their projects and then push these to GitHub. This GitHub repository would then act as an upstream for Autopilot to deploy to other sites. However, this approach would have created an overwhelming amount of documentation and added layers of complexity to our workflow—something we wanted to avoid to keep our process lean and manageable. We knew there must be a better way.
Upgrading to Drupal 10
The main premise of our project was to upgrade our Drupal upstream site to the latest, Drupal 10. This required a complete overhaul of our existing CircleCI docker build profile provided by Pantheon. The new profile needed to support Drupal 10’s requirements and integrate seamlessly with our existing tools and workflows.
Note: If you want to integrate CircleCI into your Drupal project, here’s a good place to start.
Why We Couldn’t Use Autopilot
As we delved deeper into the upgrade, it became apparent that using Pantheon’s Autopilot with our GitHub upstream repository wasn’t feasible due to the restrictions on build tools. Autopilot, while beneficial for straightforward deployments, could not accommodate the complexities of our Drupal 10 upgrade, which depended heavily on external build tools for themes, modules, and libraries.
Our Solution: GitHub Actions for Automated Workflow
To circumvent these limitations, we turned to GitHub Actions. This powerful automation tool allowed us to create a customized workflow that handles the deployment process from GitHub to Pantheon without the need for Autopilot. Our new workflow included:
- Automated Testing and Building: Each pull request triggers CircleCI to build and test the changes, ensuring that every update meets our quality standards before merging.
- PR Multidev Creation and Deletion: We configured CircleCI to deploy each PR build to a Pantheon (empty upstream) multidev environment. This setup was crucial for testing changes in a Pantheon live-like environment without affecting our main site. Once the PR is approved and merged, the associated multidev environment is automatically deleted, keeping our Pantheon dashboard clean and manageable.
- Seamless Deployment to Pantheon: Upon merging a PR into the master branch, our GitHub Actions workflow kicks in to deploy these changes. It automatically accepts the upstream updates on the DEV environment, pushes approved changes to TEST, and finally to LIVE. This entire process is logged, providing transparency and immediate feedback on deployment status and any issues encountered.
Step-by-Step Guide
Here’s how we accomplished our workflow:
- Configure CircleCI: Set up CircleCI with a Docker profile compatible with Drupal 10. This includes updating `.circleci/config.yml` based on Pantheon’s latest Docker build tools CI.
- Set Up GitHub Actions:
- Create a `.github/workflows/deploy.yml` to manage the deployment from GitHub to Pantheon.
- Include steps for setting up Terminus, authenticating with Pantheon, and executing deployment scripts.
- Create a ‘./deploy-to-live-on-pantheon.sh` shell script to automate through each sites deployment using Terminus actions.
- Automate Deployment Processes: Utilize scripts to manage the update and deployment tasks, ensuring they trigger upon PR approval and seamlessly push changes from DEV to LIVE.
- Monitor and Log: Implement logging within the GitHub Actions to monitor the deployment process and catch any issues in real-time.
By adopting GitHub Actions, we effectively maintained the flexibility of our CI/CD pipeline while leveraging Pantheon’s hosting capabilities saving us tons of time with deployment.
Wrapping Up
The transition to GitHub Actions from Pantheon Autopilot was a pivotal move for our Drupal 10 upgrade project. It not only allowed us to maintain our use of CI/CD tools but also enhanced our deployment strategy across multiple environments whether the project be Drupal or WordPress. This approach can serve as a blueprint for other development teams facing similar challenges with platform limitations.
For developers navigating similar upgrades or looking to enhance their deployment strategies, adapting our approach could provide a robust solution, balancing complexity with efficiency in project workflows.
Feel free to explore other detailed documentation and repository setups on Pantheon’s GitHub for more insights into configuring your environments effectively.
Why Partner With Us
As a Pantheon Partner since 2011, we have consistently sought innovative ways to enhance the Pantheon platform’s offerings and assist our clients in creating remarkable digital systems. Our commitment to automation at every stage of development aligns perfectly with Pantheon’s vision. This strategic partnership enables us to provide cutting-edge solutions that streamline workflows and empower our clients to leverage the full potential of Pantheon’s powerful platform. If you’re looking for help with your project or your organization’s management, visit our WebOps Support offering for more information.