I’m impressed by the work made in Trellis Bedrock Sage. Thank you so much for this.
This is my first try with Vagrant, Ansible and Bedrock. Running VM , create pages and seeing the web result, all was going well… until I want to backup the DB.
I installed WP DB Backup and when I tried to create a Job (click create), I hit a not found page??
I didn’t find anything about this problem after a search , then I thought maybe a Vagrant destroy and up commands could help.
I noted at the restart that Ubuntu self-updated (not sure if this causes the problem). The boot did also a re-approvisioning and It seems weird to me because didn’t happening before (I think).
At the first try to open the web site after reboot, I saw a blank (totaly) page, I tried to enter in the /admin, see the log in inputs (pfiou) but admin admin not authorized!
I did another destroy and up and see same blank page but this time I was able to enter in Admin interface, and all was gone! Just the sample page I had erased and no menu…
Anyone have an idea of what happened please? I a bit affraid to retry to put content and lose it again.
Thank you (sorry for my english)
Sorry to be the bearer of bad news, but the development database is stored on the vagrant box. By destroying the box with the destructive
vagrant destroy, you also take the development database with it.
You’re not limited to plugins to backup the database: you can also use WP-CLI, any database management program (Sequel Pro is a good example) or mysql command line commands to back up the database.
Would it be a good idea/feature to have Trellis automatically create a database on each halt/destroy so these things don’t happen?
There may be couple of reasons, scenarios for this although i don’t know how big the possibilities are:
- vagrant or vm break and you can’t get into the vagrant box
- reprovisioning goes wrong and the database gets overwritten/dropped
- we destroy the wrong vagrant by mistake
- your disk dies
The DB is the only thing we don’t have a “backup” for and it’s the only thing that can’t be “rebuild/shared”.
Imagine cloning the roots example style project with a specific sql dump of the last time so when first running vagrant up it would use that (or other specified) sql dump.
Of course this would be a workflow fitting only 1 person but if anything does happen you would just git clone vagrant up on any laptop and continue the work, you would maybe lose some data/work from the last halt+commit but not all of it.
A sql dump that each user would be able to create with basic settings for plugins/themes/licences, default pages could be loaded on each fresh project which would also save quite a bit of time.
This has been discussed and implemented in a fork of a previous version of Trellis. Keep database synced between computers in Trellis/Bedrock/Sage setup
Personally, I think database management is beyond the scope of Trellis as it’s something that each developer or team will be very opinionated on. We could probably come up with sensible defaults but there’s definitely not a ‘one size fits all’ solution.
Thank you for the quick answer @Foxaii, so I should listen my feeling when I was finding the term “destroy” a bit exaggerated to shutdown the VM. I misunderstood the use of the command after seeing it a lot in troubleshooting posts. I know now I must use “halt”.
Luckily, most of my html is saved because I write it in Sublime.
I was looking for WP-CLI and Sequel Pro solutions yesterday to simply Dump the DB but I would prefer to automated the process that’s why I came back to the plugin WDB.
But yes I agree with @darjanpanic that it could be a great feature to easily create a DB dump in a accessible place that are easy to sync.
But you @Foxaii, how do you proceed to backup your DB?
And a last question, I remember to reading about that is not a good idea to develop into a synced dir like Google Drive because Node and Gulp in action modify a lot of files. Is it really so bad?
Because with all this trouble with local dev to sync to work at any place, I came again to thinking that is easier to work on remote machine in staging environment.
I think I will give a try to Keep database synced between computers in Trellis/Bedrock/Sage setup
Thank you again for your good work and good support, I make all I can to promote / encourage others to support your work by paying for screencasts, buy the book and soil plugin and so on.
I use Sequel Pro and WP-CLI (mostly for its search-replace function).
For menus, I have a wrapper for
wp_create_nav_menu so the menus can be created programmatically. It’s no more effortful than using the menu editor.
I have previously set menus up on staging then imported the staging database to development. For the most part I try to keep exclusively dummy or duplicate data on the development machine.
One option I use is automysqlbackup which periodically creates database backups across multiple projects. It uses cron to run the backup at whatever intervals you like, but you could also run this tool as part of a script run before each shutdown.
It’s also worth pointing out as @Foxaii mentions, if you want to do a really quick dump of a database before doing something drastic, WP-CLI does a great job of creating simple DB exports and imports, just by running
wp db export &
wp db import in the root of your project folder. It’s saved my bacon many times.
Yeah the WP CLI way seems to be the best option as it’s also the cleanest one and it’s already installed in trellis. Thanks.
Yeap, WP-CLI export db works well. Thank you all guys!
This topic was automatically closed after 6 hours. New replies are no longer allowed.