Ansible playbook for Trellis that manages database and uploads migration. Inspired by hamedb89/trellis-db-push-and-pull.
- Download latest release
- Copy
CHANGELOG-TRELLIS-DATABASE-UPLOADS-MIGRATION.md
file into Trellis root folder (so you can always know the version of the tool you are using) - Copy all
*.yml
files into Trellis root folder - Copy all
bin/*.sh
files into Trellis bin folder - Add
database_backup/*
to the end of the Bedrock.gitignore
file - Set alias for host files as mentioned below in the hosts configuration section
- Tested up to Ansible 2.6.1
- This tool doesn't work with Ansible 2.4.1.0 due to a bug (see #9)
- The development vagrant VM must be powered on every time you run a command, this because the tool checks if the site folder exists and its name is the same of the
local_path
parameter inwordpress_sites.yml
- The
database_backup
folder inside Bedrock will be automatically created if doesn't exist - I recommend you to not perform
git
operations while running./bin/database.sh
command, this because the tool uses the Bedrock folder as temp folder to store database dump before importing/exporting it and then delete it - To support url search and replace for Trellis 0.9.8 and lower, remove
.canonical
from variablesurl_from
andurl_to
in the filesdatabase-pull.yml
anddatabase-push.yml
- This tool hasn't been tested with a multisite configuration, any help with this implementation would be appreciated
- This tool has only been tested with macOS and Ubuntu 18.04 LTS, any help with other operating systems would be appreciated
- Run
./bin/uploads.sh <environment> <site name> <mode>
- Run
./bin/database.sh <environment> <site name> <mode>
- Available
<mode>
options for uploads task:push
,pull
- Available
<mode>
options for database task:push
,pull
,backup
- The
push
is for sending to the selected environment and thepull
for receiving from it - The
backup
is for backup the database of the selected environment
[development]
development_host ansible_host=192.168.50.5 ansible_connection=ssh ansible_user=vagrant ansible_ssh_private_key_file=.vagrant/machines/default/virtualbox/private_key ansible_ssh_extra_args="-o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ForwardAgent=yes"
[web]
development_host ansible_host=192.168.50.5 ansible_connection=ssh ansible_user=vagrant ansible_ssh_private_key_file=.vagrant/machines/default/virtualbox/private_key ansible_ssh_extra_args="-o StrictHostKeyChecking=no -o GlobalKnownHostsFile=/dev/null -o UserKnownHostsFile=/dev/null -o IdentitiesOnly=yes -o ForwardAgent=yes"
[staging]
staging_host ansible_host=your_server_hostname
[web]
staging_host ansible_host=your_server_hostname
[production]
production_host ansible_host=your_server_hostname
[web]
production_host ansible_host=your_server_hostname
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request