Skip to content

Commit

Permalink
Merge pull request #218 from palantirnet/cloud-api-version-2-backup
Browse files Browse the repository at this point in the history
Move Acquia DB backups to cloud v2.
  • Loading branch information
byrond authored Oct 14, 2024
2 parents ba04c00 + 90b7d7d commit 7f7be9e
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 399 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
echo "phpmd for tasks"
vendor/bin/phpmd src text defaults/standard/phpmd.xml --suffixes php,inc,module,theme,profile,install,test
echo "phpstan for tasks"
vendor/bin/phpstan analyse src --level=2
vendor/bin/phpstan analyse -c phpstan.neon
# Install a drupal test project.
- run:
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"sort-packages": true,
"allow-plugins": {
"cweagans/composer-patches": true,
"dealerdirect/phpcodesniffer-composer-installer": true
"dealerdirect/phpcodesniffer-composer-installer": true,
"phing/phing-composer-configurator": true
}
},
"extra": {
Expand Down
22 changes: 6 additions & 16 deletions defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ build:
# The destination host, either 'acquia', 'pantheon', 'platformsh', or 'other'. This is
# currently only used when setting up the settings.php file for a Drupal site.
host: acquia
# Adding specific packages for specific host. One per line.
host_packages:
acquia:
- "typhonius/acquia-php-sdk-v2:^2.0"

# Drupal configuration used by targets/drupal.xml
drupal:
Expand Down Expand Up @@ -134,9 +138,9 @@ drupal:
# $> gunzip -c FILENAME.sql.gz | drush sqlc
#
# Command to extract text contents of the backup file.
contents_command: gunzip -c
contents_command: gzip -dc
# Command to load database contents into Drupal.
mysql_command: drush sqlc
mysql_command: mysql --host=${drupal.site.database.host} --user=${drupal.site.database.username} --password=${drupal.site.database.password} --database=${drupal.site.database.database}

# Load a specific file rather than one matching the `export_pattern`. This can be used
# if your build relies on a seed database that is checked in to the repository.
Expand Down Expand Up @@ -191,14 +195,6 @@ acquia:
# Directory for storing downloaded database backups.
backups: artifacts/backups

# Max age of the downloaded backup database, in hours.
backup_age_hours: 24

# The Acquia Cloud hosting "realm" where the site is running.
# - Acquia Cloud Enterprise: 'prod'
# - Acquia Cloud Professional: 'devcloud'
realm: ""

# Acquia site/application name.
site: ""

Expand All @@ -209,12 +205,6 @@ acquia:
# Acquia environment to download backups from.
env: "prod"

# Acquia Cloud API credentials file, downloaded from your Acquia account. Do not check
# this file into your codebase.
cloud:
conf: "${env.HOME}/.acquia/cloudapi.conf"


# Configuration to use the PHP interpreter's built in linter to check for syntax errors
# and deprecated code. This property is used by the <phplint> task in the
# defaults/build.xml template.
Expand Down
9 changes: 9 additions & 0 deletions defaults/install/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ddev docker env file.
# See: https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/#providing-custom-environment-variables-to-a-container

# Copy this file into .env (ie. remove .example)

# Set Acquia Cloud API keys.
# See DevOps secure note in 1Password.
export ACQUIA_CLOUD_API_KEY='REPLACE_ME'
export ACQUIA_CLOUD_API_SECRET='REPLACE_ME'
2 changes: 1 addition & 1 deletion defaults/install/the-build/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ drupal:

# OPTIONAL: The Drupal database name defaults to the site's "dir" value.
database:
database: "drupal"
database: "db"

# Multisites created by `phing drupal-add-multisite` will be automatically added here.
# @multisite_placeholder@
Expand Down
8 changes: 1 addition & 7 deletions docs/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,9 @@ Download a recent backup from Acquia Cloud.
| Name | Type | Description | Default | Required |
|---|---|---|---|---|
| dir | directory path | Local backups directory. | | Yes |
| realm | string | Acquia hosting realm, either "devcloud" or "prod". | | Yes |
| site | string | Acquia site name. | | Yes |
| env | string | Acquia environment, generally "dev", "test", or "prod". | | Yes |
| database | string | Acquia database name. | The site name. | No |
| maxAge | int | Maximum age of the backup, in hours. | 24 | No |
| propertyName | string | Name of a property to set to the backup file. | | No |
| credentialsFile | file path | Path to your Acquia Cloud API credentials. (Do not check this file in to your repository) | `~/.acquia/cloudapi.conf` | No |

### Example

Expand All @@ -118,8 +114,6 @@ Download a recent backup from Acquia Cloud.
<taskdef name="getAcquiaBackup" classname="TheBuild\Acquia\GetLatestBackupTask" />

<!-- Required parameters only -->
<getAcquiaBackup dir="artifacts/backups" realm="devcloud" site="mysite" env="prod" />
<getAcquiaBackup dir="artifacts/backups" site="acquia_site_name" env="prod" database="acquia_database" />

<!-- More parameters -->
<getAcquiaBackup dir="artifacts/backups" realm="devcloud" site="mysite" env="prod" credentialsFile="artifacts/.acquia/cloudapi.conf" propertyName="drupal.site.load_db.file" />
```
7 changes: 7 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
level: 2
paths:
- src
excludePaths:
analyse:
- src/TheBuild/Acquia
126 changes: 0 additions & 126 deletions src/TheBuild/Acquia/AcquiaTask.php

This file was deleted.

Loading

0 comments on commit 7f7be9e

Please sign in to comment.