(DEPRECATED) THIS PROJECT IS NOT MAINTAINED ANYMORE, see valentinocossar/trellis-database-uploads-migration
This project is based on bedrock-capistrano and works only with Trellis and Bedrock.
These are the Capistrano configs for deploying uploads and database with Bedrock using capistrano-trellis-bedrock-wpcli.
- Ruby >= 2.0
Required Gems:
capistrano
(~> 3.6.0)capistrano-trellis-bedrock-wpcli
(~> 1.0.0)
These can be installed manually with gem install <gem name>
but it's highly suggested you use Bundler to manage them. Bundler is basically the Ruby equivalent to PHP's Composer. Just as Composer manages your PHP packages/dependencies, Bundler manages your Ruby gems/dependencies. Bundler itself is a Gem and can be installed via gem install bundler
(sudo may be required).
The Gemfile
in the root of this repo specifies the required Gems (just like composer.json
). Once you have Bundler installed, run bundle install
to install the Gems in the Gemfile
. When using Bundler, you'll need to prefix the cap
command with bundle exec
as seen below (this ensures you're not using system Gems which can cause conflicts).
- Download the latest release of capistrano-bedrock.
- Copy the following
capistrano-bedrock
files into the root of your Bedrock project:
Capfile
Gemfile
Gemfile.lock
database.sh
uploads.sh
VERSION.md
(to know which version ofcapistrano-bedrock
are you using)
- Copy the content of
capistrano-bedrock .gitignore
file into the.gitignore
file of your Bedrock project. - Copy the following
capistrano-bedrock
files/folders into yourconfig
directory:
config/deploy/*
config/deploy.rb
- Run
gem install bundler -v "~>1.12.0" && bundle
into the root of your Bedrock project. - Edit your
config/deploy.rb
configs to set the roles/servers and connection options. - Edit your
config/deploy/*
stage/environment configs to set the specific roles/servers and connection options. - Enjoy
capistrano-trellis-bedrock-wpcli
Tasks.
-
./database.sh staging/production push
orbundle exec cap staging/production wpcli:db:push
- Pushes the local WordPress database to the remote server and replaces the urls (Optionally backs up the remote database before pushing, only ifwpcli_backup_db
is set to true, see Configuration) -
./database.sh staging/production pull
orbundle exec cap staging/production wpcli:db:pull
- Pulls the remote server WordPress database to local and replaces the urls (Optionally backs up the local database before pulling, only ifwpcli_backup_db
is set to true, see Configuration) -
./database.sh staging/production backup
orbundle exec cap staging/production wpcli:db:backup:remote
- Backs up remote staging/production database (useswpcli_local_db_backup_dir
to define the location of the export) -
./database.sh development backup
orbundle exec cap development wpcli:db:backup:local
- Backs up local vagrant database (useswpcli_local_db_backup_dir
to define the location of the export)
-
./uploads.sh staging/production push
orbundle exec cap staging/production wpcli:uploads:rsync:push
- Pushes the local uploads delta to remote machine using rsync. -
./uploads.sh staging/production pull
orbundle exec cap staging/production wpcli:uploads:rsync:pull
- Pulls the remote uploads delta to local machine using rsync.
- Fork it (https://github.com/itsensoul/capistrano-bedrock/fork)
- 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