I know there have been several topics about syncing database between environments. However, I’ve not come across a solution to use Ansible for this task.
I think it would be really convenient for somebody who deploys the code with bedrock-ansible to also have a task set up for pulling and pushing the databse between local and remote environments.
So my question is has anyone managed to use Ansible with success when it comes to syncing database with Ansible? Perhaps you can share the definition of your db-syncing task?
We ended up forking this repo https://github.com/lavmeiker/capistrano-wpcli to fit into our workflow. I can’t remember if out of the box it works with bedrock-ansible. It will use wp search-replace to make sure serialized strings and urls are changed according to the environment. We also added a wp export to our production deploy tasks. This adds a db dump to the current release so that file structure and db is frozen in the event we need to roll back. Haven’t had to use it but it’s a good piece of mind.
Scott - Problem solved! The fast-support and industry-best practices that you guys use is what draws me - keep up the excellent work! (And let me know when you introduce or start working on a docker version of bedrock
Scott - On to staging…I am trying to connect to the staging server’s mariadb using Sequel Pro so I can import the database (after using SearchReplaceDB to replace dev URL to staging URL in the database of course.)
Scott - I am novice at command line. That’s the reason I prefer to use the GUI for this type of task. I understand your instructions, but I don’t understand how to implement them.
Can you verify:
SSH Host: Should I use hostname or IP for the staging server?
SSH User: Should this be blank or root or something else? We used vagrant on the dev, and digital ocean uses SSH keys so I don’t know what to use for this?
Host: either? shouldn’t matter.
User: well it can’t be blank. root is the default so probably that.
Key: you shouldn’t need to specify this. Sequel Pro will just use your default (~/.ssh/id_rsa)