Wordpress Capistrano (3) Deploy
Easy deployment for Wordpress sites including your database.
- Your production and staging servers have to be accessible via ssh
- Git has to be installed in every environment
- The same applies to wp-cli (http://wp-cli.org/#install)
For the capistrano deployment to run properly you have make some preparations to your local environment:
- Get the latest wordpress version with
git submodule initand
git submodule update
- capistrano must be installed:
- Rename local-config.SAMPLE.php to local-config.php and replace the placeholders with your database credentials
- Rename config.SAMPLE.rb to config.rb (located in the config directory). For every stage you have to edit your database credentials. Pay attention to the :local_url variable!
- Rename the files in config/deploy accordingly and edit the variables so they match the environment
- Activate the WP Migrate DB and WP Migrate DB CLI plugin
bundle exec cap staging deploy
Deploy your current code base to the staging server
bundle exec cap staging wordpress:db:pull
Copy the staging database to your local database.
bundle exec cap staging wordpress:db:push
Copy the local database to the staging server
wordpress:db:push will find the remote url and replaces it with your local url. So keeping your database in sync is a no brainer.
- Wordpress Multisite Deployment
- Keeping upload folders in sync
Wordpress as a submoduleit's ugly, but it gets the job done ...