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.mdfile into Trellis root folder (so you can always know the version of the tool you are using)
- Copy all *.ymlfiles into Trellis root folder
- Copy all bin/*.shfiles into Trellis bin folder
- Add database_backup/*to the end of the Bedrock.gitignorefile
- 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_pathparameter inwordpress_sites.yml
- The database_backupfolder inside Bedrock will be automatically created if doesn't exist
- I recommend you to not perform gitoperations while running./bin/database.shcommand, 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 .canonicalfrom variablesurl_fromandurl_toin the filesdatabase-pull.ymlanddatabase-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 pushis for sending to the selected environment and thepullfor receiving from it
- The backupis 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