Skip to content
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

Document how to pull database dumps from Acquia Cloud Next into a Tugboat preview #374

Open
q0rban opened this issue Oct 5, 2023 · 2 comments

Comments

@q0rban
Copy link
Contributor

q0rban commented Oct 5, 2023

We have #207 , but this is not suited for Acquia Cloud Next. We need different documentation for pulling database dumps on the command-line for ACN.

@q0rban
Copy link
Contributor Author

q0rban commented Oct 5, 2023

Here is an example shell script for doing this:

#!/bin/bash
set -euo pipefail

# Gets the latest database backup. 
# This requires:
#   - curl and jq be installed on the Tugboat service.
#   - two custom environment variables:
#     1. ACQUIA_CLOUD_API_KEY
#     2. ACQUIA_CLOUD_API_SECRET
# Also, specify your environment id, e.g. example.prod
environment_id=[your-environment-id]
# And specify your database name, e.g. example
database_name=[your-database-name]

# Install Acquia CLI.
curl --remote-name --location https://github.com/acquia/cli/releases/latest/download/acli.phar
chmod +x acli.phar
mv acli.phar /usr/local/bin/acli

# Login.
acli auth:login --no-interaction --key "$ACQUIA_CLOUD_API_KEY" --secret "$ACQUIA_CLOUD_API_SECRET"

# Get last backup id.
backup_id=$(acli --no-interaction api:environments:database-backup-list "$environment_id" "$database_name" | jq '.[0].id')
# Get DB backup URL.
backup_url=$(acli --no-interaction api:environments:database-backup-download "$environment_id" "$database_name" "$backup_id" | jq --raw-output '.url')

# Debug info.
echo "🤖 backup_id > $backup_id"
echo "🤖 backup_url > $backup_url"

# Download DB backup.
curl -o db-dump.sql.gz "$backup_url"

@vauxia
Copy link

vauxia commented Oct 6, 2023

Thank you for this. I also moved environment ID and database name to ENV so this is more cut-and-pasteable :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants