Ansible playbooks for Trellis database and uploads sync. Just copy and run without any extra configuration.
Ansible playbooks for Trellis database and uploads sync.
Just copy and run without any extra configuration.
database.yml
and uploads.yml
files into Trellis root folderbin/sync.sh
files into Trellis bin folderdb-backup-*.sql.gz
to your Bedrock .gitignore
fileRun ./bin/sync.sh <environment> <site name> <type> <mode>
<type>
options: uploads
, database
, all
<mode>
options: push
, pull
push
is for upload data from development and update selected environment, and the pull
for download data from selected environment and update development.uploads
sync is not destructive, it only adds or update new files, don't delete missing files.db-backup-YYYYMMDDTHHMMSS.sql.gz
is saved before import data.You can use alias for a shorter or more intuitive commands
Examples:
./bin/sync.sh stag example.com db up
./bin/sync.sh prod example.com media down
./bin/sync.sh prod example.com all up
Skipping the GUID column is the default behaviour as it can have unwanted effects on production environments. If you are sure you want to replace GUID URLs, for example if you are deploying a site to production for the first time, you can prevent skipping GUIDs with --extra-vars "skip_guids=false"
.
Example:
./bin/sync.sh prod example.com db up --extra-vars "skip_guids=false"
db-backup-YYYYMMDDTHHMMSS.sql.gz
file is automatically created inside destination environment Bedrock folder. In development, if you don't want it to be saved in the repository:
db-backup-*.sql.gz
to your Bedrock .gitignore
filePULL > Backup development database
task on database.yml
MIT
© 2018 Creame. Heavily inspired by trellis-database-uploads-migration and trellis-db-push-and-pull.
Special thanks to the Roots team whose Trellis make this project possible.