Trellis & Bedrock is deactivating themes and plugins after destroy

I just recently (4 weeks ago) started using Trellis and Bedrock with Sage. I’ve been noticing that whenever I destroy a vagrant server and reboot later, my project is completely reset.

It defaults back to the 2017 theme.

My sage theme is deactivated and all plugins deactivated as well. Not only that but the database is completely reset.

For example. I have an older Roots theme project that I migrated over into a Trellis and Bedrock setup a few days ago. I just booted up that Trellis install and everything is back to the way it was.

What could I possibly be doing wrong?

The WP database lives on the VM, so you’ll want to export the DB before destroying the VM (assuming you want to keep site content like posts, and settings like active theme, etc.). Later, if you want to continue work on the site, do a vagrant up and import your copy of the DB.

You could search the forum for ideas related to DB management, but note that for export/import you could use a tool like Sequel Pro, or WP-CLI (especially with WP-CLI aliases), or WP Migrate DB Pro, etc.

Your project files (like Sage php files) will be synced between the VM and your regular local (host) machine, so they will remain after your destroy the VM.

Thanks for the info, I had no idea.
I don’t really like it but that’s the way it is I guess.

I use Sequel Pro already, so I guess I just need to remember to make backups before I destroy.

The whole reason I’ve been destroying a lot lately is because I seem to have intermittent issues with running more than one Trellis environment at once. If I run more than one at a time, some of projects don’t load up and I have a hard time connecting to the databases. If I run one at a time, I have no problem.

I’ve always had problems running two Trellis VMs at the same time. It seems to work for about ten minutes before the sites stop responding.

Rather than destroying, you can vagrant halt a VM to keep its current state, but shut it down, sort of like powering off a computer instead of reformatting it.

You can also power off a VM without losing its state from the Virtualbox GUI by right clicking and choosing shutdown, which is how I end up doing it because I’m angry with myself for forgetting to shut my last project down before starting the next one. This method is technically less safe than using vagrant halt.

2 Likes