定制 fourkitchens/acquia-cloud-hooks 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

fourkitchens/acquia-cloud-hooks

Composer 安装命令:

composer require fourkitchens/acquia-cloud-hooks

包简介

README 文档

README

Automated deployment hooks for Acquia Cloud Platform. These hooks run in response to code deployments and commits, handling Drupal deployment steps and Varnish cache clearing. The post-code-deploy hook also handles database/file synchronization.

How It Works

Acquia Cloud Hooks are shell scripts that Acquia automatically executes when certain events occur in your environment. This package provides two hooks with different responsibilities:

Hook Trigger Script
post-code-deploy A tag or branch is deployed to an environment common/post-code-deploy/build.sh
post-code-update A commit is pushed to a branch currently deployed to an environment common/post-code-update/build.sh

What Each Hook Does

Both hooks share these steps:

  1. Skip the RA environment — the Release Agent environment is always bypassed.
  2. Check for a skipbuild file — if present, exits immediately (see below).
  3. Authenticate with the Acquia Cloud API via ACLI.
  4. Run deployment commands via helper/deploy.sh (or a custom script if one exists).
  5. Clear Varnish caches for all active domains in the environment.

post-code-deploy only

In addition to the shared steps, post-code-deploy also syncs data from the canonical environment (default: prod):

  • On non-canonical environments: copies the database and files from prod (runs concurrently).
  • On the canonical environment: creates a database backup before deploying.

Default Deploy Script

helper/deploy.sh runs the standard Drupal deployment sequence:

drush updatedb
drush cache-rebuild
drush config-import
drush config-import  (second pass)
drush cache-rebuild

Custom Deploy Script

To override the default deploy steps, create scripts/custom/deploy.sh in your project root. If this file exists, it will be called instead of helper/deploy.sh.

Setup

1. Install via Composer

composer require fourkitchens/acquia-cloud-hooks

2. Configure API Credentials

For each environment, create a bashkeys.sh file at the private file path:

/mnt/gfs/home/{site}/{environment}/nobackup/bashkeys.sh

The file must export your Acquia Cloud API credentials:

export ACQUIACLI_KEY="your-api-key"
export ACQUIACLI_SECRET="your-api-secret"

Generate API tokens at: https://docs.acquia.com/cloud-platform/develop/api/auth/#cloud-generate-api-token

3. Configuration Variables

common/post-code-deploy/build.sh (data sync variables):

Variable Default Description
ACQUIA_CANONICAL_ENV prod Environment to sync database and files from
ACQUIA_DATABASE_NAME $site Database name to backup/copy
ACLI_MAX_TIMEOUT 600 Max seconds to wait for async API operations
ACLI_DELAY 15 Seconds between API status checks

These variables are not present in post-code-update as it does not perform data sync.

Skipping a Build

To disable automated deployment for a specific environment without removing the hook, create an empty file at:

/mnt/gfs/home/{site}/{environment}/nobackup/skipbuild

Example:

touch /mnt/gfs/home/mysite/dev/nobackup/skipbuild

When this file is detected, the hook exits immediately with a message:

The skip file was detected. You must run backups and build commands manually.

All automated steps are skipped — no database sync, no file sync, no Drush commands, no Varnish clearing. The hook exits with code 0 so the deployment itself still succeeds.

To re-enable automated builds, delete the file:

rm /mnt/gfs/home/mysite/dev/nobackup/skipbuild

When to use skipbuild: This is useful when you need to manually control a deployment — for example, when migrating data, running a complex update that requires manual steps, or temporarily disabling automation on a specific environment without affecting others.

Dependencies

  • Acquia CLI (acli) — must be available at vendor/bin/acli
  • Drush — must be available at vendor/bin/drush
  • PHP — required for the helper scripts (helper/*.php)

Helper Scripts

Script Purpose
helper/deploy.sh Default Drupal deployment commands
helper/get-env-uuid.php Retrieves an environment UUID via ACLI
helper/get-env-domains.php Retrieves active domains for an environment
helper/wait-for-notification.php Polls async Acquia API operations until completion

fourkitchens/acquia-cloud-hooks 适用场景与选型建议

fourkitchens/acquia-cloud-hooks 是一款 基于 Shell 开发的 Composer 扩展包,目前已累计 6.1k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 08 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 fourkitchens/acquia-cloud-hooks 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 fourkitchens/acquia-cloud-hooks 我们能提供哪些服务?
定制开发 / 二次开发

基于 fourkitchens/acquia-cloud-hooks 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 6.1k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 7
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 9
  • Forks: 0
  • 开发语言: Shell

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-08-09