Comments (8)
Glad to hear you're liking Bedrock :)
- I doubt we'd ever have this feature included by default. I understand the use case but at first thought it seems like it would be best in an extension.
- This is something that would probably also be an extension (separate Gem) but maybe included by default.
I think this would actually be a fairly simple wrapper using WP-CLI. No point in duplicating a tool that already does it well. It has import
and export
(http://wp-cli.org/commands/db/) and search-replace
too (http://wp-cli.org/commands/search-replace/).
from bedrock.
In addition to wp-cli for sql tasks, I've come across syncdb. Looks promising.
from bedrock.
IMHO WP Migrate Pro is the only way to fly. It handles find and replace, remembers profiles and also syncs media files. I have been using it in tandem with bedrock and now I realise that I want to handle the database sync separately from Capistrano just to have flexibility.
https://deliciousbrains.com/wp-migrate-db-pro/
from bedrock.
Wouldn't using a plugin like Migrate Pro violate one of the 12 factor rules (namely "4 backing services" http://12factor.net/backing-services) ?
IMO using Capistrano + WP-CLI (and mabye syncdb) for snapshoting, updating and synching is the cleaner way.
from bedrock.
It may possibly be 'cleaner' in some sense but WP Migrate Pro works well, is here now, requires zero configuration and is a joy to use.
I find that separating the db sync from the rest of the deploy brings benefits in added flexibility. And having the media files synced with the DB saves a lot of time.
from bedrock.
Hi guys! Here's one approach to the problem solution. This rubygem that will add db pull and push using WP-CLI. https://github.com/lavmeiker/capistrano-wpcli
This is my first public release so I'd appreciate some feedback on this one! 😃
Hope you find it useful.
from bedrock.
Just closing this as it's discussion. Can be carried on here http://discourse.roots.io/.
from bedrock.
In case anyone else was looking at this, I added db backups when pushing/puling a DB. Added to the end of config/deploy.rb
:
time = Time.new
backup_timestamp = time.strftime("%Y%m%d%H%M")
set :db_backup_file_name, -> {"wpcli_db_backup.#{backup_timestamp}.sql.gz"}
set :local_db_folder_path, -> {"./db_backups"}
set :local_db_folder_file_path, -> {"./db_backups/#{fetch(:db_backup_file_name)}"}
set :remote_db_folder_path, -> {"#{fetch(:deploy_to)}/db_backups"}
set :remote_db_folder_file_path, -> {"#{fetch(:deploy_to)}/db_backups/#{fetch(:db_backup_file_name)}"}
before 'wpcli:db:pull', :backup_local_db do
run_locally do
execute :mkdir, "-p", fetch(:local_db_folder_path)
execute :wp, :db, :export, "- |", :gzip, ">", fetch(:local_db_folder_file_path)
end
end
before 'wpcli:db:push', :backup_remote_db do
on roles(:web) do
within release_path do
execute :mkdir, "-p", fetch(:remote_db_folder_path)
execute :wp, :db, :export, "- |", :gzip, ">", fetch(:remote_db_folder_file_path)
end
end
end
And then just .gitignore the db_backups
directory.
from bedrock.
Related Issues (20)
- Feature Request: More flexible .env.* chosing HOT 5
- Bug: Multisite not working HOT 1
- Bug: WP_ENVIRONMENT_TYPE set doesn't check if constant is already defined HOT 6
- ADD: Local environment in application.php HOT 1
- Wordpress Version in composer.json is ignored HOT 1
- Upgrading WP from 6.x to 6.3.1 stops loading core block css from wp-includes HOT 3
- There is no documentation on how to add custom blocks to a theme/plugin HOT 1
- Add file to configure production environments
- New `WP_DEVELOPMENT_MODE` constant HOT 2
- Cannot override eg. DISALLOW_FILE_MODS in .env?? HOT 3
- Redis Object Cache not working on WP_ENV='production' HOT 1
- html appended to core javascript files HOT 1
- [Feat] Keep the themes folder clean by skipping installing default themes during updates HOT 1
- [Feat] Also ignore env files not starting with `.env` HOT 2
- Add `WP_DISABLE_FATAL_ERROR_HANDLER=true` constant to development
- 404 on all perm link on frontend HOT 1
- Introduction of "use Dotenv::createImmutable()" breaks servers with multiple sites HOT 3
- phpdotenv warning about missing .env in theme folder HOT 1
- Seperate dynamic from static content for containerisation HOT 1
- WP CLI occurs “Error establishing a database connection.” in Bedrock project HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bedrock.