Deploying WordPress with Capistrano using wp-cap
Here is the steps:
- Clone wp-cap to a directory, e.g. my-wordpress
git clone git://github.com/adamhunter/wp-cap.git my-wordpress Copy your WordPress files to my-wordpress/public so you will have
my-wordpress/ ├── config └── public ├── wp-admin ├── wp-content └── wp-includesYou want to point your WordPress domain to my-wordpress/public
Move my-wordpress/public/wp-config-sample.php to my-wordpress/config/wp-config-sample.php
my-wordpress/ ├── Capfile ├── config │ ├── deploy.rb │ └── wp-config-sample.php ├── public │ ├── index.php │ ├── license.txt │ ├── readme.html │ ├── wp-activate.php │ ├── ...Now make sure your WordPress installation is good to go
- Push your changes in my-wordpress to your own Git repository
- Edit my-wordpress/config/deploy.rb to conform your production environment. You will need to set:
application: this is the name of your application and the folder it will reside in on your server domain: this is the domain of your app user: this is the user that will be used to SSH and copying your files to your server git_domain and git_user should be self explanatory db_name, db_user, db_pass, db_host and db_prfx are all pretty self explanatory too if you have ever read through wp-config-sample.php. If you haven’t, go do that right now.
- Run
cap deploy:setup - If everything is good, run
cap deploy
I created an example of WordPress setup using the wp-cap deployment script here