Using Local on multiple computers

I’d like to run a mirrored dev environment between 2 computers. I use dropbox to sync my wordpress installs. Is there a way to do the same with the wordress database? Does Local store the db in the same parent folder as the rest of the site files (wordpress install, etc)?

I’ve used the WP Migrate DB Pro for remote > local database syncs before, but I’m not sure that would work between 2 local environments and even if it did, it would be nice to have it even more automated through local.app.

Thanks!

4 Likes

You can use the Volumes Manager add-on and make the MySQL raw data folder be exposed in Dropbox on both computers. I believe the folder you’ll want to mount is /var/mysql

This isn’t officially supported so if you have any findings and get it working we’d love if you shared how :slight_smile:

@lessis @clay Just curious if you found a solution. I wanted to do something similar (except using Google Drive vs. Dropbox). I have my site set up on one computer. How would I go about syncing it on the other? If I add the same site with the same path, I get an error saying “site” has existing Local by Flywheel data. Please choose a different path.

4 Likes

Hi Clay - that’s a great idea. I’m looking for a similar solution as well. Has anyone successfully done this?

I also use dropbox to sync all of my files. This would be great. There must be some way to make this work…

I know this is not something official, but could you go further into detail for us non-server folks? I would be very happy to be able to develop locally on two synced machines. Thank.

I took a peek inside /var/mysql – seems to me it is the same as what’s inside ~/conf/mysql : just some conf data.

Still looking for a (sensible) way to get Local to be synchronized between 2 computers. No idea how to do this for the database, but just had a crazy idea involving Volumes Manager and Dropbox for the theme and site-specific plugin files.

Looks like /var/lib/mysql is the directory with the raw data, not /var/mysql. Sorry about that!

Seconding @dgalfano’s question - I couldn’t find a way to sync a site across two computers. I tried to add a site that I have in Dropbox and got the “[path] has existing Local by Flywheel data. Please choose a different path.” error message. It looks like the database files are contained right in the /app/sql/ folder, so if there was a way to add an existing Local by Flywheel site on the other computer, it might just work. Not sure how to get past that roadblock, though.

Those files in /app/sql/ are, I think, just backup files – they’re updated only when a Local site is shut down (or exported, I’d guess). I don’t think that they would get imported in any way automatically into an existing Local install, unless we could make WP-CLI do this.

Yeah, I realized that after I posted! The files in /app/sql/ look like a database dump rather than the actual, live database files. I think my roadblock is that the database files are only in the virtual machine in /var/lib/mysql and have no equivalent location (that I can tell) on my computer in the way that the conf and log files and folders do. I ended up figuring out pretty quickly how to get the WordPress files synced between Local sites on two computers with Volumes Manager since that was as simple as mapping my /app/ folder in Dropbox to the /app/ folder on the server, but I couldn’t get the reverse direction working for the database (pulling the database folder from the server to Dropbox in order to share it across computers).

Using Volumes Manager to map folders to DropBox also has a drawback: sites exported/archived to .zip do not include the mapped files. I currently map only the theme and plugin folders I work on to Dropbox, and when duplicating/archiving a site always have to remember re-mapping said folders into the new install. Logical, of course, but not quite perfect.
Oh, and the database is still un-synched, or rather, manually “synched” using Migrate DB Pro.

has this been figured out? would like to do this on google drive if possible.

Would like to bump this thread - if someone could figure this out it would literally be the ultimate WP dev environment…

2 Likes

Agreed. Would literally change everything about how I develop.

1 Like

Until this is something that is more easily doable with Local I’m running my local installs of WP from dropbox on my Mac that is then connected to a remote “development” database. Point the MAMP document root to dropbox on all your computers and you’re all sorted - you can pick up on a laptop where you left off all whilst developing locally…once Local does have this though please let me know!!

I recently tested this with Local on macOS (Faster Docker Volumes enabled) and it works. You have to use the Volumes add-on mentioned before.


Before going into what I did, here are some important notes:

  • This is not supported! Do not complain if and when things break :slight_smile:
  • Do not run the site on both computers at the same time. You will run into nasty conflict files and then have to use InnoDB’s recovery functionality.
  • To reiterate, stop the site on one computer before running the site on another computer
  • Wait for Dropbox to sync prior to starting the sites!

Here’s what I did:

  1. Created a site I want to share with multiple computers via Dropbox
  2. Right-clicked on the site and then went to “Open Site SSH”
  3. Entered cp -r /var/lib/mysql /mysql-backup
  4. With the Volumes add-on under “More”, I pointed /app to a folder in Dropbox named something like ~/Dropbox/site-name/app
  5. Added a new mount pointing to /var/lib/mysql in the container and set ~/Dropbox/site-name/mysql-raw as the host folder
  6. Right-clicked on the site and went to “Open Site SSH” again
  7. Entered rm -rf /var/lib/mysql/*
  8. Entered cp -r /mysql-backup/* /var/lib/mysql
  9. Restart the site
  10. Once you verify it’s working right you can SSH in again and rm -rf /mysql-backup to remove that folder

That will set the site up to start syncing with Dropbox.

Now, on the other computer you’ll need to:

  1. Wait for Dropbox to sync!
  2. Create a new site with the same exact domain as the one on the other
  3. Use the Volumes add-on to link /app and /var/lib/mysql like before
  4. You should be good to go after that. If not, restart the site.
3 Likes

Bump. I assumed this would be a “no-brainer” feature when I first installed Local; that everything would be self-contained in whatever destination folder was chosen by the user. Like virtually every other application. Why the Local app’s per-site configuration isn’t stored with the site doesn’t make sense.

Thanks for these instructions. When creating the new site on second computer, do you leave the site path to default? On my original site, I have put that site path in the dropbox folder, so I’m wondering if that was a mistake that the volumes add-on instructions is trying to fix.

Thanks again for the help!

Site path doesn’t matter on the second site since you’ll be remapping it with the Volumes add-on. I would just keep it as the default.