-
Notifications
You must be signed in to change notification settings - Fork 36
NW-16007: Add site-level cloud hook examples #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
blkperl
wants to merge
4
commits into
acquia:master
Choose a base branch
from
blkperl:worktree-zazzy-wishing-dewdrop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a94274e
NW-16007: Add site-level cloud hook examples
blkperl 523fe3f
NW-16007: Create directories for site-level hooks
blkperl e0e599b
NW-16007: Use generic siteName in examples instead of mysite-prod
blkperl f710e54
Apply suggestions from code review
blkperl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Ignore everything in this directory | ||
| * | ||
| # Except this file | ||
| !.gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Ignore everything in this directory | ||
| * | ||
| # Except this file | ||
| !.gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Ignore everything in this directory | ||
| * | ||
| # Except this file | ||
| !.gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Ignore everything in this directory | ||
| * | ||
| # Except this file | ||
| !.gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Ignore everything in this directory | ||
| * | ||
| # Except this file | ||
| !.gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Ignore everything in this directory | ||
| * | ||
| # Except this file | ||
| !.gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/bin/sh | ||
| # | ||
| # Cloud Hook: maintenance-mode-disable-and-update | ||
| # | ||
| # Disable Drupal maintenance mode after a site-level code deployment and | ||
| # optionally run database updates if requested via extra-args. This script | ||
| # is intended to be used as a post-site-code-deploy hook. | ||
| # | ||
| # To trigger database updates, pass "update-db" or "updatedb" in the | ||
| # extra-args parameter when deploying via the Acquia Cloud UI or API. | ||
| # | ||
| # Usage: maintenance-mode-disable-and-update site target-env source-branch | ||
| # deployed-tag repo-url repo-type | ||
| # site-name extra-args | ||
|
|
||
| site="$1" | ||
| target_env="$2" | ||
| source_branch="$3" | ||
| deployed_tag="$4" | ||
| repo_url="$5" | ||
| repo_type="$6" | ||
| site_name="$7" | ||
| extra_args="$8" | ||
|
|
||
| echo "$site.$target_env: Disabling maintenance mode for site $site_name after deployment." | ||
|
|
||
| # Disable maintenance mode for Drupal 8/9/10/11 | ||
| # For Drupal 7, use: drush @$site.$target_env vset maintenance_mode 0 | ||
| drush @$site.$target_env state:set system.maintenance_mode 0 --input-format=integer | ||
|
|
||
| echo "$site.$target_env: Maintenance mode disabled for $site_name." | ||
|
|
||
| # Check if database updates were requested via extra-args | ||
| if echo "$extra_args" | grep -q "update-db\|updatedb"; then | ||
| echo "$site.$target_env: Running database updates for $site_name (requested via extra-args)." | ||
| drush @$site.$target_env updatedb --yes | ||
| echo "$site.$target_env: Database updates completed for $site_name." | ||
| else | ||
| echo "$site.$target_env: No database updates requested for $site_name." | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| #!/bin/sh | ||
| # | ||
| # Cloud Hook: maintenance-mode-enable | ||
| # | ||
| # Enable Drupal maintenance mode before a site-level code deployment. | ||
| # This script is intended to be used as a pre-site-code-deploy hook to | ||
| # ensure the site is in maintenance mode during deployment. | ||
| # | ||
| # Usage: maintenance-mode-enable site target-env source-branch deployed-tag | ||
| # repo-url repo-type site-name extra-args | ||
|
|
||
| site="$1" | ||
| target_env="$2" | ||
| source_branch="$3" | ||
| deployed_tag="$4" | ||
| repo_url="$5" | ||
| repo_type="$6" | ||
| site_name="$7" | ||
| extra_args="$8" | ||
|
|
||
| echo "$site.$target_env: Enabling maintenance mode for site $site_name before deployment." | ||
|
|
||
| # Enable maintenance mode for Drupal 8/9/10/11 | ||
| # For Drupal 7, use: drush @$site.$target_env vset maintenance_mode 1 | ||
| drush @$site.$target_env state:set system.maintenance_mode 1 --input-format=integer | ||
|
|
||
| echo "$site.$target_env: Maintenance mode enabled for $site_name." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/bin/sh | ||
| # | ||
| # Cloud Hook: post-site-code-deploy | ||
| # | ||
| # The post-site-code-deploy hook is run after code has been deployed to a | ||
| # specific site via the Acquia Cloud UI or API. This is a site-level hook | ||
| # that allows you to perform post-deployment tasks, such as disabling | ||
| # maintenance mode or running database updates. See ../README.md for details. | ||
| # | ||
| # Usage: post-site-code-deploy site target-env source-branch deployed-tag repo-url | ||
| # repo-type site-name extra-args | ||
|
|
||
| site="$1" | ||
| target_env="$2" | ||
| source_branch="$3" | ||
| deployed_tag="$4" | ||
| repo_url="$5" | ||
| repo_type="$6" | ||
| site_name="$7" | ||
| extra_args="$8" | ||
|
|
||
| echo "$site.$target_env: Completed deployment of $deployed_tag to site $site_name." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/bin/sh | ||
| # | ||
| # Cloud Hook: pre-site-code-deploy | ||
| # | ||
| # The pre-site-code-deploy hook is run before code is deployed to a specific | ||
| # site via the Acquia Cloud UI or API. This is a site-level hook that allows | ||
| # you to prepare a site for deployment, such as enabling maintenance mode. | ||
| # See ../README.md for details. | ||
| # | ||
| # Usage: pre-site-code-deploy site target-env source-branch deployed-tag repo-url | ||
| # repo-type site-name extra-args | ||
|
|
||
| site="$1" | ||
| target_env="$2" | ||
| source_branch="$3" | ||
| deployed_tag="$4" | ||
| repo_url="$5" | ||
| repo_type="$6" | ||
| site_name="$7" | ||
| extra_args="$8" | ||
|
|
||
| echo "$site.$target_env: Preparing to deploy $deployed_tag to site $site_name." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Ignore everything in this directory | ||
| * | ||
| # Except this file | ||
| !.gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| # Ignore everything in this directory | ||
| * | ||
| # Except this file | ||
| !.gitignore |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.