At Classic, some developers are standardizing the way they sync their local development environments with remote testing servers. I recently invested time re-familiarizing myself with drush aliases. I am documenting the process in hopes of simplifying the steps for others.
Before
Here’s the typical workflow beforehand:
- ssh into remote server
- Backup test server database by some means
- Ex: mysqldump, drush sql-dump, backup/migrate, locate a recent deploy-site backup
- Copy and restore database backup in step #2 to local environment
- Run a set of commands, a bash script, or some such to do one, or any of the following:
- clear cache
- sanitize user logins/emails
- disable modules specific to test server environment
- enable modules specific to, or aiding, your local development environment
- Begin feature development
After
Using drush aliases and the the sync enable command, we can simplify the process to one step:
$ drush sql-sync @mysite.mysite-test @mysite.mysite-local -y