A small set of commands for managing Wordpress databases on production & development servers, using the Python library Fabric.
This fabfile is mostly used for shuffling around Wordpress databases, from production to dev, or vice-versa. It has functions to export, migrate, and import databases, as well as to transfer them between environments. Also, there's a function to download the contents of the Wordpress uploads directory. It should be noted that there are no cleanup functions for dumped/exported files, both local & remote: they are left in place, and not deleted.
New: Backup functionality. Backs up remote database, remote uploads folder, local database, and local archives folder to a remote server, good for creating off-site backups of your Wordpress project.
- New to Fabric? Check out this crash course.
- Clone to your WordPress site root (or anywhere actually), for example
myproject/fabfile. - Create a
fabfile/settings.pyby copying thefabfile/settings_example.py. Populate this new file with info specific to your Wordpress setup. (See file for more info.) - To upgrade from an older version, just place the contents of the newest
fabfile/folder directly into your currentfabfile/folder, overwriting existing files. Be sure to keep yoursettings.pyfile, and be sure to check the new version'ssettings_example.pyfor new/updated settings. View the changelog for detailed info.
- fab deploy (TODO: provide explanation on default behavior. See the code, and
fab -lfor more info.) - fab migrate
- fab update
- fab dump
- fab backup
- Security note: There's an .htaccess file containing "Deny from all" in the
fabfilefolder, however you'll want to be careful about putting this on a production/live server, specifically the settings.py file, so that you don't expose access to sensitive information. If you do put this code on a live server, you will definitely want to verify that those files are not accessible. - As pointed out above, there's no cleanup mechanism for dumped databases.